Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClément Foucault <foucault.clem@gmail.com>2018-10-25 20:08:35 +0300
committerClément Foucault <foucault.clem@gmail.com>2018-10-26 11:54:21 +0300
commit48b56481ea4c93c9fe538ddf3fce0b9af0446f7b (patch)
treec365d9987ea56551435149852ba64062d9e47a4d /source/blender/gpu/intern
parenta321f68f6421bbbc06e2a95e7316eaa5ee9d4160 (diff)
GPUTexture: Add supports for GL_DEPTH32F_STENCIL8 texture format
Diffstat (limited to 'source/blender/gpu/intern')
-rw-r--r--source/blender/gpu/intern/gpu_framebuffer.c1
-rw-r--r--source/blender/gpu/intern/gpu_texture.c18
2 files changed, 16 insertions, 3 deletions
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 */