diff --git a/renderdoc/driver/d3d11/d3d11_rendertexture.cpp b/renderdoc/driver/d3d11/d3d11_rendertexture.cpp index 54656840f..8d8ab7860 100644 --- a/renderdoc/driver/d3d11/d3d11_rendertexture.cpp +++ b/renderdoc/driver/d3d11/d3d11_rendertexture.cpp @@ -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; diff --git a/renderdoc/driver/d3d11/d3d11_replay.cpp b/renderdoc/driver/d3d11/d3d11_replay.cpp index 5069de365..e5be204a8 100644 --- a/renderdoc/driver/d3d11/d3d11_replay.cpp +++ b/renderdoc/driver/d3d11/d3d11_replay.cpp @@ -3471,6 +3471,8 @@ ResourceId D3D11Replay::CreateProxyTexture(const TextureDescription &templateTex m_ProxyResources.push_back(resource); + m_ProxyTypeCastDefault[ret] = templateTex.format.compType; + return ret; } diff --git a/renderdoc/driver/d3d11/d3d11_replay.h b/renderdoc/driver/d3d11/d3d11_replay.h index 223b44206..15e750d49 100644 --- a/renderdoc/driver/d3d11/d3d11_replay.h +++ b/renderdoc/driver/d3d11/d3d11_replay.h @@ -297,6 +297,7 @@ private: } std::vector m_ProxyResources; + std::map m_ProxyTypeCastDefault; struct OutputWindow {