[Bf-blender-cvs] [4c3382d55f9] blender2.8: GPUTexture: Enabling R32 format for linear depth encoding.

Clément Foucault noreply at git.blender.org
Sat May 20 23:58:18 CEST 2017


Commit: 4c3382d55f98c721f6116919acce4abba8f01f11
Author: Clément Foucault
Date:   Sat May 20 13:11:21 2017 +0200
Branches: blender2.8
https://developer.blender.org/rB4c3382d55f98c721f6116919acce4abba8f01f11

GPUTexture: Enabling R32 format for linear depth encoding.

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

M	source/blender/draw/intern/draw_manager.c
M	source/blender/gpu/GPU_texture.h
M	source/blender/gpu/intern/gpu_texture.c

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

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 */




More information about the Bf-blender-cvs mailing list