mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-13 13:30:44 +00:00
return DXGI_FORMAT_UNKNOWN for all unsupported/unmappable formats
* This means that when creating a proxy texture, all non-native formats will be remapped by the proxy to a safe linear format.
This commit is contained in:
@@ -1371,29 +1371,34 @@ DXGI_FORMAT MakeDXGIFormat(ResourceFormat fmt)
|
||||
break;
|
||||
case eSpecial_R11G11B10: ret = DXGI_FORMAT_R11G11B10_FLOAT; break;
|
||||
case eSpecial_R5G6B5:
|
||||
RDCASSERT(fmt.bgraOrder);
|
||||
// only support bgra order
|
||||
if(!fmt.bgraOrder)
|
||||
return DXGI_FORMAT_UNKNOWN;
|
||||
ret = DXGI_FORMAT_B5G6R5_UNORM;
|
||||
break;
|
||||
case eSpecial_R5G5B5A1:
|
||||
RDCASSERT(fmt.bgraOrder);
|
||||
// only support bgra order
|
||||
if(!fmt.bgraOrder)
|
||||
return DXGI_FORMAT_UNKNOWN;
|
||||
ret = DXGI_FORMAT_B5G5R5A1_UNORM;
|
||||
break;
|
||||
case eSpecial_R9G9B9E5: ret = DXGI_FORMAT_R9G9B9E5_SHAREDEXP; break;
|
||||
case eSpecial_R4G4B4A4:
|
||||
RDCASSERT(fmt.bgraOrder);
|
||||
// only support bgra order
|
||||
if(!fmt.bgraOrder)
|
||||
return DXGI_FORMAT_UNKNOWN;
|
||||
ret = DXGI_FORMAT_B4G4R4A4_UNORM;
|
||||
break;
|
||||
case eSpecial_D24S8: ret = DXGI_FORMAT_R24G8_TYPELESS; break;
|
||||
case eSpecial_D32S8: ret = DXGI_FORMAT_R32G8X24_TYPELESS; break;
|
||||
case eSpecial_YUV:
|
||||
RDCERR("Video format not unambiguously encoded");
|
||||
ret = DXGI_FORMAT_AYUV;
|
||||
break;
|
||||
// just claim all YUV formats as unsupported. In theory we could add more
|
||||
// special format enums to identify all the types, and return support for
|
||||
// the ones that exist in D3D
|
||||
return DXGI_FORMAT_UNKNOWN;
|
||||
case eSpecial_S8: // D3D has no stencil-only format
|
||||
case eSpecial_D16S8: // D3D has no D16S8 format
|
||||
default:
|
||||
// Return unknown to choose texture remap
|
||||
break;
|
||||
default: return DXGI_FORMAT_UNKNOWN;
|
||||
}
|
||||
}
|
||||
else if(fmt.compCount == 4)
|
||||
@@ -1405,7 +1410,7 @@ DXGI_FORMAT MakeDXGIFormat(ResourceFormat fmt)
|
||||
else if(fmt.compByteWidth == 1)
|
||||
ret = DXGI_FORMAT_R8G8B8A8_TYPELESS;
|
||||
else
|
||||
RDCERR("Unrecognised 4-component byte width: %d", fmt.compByteWidth);
|
||||
return DXGI_FORMAT_UNKNOWN;
|
||||
|
||||
if(fmt.bgraOrder)
|
||||
ret = DXGI_FORMAT_B8G8R8A8_UNORM;
|
||||
@@ -1414,16 +1419,8 @@ DXGI_FORMAT MakeDXGIFormat(ResourceFormat fmt)
|
||||
{
|
||||
if(fmt.compByteWidth == 4)
|
||||
ret = DXGI_FORMAT_R32G32B32_TYPELESS;
|
||||
else if(fmt.compByteWidth == 2)
|
||||
{
|
||||
// DXGI_FORMAT_R16G16B16_TYPELESS doesn't exist, return unknown to choose texture remap
|
||||
}
|
||||
else if(fmt.compByteWidth == 1)
|
||||
{
|
||||
// DXGI_FORMAT_R8G8B8_TYPELESS doesn't exist
|
||||
}
|
||||
else
|
||||
RDCERR("Unrecognised 3-component byte width: %d", fmt.compByteWidth);
|
||||
return DXGI_FORMAT_UNKNOWN;
|
||||
}
|
||||
else if(fmt.compCount == 2)
|
||||
{
|
||||
@@ -1434,7 +1431,7 @@ DXGI_FORMAT MakeDXGIFormat(ResourceFormat fmt)
|
||||
else if(fmt.compByteWidth == 1)
|
||||
ret = DXGI_FORMAT_R8G8_TYPELESS;
|
||||
else
|
||||
RDCERR("Unrecognised 2-component byte width: %d", fmt.compByteWidth);
|
||||
return DXGI_FORMAT_UNKNOWN;
|
||||
}
|
||||
else if(fmt.compCount == 1)
|
||||
{
|
||||
@@ -1445,11 +1442,11 @@ DXGI_FORMAT MakeDXGIFormat(ResourceFormat fmt)
|
||||
else if(fmt.compByteWidth == 1)
|
||||
ret = DXGI_FORMAT_R8_TYPELESS;
|
||||
else
|
||||
RDCERR("Unrecognised 1-component byte width: %d", fmt.compByteWidth);
|
||||
return DXGI_FORMAT_UNKNOWN;
|
||||
}
|
||||
else
|
||||
{
|
||||
RDCERR("Unrecognised component count: %d", fmt.compCount);
|
||||
return DXGI_FORMAT_UNKNOWN;
|
||||
}
|
||||
|
||||
if(fmt.compType == eCompType_None)
|
||||
@@ -1467,7 +1464,7 @@ DXGI_FORMAT MakeDXGIFormat(ResourceFormat fmt)
|
||||
else if(fmt.compType == eCompType_SInt)
|
||||
ret = GetSIntTypedFormat(ret);
|
||||
else
|
||||
RDCERR("Unrecognised component type");
|
||||
return DXGI_FORMAT_UNKNOWN;
|
||||
|
||||
if(fmt.srgbCorrected)
|
||||
ret = GetSRGBFormat(ret);
|
||||
|
||||
Reference in New Issue
Block a user