mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-05 01:20:42 +00:00
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:
@@ -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;
|
||||
|
||||
@@ -3471,6 +3471,8 @@ ResourceId D3D11Replay::CreateProxyTexture(const TextureDescription &templateTex
|
||||
|
||||
m_ProxyResources.push_back(resource);
|
||||
|
||||
m_ProxyTypeCastDefault[ret] = templateTex.format.compType;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -297,6 +297,7 @@ private:
|
||||
}
|
||||
|
||||
std::vector<ID3D11Resource *> m_ProxyResources;
|
||||
std::map<ResourceId, CompType> m_ProxyTypeCastDefault;
|
||||
|
||||
struct OutputWindow
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user