GPUTexture: Enabling R32 format for linear depth encoding.

This commit is contained in:
Clément Foucault 2017-05-20 13:11:21 +02:00
parent 3f1a7aec13
commit 4c3382d55f
3 changed files with 6 additions and 2 deletions

View File

@ -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;

View File

@ -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,

View File

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