From 72e2ed15137c01111575ebc72e97c162c4cafad8 Mon Sep 17 00:00:00 2001 From: baldurk Date: Sun, 14 Sep 2014 20:28:41 +0100 Subject: [PATCH] Remove UNorm_SRGB component type as it's redundant --- renderdoc/api/replay/replay_enums.h | 1 - renderdoc/driver/d3d11/d3d11_analyse.cpp | 28 ++++++++++++------------ renderdoc/driver/d3d11/d3d11_common.cpp | 14 ++++-------- renderdoc/driver/gl/gl_common.cpp | 3 --- renderdocui/Interop/Enums.cs | 1 - renderdocui/Interop/FetchInfo.cs | 8 ------- 6 files changed, 18 insertions(+), 37 deletions(-) diff --git a/renderdoc/api/replay/replay_enums.h b/renderdoc/api/replay/replay_enums.h index 1c6787c1e..833e78eb9 100644 --- a/renderdoc/api/replay/replay_enums.h +++ b/renderdoc/api/replay/replay_enums.h @@ -39,7 +39,6 @@ enum FormatComponentType eCompType_None = 0, eCompType_Float, eCompType_UNorm, - eCompType_UNorm_SRGB, eCompType_SNorm, eCompType_UInt, eCompType_SInt, diff --git a/renderdoc/driver/d3d11/d3d11_analyse.cpp b/renderdoc/driver/d3d11/d3d11_analyse.cpp index 50945f28f..7b9ec27e1 100644 --- a/renderdoc/driver/d3d11/d3d11_analyse.cpp +++ b/renderdoc/driver/d3d11/d3d11_analyse.cpp @@ -4801,20 +4801,7 @@ vector D3D11DebugManager::PixelHistory(uint32_t frameID, vect mod.postMod.col.value_f[c] = ConvertFromHalf(uint16_t(mod.postMod.col.value_u[c])); } } - else if(fmt.compType == eCompType_UNorm) - { - // only 32bit unorm format is depth, handled separately - float maxVal = fmt.compByteWidth == 2 ? 65535.0f : 255.0f; - - RDCASSERT(fmt.compByteWidth < 4); - - for(uint32_t c=0; c < fmt.compCount; c++) - { - mod.preMod.col.value_f[c] = float(mod.preMod.col.value_u[c])/maxVal; - mod.postMod.col.value_f[c] = float(mod.postMod.col.value_u[c])/maxVal; - } - } - else if(fmt.compType == eCompType_UNorm_SRGB) + else if(fmt.compType == eCompType_UNorm && fmt.compByteWidth == 1 && fmt.srgbCorrected) { RDCASSERT(fmt.compByteWidth == 1); @@ -4831,6 +4818,19 @@ vector D3D11DebugManager::PixelHistory(uint32_t frameID, vect mod.postMod.col.value_f[3] = float(mod.postMod.col.value_u[3]&0xff)/255.0f; } } + else if(fmt.compType == eCompType_UNorm) + { + // only 32bit unorm format is depth, handled separately + float maxVal = fmt.compByteWidth == 2 ? 65535.0f : 255.0f; + + RDCASSERT(fmt.compByteWidth < 4); + + for(uint32_t c=0; c < fmt.compCount; c++) + { + mod.preMod.col.value_f[c] = float(mod.preMod.col.value_u[c])/maxVal; + mod.postMod.col.value_f[c] = float(mod.postMod.col.value_u[c])/maxVal; + } + } else if(fmt.compType == eCompType_SNorm && fmt.compByteWidth == 2) { for(uint32_t c=0; c < fmt.compCount; c++) diff --git a/renderdoc/driver/d3d11/d3d11_common.cpp b/renderdoc/driver/d3d11/d3d11_common.cpp index bfba2a32d..0f6986344 100644 --- a/renderdoc/driver/d3d11/d3d11_common.cpp +++ b/renderdoc/driver/d3d11/d3d11_common.cpp @@ -174,7 +174,7 @@ DXGI_FORMAT MakeDXGIFormat(ResourceFormat fmt) ret = GetFloatTypedFormat(ret); else if(fmt.compType == eCompType_Depth) ret = GetDepthTypedFormat(ret); - else if(fmt.compType == eCompType_UNorm || fmt.compType == eCompType_UNorm_SRGB) + else if(fmt.compType == eCompType_UNorm) ret = GetUnormTypedFormat(ret); else if(fmt.compType == eCompType_SNorm) ret = GetSnormTypedFormat(ret); @@ -441,8 +441,6 @@ ResourceFormat MakeResourceFormat(DXGI_FORMAT fmt) ret.compType = eCompType_Float; break; case DXGI_FORMAT_R8G8B8A8_UNORM_SRGB: - ret.compType = eCompType_UNorm_SRGB; - break; case DXGI_FORMAT_R8G8B8A8_UNORM: case DXGI_FORMAT_R16G16B16A16_UNORM: case DXGI_FORMAT_R16G16_UNORM: @@ -534,6 +532,8 @@ ResourceFormat MakeResourceFormat(DXGI_FORMAT fmt) case DXGI_FORMAT_B5G5R5A1_UNORM: case DXGI_FORMAT_B8G8R8A8_UNORM: case DXGI_FORMAT_B8G8R8X8_UNORM: + case DXGI_FORMAT_B8G8R8A8_UNORM_SRGB: + case DXGI_FORMAT_B8G8R8X8_UNORM_SRGB: case DXGI_FORMAT_R1_UNORM: case DXGI_FORMAT_BC1_UNORM: case DXGI_FORMAT_BC2_UNORM: @@ -542,17 +542,11 @@ ResourceFormat MakeResourceFormat(DXGI_FORMAT fmt) case DXGI_FORMAT_BC5_UNORM: case DXGI_FORMAT_BC6H_UF16: case DXGI_FORMAT_BC7_UNORM: - ret.compType = eCompType_UNorm; - break; - - case DXGI_FORMAT_B8G8R8A8_UNORM_SRGB: - case DXGI_FORMAT_B8G8R8X8_UNORM_SRGB: - case DXGI_FORMAT_BC1_UNORM_SRGB: case DXGI_FORMAT_BC2_UNORM_SRGB: case DXGI_FORMAT_BC3_UNORM_SRGB: case DXGI_FORMAT_BC7_UNORM_SRGB: - ret.compType = eCompType_UNorm_SRGB; + ret.compType = eCompType_UNorm; break; case DXGI_FORMAT_UNKNOWN: diff --git a/renderdoc/driver/gl/gl_common.cpp b/renderdoc/driver/gl/gl_common.cpp index 71abaa2a6..53adeed3b 100644 --- a/renderdoc/driver/gl/gl_common.cpp +++ b/renderdoc/driver/gl/gl_common.cpp @@ -236,9 +236,6 @@ ResourceFormat MakeResourceFormat(WrappedOpenGL &gl, GLenum target, GLenum fmt) gl.glGetInternalformativ(target, fmt, eGL_COLOR_ENCODING, sizeof(GLint), &data[0]); ret.srgbCorrected = (edata[0] == eGL_SRGB); - - if(ret.compType == eCompType_UNorm && ret.srgbCorrected) - ret.compType = eCompType_UNorm_SRGB; } else if(isdepth == GL_TRUE || isstencil == GL_TRUE) { diff --git a/renderdocui/Interop/Enums.cs b/renderdocui/Interop/Enums.cs index b6948c817..464cbc439 100644 --- a/renderdocui/Interop/Enums.cs +++ b/renderdocui/Interop/Enums.cs @@ -41,7 +41,6 @@ namespace renderdoc None = 0, Float, UNorm, - UNorm_SRGB, SNorm, UInt, SInt, diff --git a/renderdocui/Interop/FetchInfo.cs b/renderdocui/Interop/FetchInfo.cs index 9398c91d0..82e4aa497 100644 --- a/renderdocui/Interop/FetchInfo.cs +++ b/renderdocui/Interop/FetchInfo.cs @@ -164,10 +164,6 @@ namespace renderdoc { return (float)comp / (float)UInt16.MaxValue; } - else if (compType == FormatComponentType.UNorm_SRGB) - { - return (float)comp / (float)UInt16.MaxValue; - } else if (compType == FormatComponentType.SNorm) { Int16 cast = (Int16)comp; @@ -201,10 +197,6 @@ namespace renderdoc { return ((float)comp) / 255.0f; } - else if (compType == FormatComponentType.UNorm_SRGB) - { - return ((float)comp) / 255.0f; - } else if (compType == FormatComponentType.SNorm) { sbyte cast = (sbyte)comp;