Commit: 48b56481ea4c93c9fe538ddf3fce0b9af0446f7b
Author: Clément Foucault
Date:   Thu Oct 25 19:08:35 2018 +0200
Branches: blender2.8
https://developer.blender.org/rB48b56481ea4c93c9fe538ddf3fce0b9af0446f7b

GPUTexture: Add supports for GL_DEPTH32F_STENCIL8 texture format

===================================================================

M       source/blender/gpu/GPU_texture.h
M       source/blender/gpu/intern/gpu_framebuffer.c
M       source/blender/gpu/intern/gpu_texture.c

===================================================================

diff --git a/source/blender/gpu/GPU_texture.h b/source/blender/gpu/GPU_texture.h
index 23b88645e33..a74388d6340 100644
--- a/source/blender/gpu/GPU_texture.h
+++ b/source/blender/gpu/GPU_texture.h
@@ -100,9 +100,9 @@ typedef enum GPUTextureFormat {
 #if 0
        GPU_RGB10_A2,
        GPU_RGB10_A2UI,
-       GPU_DEPTH32F_STENCIL8,
 #endif
        GPU_R11F_G11F_B10F,
+       GPU_DEPTH32F_STENCIL8,
        GPU_DEPTH24_STENCIL8,
 
        /* Texture only format */
diff --git a/source/blender/gpu/intern/gpu_framebuffer.c 
b/source/blender/gpu/intern/gpu_framebuffer.c
index 20341b5d1e2..db5ab55c0a0 100644
--- a/source/blender/gpu/intern/gpu_framebuffer.c
+++ b/source/blender/gpu/intern/gpu_framebuffer.c
@@ -101,6 +101,7 @@ static GPUAttachmentType 
attachment_type_from_tex(GPUTexture *tex, int slot)
                case GPU_DEPTH_COMPONENT16:
                        return GPU_FB_DEPTH_ATTACHMENT;
                case GPU_DEPTH24_STENCIL8:
+               case GPU_DEPTH32F_STENCIL8:
                        return GPU_FB_DEPTH_STENCIL_ATTACHMENT;
                default:
                        return GPU_FB_COLOR_ATTACHMENT0 + slot;
diff --git a/source/blender/gpu/intern/gpu_texture.c 
b/source/blender/gpu/intern/gpu_texture.c
index c3a1148a360..444424af55c 100644
--- a/source/blender/gpu/intern/gpu_texture.c
+++ b/source/blender/gpu/intern/gpu_texture.c
@@ -170,7 +170,10 @@ static void gpu_validate_data_format(GPUTextureFormat 
tex_format, GPUDataFormat
        {
                BLI_assert(data_format == GPU_DATA_FLOAT);
        }
-       else if (tex_format == GPU_DEPTH24_STENCIL8) {
+       else if (ELEM(tex_format,
+                     GPU_DEPTH24_STENCIL8,
+                     GPU_DEPTH32F_STENCIL8))
+       {
                BLI_assert(data_format == GPU_DATA_UNSIGNED_INT_24_8);
        }
        else {
@@ -207,7 +210,10 @@ static GPUDataFormat 
gpu_get_data_format_from_tex_format(GPUTextureFormat tex_fo
        {
                return GPU_DATA_FLOAT;
        }
-       else if (tex_format == GPU_DEPTH24_STENCIL8) {
+       else if (ELEM(tex_format,
+                     GPU_DEPTH24_STENCIL8,
+                     GPU_DEPTH32F_STENCIL8))
+       {
                return GPU_DATA_UNSIGNED_INT_24_8;
        }
        else {
@@ -245,7 +251,10 @@ static GLenum gpu_get_gl_dataformat(GPUTextureFormat 
data_type, GPUTextureFormat
                *format_flag |= GPU_FORMAT_DEPTH;
                return GL_DEPTH_COMPONENT;
        }
-       else if (data_type == GPU_DEPTH24_STENCIL8) {
+       else if (ELEM(data_type,
+                     GPU_DEPTH24_STENCIL8,
+                     GPU_DEPTH32F_STENCIL8))
+       {
                *format_flag |= GPU_FORMAT_DEPTH | GPU_FORMAT_STENCIL;
                return GL_DEPTH_STENCIL;
        }
@@ -293,6 +302,8 @@ static uint gpu_get_bytesize(GPUTextureFormat data_type)
                        return 16;
                case GPU_RGB16F:
                        return 12;
+               case GPU_DEPTH32F_STENCIL8:
+                       return 8;
                case GPU_RG16F:
                case GPU_RG16I:
                case GPU_RG16UI:
@@ -350,6 +361,7 @@ static GLenum gpu_get_gl_internalformat(GPUTextureFormat 
format)
                /* Special formats texture & renderbuffer */
                case GPU_R11F_G11F_B10F: return GL_R11F_G11F_B10F;
                case GPU_DEPTH24_STENCIL8: return GL_DEPTH24_STENCIL8;
+               case GPU_DEPTH32F_STENCIL8: return GL_DEPTH32F_STENCIL8;
                /* Texture only format */
                /* ** Add Format here **/
                /* Special formats texture only */

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to