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
path: root/source
diff options
context:
space:
mode:
authorClément Foucault <foucault.clem@gmail.com>2017-05-20 14:11:21 +0300
committerClément Foucault <foucault.clem@gmail.com>2017-05-20 17:58:07 +0300
commit4c3382d55f98c721f6116919acce4abba8f01f11 (patch)
tree94d1afafec67e8ee1ea7663e6cbf5dc5db50cdbb /source
parent3f1a7aec13cc0cf5c441e463dbd8e9ffdd4b4f44 (diff)
GPUTexture: Enabling R32 format for linear depth encoding.
Diffstat (limited to 'source')
-rw-r--r--source/blender/draw/intern/draw_manager.c4
-rw-r--r--source/blender/gpu/GPU_texture.h2
-rw-r--r--source/blender/gpu/intern/gpu_texture.c2
3 files changed, 6 insertions, 2 deletions
diff --git a/source/blender/draw/intern/draw_manager.c b/source/blender/draw/intern/draw_manager.c
index e3137e16caf..da2d520ccff 100644
--- a/source/blender/draw/intern/draw_manager.c
+++ b/source/blender/draw/intern/draw_manager.c
@@ -329,12 +329,12 @@ static void drw_texture_get_format(DRWTextureFormat format, GPUTextureFormat *da
case DRW_TEX_RG_32: *data_type = GPU_RG32F; break;
case DRW_TEX_R_8: *data_type = GPU_R8; break;
case DRW_TEX_R_16: *data_type = GPU_R16F; break;
+ case DRW_TEX_R_32: *data_type = GPU_R32F; break;
#if 0
case DRW_TEX_RGBA_32: *data_type = GPU_RGBA32F; break;
case DRW_TEX_RGB_8: *data_type = GPU_RGB8; break;
case DRW_TEX_RGB_32: *data_type = GPU_RGB32F; break;
case DRW_TEX_RG_8: *data_type = GPU_RG8; break;
- case DRW_TEX_R_32: *data_type = GPU_R32F; break;
#endif
case DRW_TEX_DEPTH_16: *data_type = GPU_DEPTH_COMPONENT16; break;
case DRW_TEX_DEPTH_24: *data_type = GPU_DEPTH_COMPONENT24; break;
@@ -1909,6 +1909,8 @@ static GPUTextureFormat convert_tex_format(int fbo_format, int *channels, bool *
*is_depth = ELEM(fbo_format, DRW_TEX_DEPTH_16, DRW_TEX_DEPTH_24);
switch (fbo_format) {
+ case DRW_TEX_R_16: *channels = 1; return GPU_R16F;
+ case DRW_TEX_R_32: *channels = 1; return GPU_R32F;
case DRW_TEX_RG_16: *channels = 2; return GPU_RG16F;
case DRW_TEX_RGBA_8: *channels = 4; return GPU_RGBA8;
case DRW_TEX_RGBA_16: *channels = 4; return GPU_RGBA16F;
diff --git a/source/blender/gpu/GPU_texture.h b/source/blender/gpu/GPU_texture.h
index bd98f4534b3..01390760beb 100644
--- a/source/blender/gpu/GPU_texture.h
+++ b/source/blender/gpu/GPU_texture.h
@@ -67,6 +67,7 @@ typedef enum GPUTextureFormat {
GPU_RGBA8,
GPU_RG32F,
GPU_RG16F,
+ GPU_R32F,
GPU_R16F,
GPU_R8,
#if 0
@@ -85,7 +86,6 @@ typedef enum GPUTextureFormat {
GPU_RG8,
GPU_RG8I,
GPU_RG8UI,
- GPU_R32F,
GPU_R32I,
GPU_R32UI,
GPU_R16I,
diff --git a/source/blender/gpu/intern/gpu_texture.c b/source/blender/gpu/intern/gpu_texture.c
index 538ed93b0bf..3ac1571bf82 100644
--- a/source/blender/gpu/intern/gpu_texture.c
+++ b/source/blender/gpu/intern/gpu_texture.c
@@ -159,6 +159,7 @@ static GLenum gpu_texture_get_format(
case GPU_DEPTH_COMPONENT32F:
case GPU_RGBA8:
case GPU_R11F_G11F_B10F:
+ case GPU_R32F:
*bytesize = 4;
break;
case GPU_DEPTH_COMPONENT24:
@@ -186,6 +187,7 @@ static GLenum gpu_texture_get_format(
case GPU_RGB16F: return GL_RGB16F;
case GPU_RG16F: return GL_RG16F;
case GPU_RGBA8: return GL_RGBA8;
+ case GPU_R32F: return GL_R32F;
case GPU_R16F: return GL_R16F;
case GPU_R8: return GL_R8;
/* Special formats texture & renderbuffer */