Remove UNorm_SRGB component type as it's redundant

This commit is contained in:
baldurk
2014-09-14 20:29:25 +01:00
parent 6f9e8f3002
commit 72e2ed1513
6 changed files with 18 additions and 37 deletions
-1
View File
@@ -39,7 +39,6 @@ enum FormatComponentType
eCompType_None = 0,
eCompType_Float,
eCompType_UNorm,
eCompType_UNorm_SRGB,
eCompType_SNorm,
eCompType_UInt,
eCompType_SInt,
+14 -14
View File
@@ -4801,20 +4801,7 @@ vector<PixelModification> 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<PixelModification> 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++)
+4 -10
View File
@@ -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:
-3
View File
@@ -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)
{
-1
View File
@@ -41,7 +41,6 @@ namespace renderdoc
None = 0,
Float,
UNorm,
UNorm_SRGB,
SNorm,
UInt,
SInt,
-8
View File
@@ -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;