Use typecast provided at proxy texture creation time on D3D

* When we create proxy textures on D3D we create them as typeless, but this
  means we might lose the only time we are told about the type interpretation of
  the texture. If we then later get asked to view the texture as typeless, be
  sure to use that type info to interpret it, instead of defaulting to UNORM or
  FLOAT.
This commit is contained in:
baldurk
2019-11-25 15:50:28 +00:00
parent 186ca30045
commit ab74df54ca
3 changed files with 19 additions and 6 deletions
+16 -6
View File
@@ -506,8 +506,20 @@ bool D3D11Replay::RenderTextureInternal(TextureDisplay cfg, TexDisplayFlags flag
pixelData.FlipY = cfg.flipY ? 1 : 0;
TextureShaderDetails details = GetDebugManager()->GetShaderDetails(cfg.resourceId, cfg.typeCast,
cfg.rawOutput ? true : false);
CompType typeCast = cfg.typeCast;
// we create all proxy textures as typeless to allow us to cast, but that means if the remote API
// gave us a typed texture and then wants to view it 'typeless' (i.e. as it was created) we need
// to restore that type here.
if(typeCast == CompType::Typeless)
{
auto it = m_ProxyTypeCastDefault.find(cfg.resourceId);
if(it != m_ProxyTypeCastDefault.end())
typeCast = it->second;
}
TextureShaderDetails details =
GetDebugManager()->GetShaderDetails(cfg.resourceId, typeCast, cfg.rawOutput ? true : false);
int sampleIdx = (int)RDCCLAMP(cfg.subresource.sample, 0U, details.sampleCount - 1);
@@ -752,14 +764,12 @@ bool D3D11Replay::RenderTextureInternal(TextureDisplay cfg, TexDisplayFlags flag
int srvOffset = 0;
if(IsUIntFormat(details.texFmt) ||
(IsTypelessFormat(details.texFmt) && cfg.typeCast == CompType::UInt))
if(IsUIntFormat(details.texFmt) || (IsTypelessFormat(details.texFmt) && typeCast == CompType::UInt))
{
pixelData.OutputDisplayFormat |= TEXDISPLAY_UINT_TEX;
srvOffset = 10;
}
if(IsIntFormat(details.texFmt) ||
(IsTypelessFormat(details.texFmt) && cfg.typeCast == CompType::SInt))
if(IsIntFormat(details.texFmt) || (IsTypelessFormat(details.texFmt) && typeCast == CompType::SInt))
{
pixelData.OutputDisplayFormat |= TEXDISPLAY_SINT_TEX;
srvOffset = 20;
+2
View File
@@ -3471,6 +3471,8 @@ ResourceId D3D11Replay::CreateProxyTexture(const TextureDescription &templateTex
m_ProxyResources.push_back(resource);
m_ProxyTypeCastDefault[ret] = templateTex.format.compType;
return ret;
}
+1
View File
@@ -297,6 +297,7 @@ private:
}
std::vector<ID3D11Resource *> m_ProxyResources;
std::map<ResourceId, CompType> m_ProxyTypeCastDefault;
struct OutputWindow
{