Add MSAA support for pixel history. Refs #82

* We expand the depth-pixel-copy CS to copy colour pixels too, and be able
  to read from MSAA textures where appropriate.
* This introduces a small unnecessary overhead for non-MSAA colour textures
  but it's not really an issue.
* I've also changed it to use the existing textures rather than creating
  copies when the existing texture has BIND_SRV already.
This commit is contained in:
baldurk
2014-09-26 22:50:33 +01:00
parent eeaab87854
commit 4526e8beae
4 changed files with 477 additions and 128 deletions
+91 -10
View File
@@ -389,24 +389,105 @@ float4 RENDERDOC_QOResolvePS(float4 vpos : SV_POSITION) : SV_Target0
// https://github.com/selfshadow/demos/blob/master/QuadShading/QuadShading.fx
////////////////////////////////////////////////////////////////////////////////////////////
cbuffer cb0 : register(b0) { uint2 src_coord; uint2 padding0; };
cbuffer cb1 : register(b1) { uint2 dst_coord; uint copy_stencil; uint padding1; };
Texture2D<float2> depth_src : register(t0);
Texture2D<uint2> stencil_src : register(t1);
RWTexture2D<float2> depth_out : register(u0);
cbuffer cb0 : register(b0)
{
uint3 src_coord;
bool multisampled;
bool is_float;
bool is_uint;
bool is_int;
uint padding;
};
cbuffer cb1 : register(b1)
{
uint2 dst_coord;
bool copy_depth;
bool copy_stencil;
};
Texture2DArray<float2> copyin_depth : register(t0);
Texture2DArray<uint2> copyin_stencil : register(t1);
Texture2DMSArray<float2> copyin_depth_ms : register(t2);
Texture2DMSArray<uint2> copyin_stencil_ms : register(t3);
Texture2DArray<float4> copyin_float : register(t4);
Texture2DMSArray<float4> copyin_float_ms : register(t5);
Texture2DArray<uint4> copyin_uint : register(t6);
Texture2DMSArray<uint4> copyin_uint_ms : register(t7);
Texture2DArray<int4> copyin_int : register(t8);
Texture2DMSArray<int4> copyin_int_ms : register(t9);
RWTexture2D<float2> copyout_depth : register(u0);
RWTexture2D<float4> copyout_float : register(u1);
RWTexture2D<uint4> copyout_uint : register(u2);
RWTexture2D<int4> copyout_int : register(u3);
[numthreads(1, 1, 1)]
void RENDERDOC_PixelHistoryUnused()
{
depth_out[dst_coord.xy].rg = float2(-1.0f, -1.0f);
copyout_depth[dst_coord.xy].rg = float2(-1.0f, -1.0f);
}
[numthreads(1, 1, 1)]
void RENDERDOC_PixelHistoryCopyDepthStencil()
void RENDERDOC_PixelHistoryCopyPixel()
{
depth_out[dst_coord.xy].rg = float2(
depth_src[src_coord.xy].r,
copy_stencil > 0 ? (float)stencil_src[src_coord.xy].g : -1.0f);
if(multisampled)
{
if(copy_depth || copy_stencil)
{
float2 val = float2(copyin_depth_ms.sample[src_coord.z][uint3(src_coord.xy, 0)].r, -1.0f);
if(copy_stencil) val.g = (float)copyin_stencil_ms.sample[src_coord.z][uint3(src_coord.xy, 0)].g;
copyout_depth[dst_coord.xy].rg = val;
}
else
{
if(is_float)
{
copyout_float[dst_coord.xy] = copyin_float_ms.sample[src_coord.z][uint3(src_coord.xy, 0)];
}
else if(is_uint)
{
copyout_uint[dst_coord.xy] = copyin_uint_ms.sample[src_coord.z][uint3(src_coord.xy, 0)];
}
else if(is_int)
{
copyout_int[dst_coord.xy] = copyin_int_ms.sample[src_coord.z][uint3(src_coord.xy, 0)];
}
}
}
else
{
if(copy_depth || copy_stencil)
{
float2 val = float2(copyin_depth[uint3(src_coord.xy, 0)].r, -1.0f);
if(copy_stencil) val.g = (float)copyin_stencil[uint3(src_coord.xy, 0)].g;
copyout_depth[dst_coord.xy].rg = val;
}
else
{
if(is_float)
{
copyout_float[dst_coord.xy] = copyin_float[uint3(src_coord.xy, 0)];
}
else if(is_uint)
{
copyout_uint[dst_coord.xy] = copyin_uint[uint3(src_coord.xy, 0)];
}
else if(is_int)
{
copyout_int[dst_coord.xy] = copyin_int[uint3(src_coord.xy, 0)];
}
}
}
}
float4 RENDERDOC_PrimitiveIDPS(uint prim : SV_PrimitiveID) : SV_Target0
+380 -112
View File
@@ -3185,64 +3185,142 @@ ResourceId D3D11DebugManager::RenderOverlay(ResourceId texid, TextureDisplayOver
return m_OverlayResourceId;
}
void D3D11DebugManager::PixelHistoryDepthCopySubresource(bool depthbound, ID3D11Texture2D *uavres, ID3D11UnorderedAccessView *uav, ID3D11Resource *depthres,
ID3D11ShaderResourceView **copyDepthSRV, ID3D11ShaderResourceView **copyStencilSRV,
ID3D11Buffer *srcxyCBuf, ID3D11Buffer *storexyCBuf, uint32_t x, uint32_t y)
struct CopyPixelParams
{
if(depthbound && uavres && depthres)
m_pImmediateContext->CopySubresourceRegion(uavres, 0, 0, 0, 0, depthres, 0, NULL);
bool multisampled;
bool floatTex;
bool uintTex;
bool intTex;
bool depthcopy; // are we copying depth or colour
bool depthbound; // if copying depth, was any depth bound (or should we write <-1,-1> marker)
ID3D11Texture2D *sourceTex; // texture with the actual data in it
ID3D11Texture2D *srvTex; // could be same as sourceTex if sourceTex had BIND_SRV flag on,
// otherwise a texture of same format with BIND_SRV to copy to
ID3D11ShaderResourceView *srv[2]; // srv[0] = colour or depth, srv[1] = stencil or NULL
ID3D11UnorderedAccessView *uav; // uav to copy pixel to
ID3D11Buffer *srcxyCBuf;
ID3D11Buffer *storexyCBuf;
};
void D3D11DebugManager::PixelHistoryCopyPixel(CopyPixelParams &p, uint32_t x, uint32_t y)
{
// perform a subresource copy if the real source tex couldn't be directly bound as SRV
if(p.sourceTex != p.srvTex && p.sourceTex && p.srvTex)
m_pImmediateContext->CopySubresourceRegion(p.srvTex, 0, 0, 0, 0, p.sourceTex, 0, NULL);
ID3D11RenderTargetView* tmpViews[D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT] = {0};
m_pImmediateContext->OMGetRenderTargets(D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT, tmpViews, NULL);
uint32_t UAVStartSlot = 0;
for(int i=0; i < D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT; i++)
{
if(tmpViews[i] != NULL)
{
UAVStartSlot = i+1;
SAFE_RELEASE(tmpViews[i]);
}
}
ID3D11RenderTargetView* prevRTVs[D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT] = {0};
ID3D11UnorderedAccessView* prevUAVs[D3D11_PS_CS_UAV_REGISTER_COUNT] = {0};
ID3D11DepthStencilView *prevDSV = NULL;
m_pImmediateContext->OMGetRenderTargetsAndUnorderedAccessViews(UAVStartSlot, prevRTVs, &prevDSV,
UAVStartSlot, D3D11_PS_CS_UAV_REGISTER_COUNT-UAVStartSlot, prevUAVs);
m_pImmediateContext->OMSetRenderTargetsAndUnorderedAccessViews(0, NULL, NULL, 0, 0, NULL, NULL);
ID3D11ComputeShader *curCS = NULL;
ID3D11ClassInstance *curCSInst[D3D11_SHADER_MAX_INTERFACES] = { NULL };
UINT curCSNumInst = D3D11_SHADER_MAX_INTERFACES;
ID3D11Buffer *curCSCBuf[2] = {0};
ID3D11ShaderResourceView *curCSSRVs[2] = {0};
ID3D11UnorderedAccessView *curCSUAV = NULL;
UINT initCounts = ~0U;
ID3D11ShaderResourceView *curCSSRVs[10] = {0};
ID3D11UnorderedAccessView *curCSUAV[4] = {0};
UINT initCounts[D3D11_PS_CS_UAV_REGISTER_COUNT] = { ~0U, ~0U, ~0U, ~0U, ~0U, ~0U, ~0U, ~0U, };
m_pImmediateContext->CSGetShader(&curCS, curCSInst, &curCSNumInst);
m_pImmediateContext->CSGetConstantBuffers(0, 2, curCSCBuf);
m_pImmediateContext->CSGetShaderResources(0, 2, curCSSRVs);
m_pImmediateContext->CSGetUnorderedAccessViews(0, 1, &curCSUAV);
uint32_t storexyData[4] = { x, y, (copyStencilSRV != NULL), 0 };
m_pImmediateContext->CSGetConstantBuffers(0, ARRAY_COUNT(curCSCBuf), curCSCBuf);
m_pImmediateContext->CSGetShaderResources(0, ARRAY_COUNT(curCSSRVs), curCSSRVs);
m_pImmediateContext->CSGetUnorderedAccessViews(0, ARRAY_COUNT(curCSUAV), curCSUAV);
uint32_t storexyData[4] = { x, y, p.depthcopy, p.srv[1] != NULL };
D3D11_MAPPED_SUBRESOURCE mapped;
m_pImmediateContext->Map(storexyCBuf, 0, D3D11_MAP_WRITE_DISCARD, 0, &mapped);
m_pImmediateContext->Map(p.storexyCBuf, 0, D3D11_MAP_WRITE_DISCARD, 0, &mapped);
memcpy(mapped.pData, storexyData, sizeof(storexyData));
m_pImmediateContext->Unmap(storexyCBuf, 0);
m_pImmediateContext->Unmap(p.storexyCBuf, 0);
m_pImmediateContext->CSSetConstantBuffers(0, 1, &p.srcxyCBuf);
m_pImmediateContext->CSSetConstantBuffers(1, 1, &p.storexyCBuf);
UINT offs = 0;
if(p.depthcopy)
{
offs = 0;
}
else
{
if(p.floatTex) offs = 1;
else if(p.uintTex) offs = 2;
else if(p.intTex) offs = 3;
}
m_pImmediateContext->CSSetConstantBuffers(0, 1, &srcxyCBuf);
m_pImmediateContext->CSSetConstantBuffers(1, 1, &storexyCBuf);
m_pImmediateContext->CSSetUnorderedAccessViews(0, 1, &uav, &initCounts);
if(copyDepthSRV) m_pImmediateContext->CSSetShaderResources(0, 1, copyDepthSRV);
if(copyStencilSRV) m_pImmediateContext->CSSetShaderResources(1, 1, copyStencilSRV);
m_pImmediateContext->CSSetUnorderedAccessViews(offs, 1, &p.uav, initCounts);
m_pImmediateContext->CSSetShader(depthbound ? m_DebugRender.PixelHistoryDepthCopyCS : m_DebugRender.PixelHistoryUnusedCS, NULL, 0);
if(p.depthcopy)
{
offs = p.multisampled ? 2 : 0;
}
else
{
if(p.floatTex) offs = 4;
else if(p.uintTex) offs = 6;
else if(p.intTex) offs = 8;
if(p.multisampled) offs++;
}
m_pImmediateContext->CSSetShaderResources(offs, 2, p.srv);
m_pImmediateContext->CSSetShader(!p.depthcopy || p.depthbound ? m_DebugRender.PixelHistoryCopyCS : m_DebugRender.PixelHistoryUnusedCS, NULL, 0);
m_pImmediateContext->Dispatch(1, 1, 1);
m_pImmediateContext->CSSetShader(curCS, curCSInst, curCSNumInst);
m_pImmediateContext->CSSetConstantBuffers(0, 2, curCSCBuf);
m_pImmediateContext->CSSetShaderResources(0, 2, curCSSRVs);
m_pImmediateContext->CSSetUnorderedAccessViews(0, 1, &curCSUAV, &initCounts);
m_pImmediateContext->CSSetConstantBuffers(0, ARRAY_COUNT(curCSCBuf), curCSCBuf);
m_pImmediateContext->CSSetShaderResources(0, ARRAY_COUNT(curCSSRVs), curCSSRVs);
m_pImmediateContext->CSSetUnorderedAccessViews(0, ARRAY_COUNT(curCSUAV), curCSUAV, initCounts);
m_pImmediateContext->OMSetRenderTargetsAndUnorderedAccessViews(UAVStartSlot, prevRTVs, prevDSV, UAVStartSlot,
D3D11_PS_CS_UAV_REGISTER_COUNT-UAVStartSlot, prevUAVs, initCounts);
for(int i=0; i < D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT; i++)
{
SAFE_RELEASE(prevRTVs[i]);
SAFE_RELEASE(prevUAVs[i]);
}
SAFE_RELEASE(prevDSV);
SAFE_RELEASE(curCS);
for(UINT i=0; i < curCSNumInst; i++)
SAFE_RELEASE(curCSInst[i]);
SAFE_RELEASE(curCSCBuf[0]);
SAFE_RELEASE(curCSCBuf[1]);
SAFE_RELEASE(curCSSRVs[0]);
SAFE_RELEASE(curCSSRVs[1]);
SAFE_RELEASE(curCSUAV);
for(UINT i=0; i < curCSNumInst; i++) SAFE_RELEASE(curCSInst[i]);
for(size_t i=0; i < ARRAY_COUNT(curCSCBuf); i++) SAFE_RELEASE(curCSCBuf[i]);
for(size_t i=0; i < ARRAY_COUNT(curCSSRVs); i++) SAFE_RELEASE(curCSSRVs[i]);
for(size_t i=0; i < ARRAY_COUNT(curCSUAV); i++) SAFE_RELEASE(curCSUAV[i]);
}
vector<PixelModification> D3D11DebugManager::PixelHistory(uint32_t frameID, vector<EventUsage> events, ResourceId target, uint32_t x, uint32_t y, uint32_t sampleIdx)
{
vector<PixelModification> history;
// this function needs a *huge* amount of tidying, refactoring and documenting.
if(events.empty())
return history;
@@ -3250,13 +3328,26 @@ vector<PixelModification> D3D11DebugManager::PixelHistory(uint32_t frameID, vect
if(details.texFmt == DXGI_FORMAT_UNKNOWN)
return history;
details.texFmt = GetNonSRGBFormat(details.texFmt);
SCOPED_TIMER("D3D11DebugManager::PixelHistory");
if(sampleIdx > details.sampleCount)
sampleIdx = 0;
uint32_t sampleMask = ~0U;
if(sampleIdx < 32)
sampleMask = 1U << sampleIdx;
bool multisampled = (details.sampleCount > 1);
// sampleIdx used later for deciding subresource to read from, so
// set it to 0 for the no-sample case (resolved, or never MSAA in the
// first place).
if(sampleIdx == ~0U || !multisampled)
sampleIdx = 0;
// needed for comparison with viewports
float xf = (float)x;
float yf = (float)y;
@@ -3283,9 +3374,9 @@ vector<PixelModification> D3D11DebugManager::PixelHistory(uint32_t frameID, vect
1U,
details.texFmt,
{ 1, 0 },
D3D11_USAGE_STAGING,
D3D11_USAGE_DEFAULT,
D3D11_BIND_UNORDERED_ACCESS,
0,
D3D11_CPU_ACCESS_READ,
0,
};
@@ -3302,15 +3393,33 @@ vector<PixelModification> D3D11DebugManager::PixelHistory(uint32_t frameID, vect
// the shader does the upcasting for us when we read from depth or stencil
pixstoreDesc.Format = DXGI_FORMAT_R32G32_FLOAT;
ID3D11Texture2D *pixstoreDepth = NULL;
m_pDevice->CreateTexture2D(&pixstoreDesc, NULL, &pixstoreDepth);
pixstoreDesc.Usage = D3D11_USAGE_STAGING;
pixstoreDesc.CPUAccessFlags = D3D11_CPU_ACCESS_READ;
pixstoreDesc.BindFlags = 0;
pixstoreDesc.Format = details.texFmt;
ID3D11Texture2D *pixstoreReadback = NULL;
m_pDevice->CreateTexture2D(&pixstoreDesc, NULL, &pixstoreReadback);
pixstoreDesc.Format = DXGI_FORMAT_R32G32B32A32_FLOAT;
ID3D11Texture2D *shadoutStoreReadback = NULL;
m_pDevice->CreateTexture2D(&pixstoreDesc, NULL, &shadoutStoreReadback);
pixstoreDesc.Format = DXGI_FORMAT_R32G32_FLOAT;
ID3D11Texture2D *pixstoreDepthReadback = NULL;
m_pDevice->CreateTexture2D(&pixstoreDesc, NULL, &pixstoreDepthReadback);
pixstoreDesc.Usage = D3D11_USAGE_DEFAULT;
pixstoreDesc.CPUAccessFlags = 0;
pixstoreDesc.BindFlags = D3D11_BIND_UNORDERED_ACCESS;
ID3D11UnorderedAccessView *pixstoreUAV = NULL;
m_pDevice->CreateUnorderedAccessView(pixstore, NULL, &pixstoreUAV);
ID3D11Texture2D *pixstoreDepth = NULL;
m_pDevice->CreateTexture2D(&pixstoreDesc, NULL, &pixstoreDepth);
ID3D11UnorderedAccessView *shadoutStoreUAV = NULL;
m_pDevice->CreateUnorderedAccessView(shadoutStore, NULL, &shadoutStoreUAV);
ID3D11UnorderedAccessView *pixstoreDepthUAV = NULL;
m_pDevice->CreateUnorderedAccessView(pixstoreDepth, NULL, &pixstoreDepthUAV);
@@ -3323,15 +3432,18 @@ vector<PixelModification> D3D11DebugManager::PixelHistory(uint32_t frameID, vect
1U,
1U,
DXGI_FORMAT_R32G32B32A32_FLOAT,
{ 1, 0 },
{ details.sampleCount, details.sampleQuality },
D3D11_USAGE_DEFAULT,
D3D11_BIND_RENDER_TARGET,
D3D11_BIND_RENDER_TARGET|D3D11_BIND_SHADER_RESOURCE,
0,
0,
};
ID3D11Texture2D *shadOutput = NULL;
m_pDevice->CreateTexture2D(&shadoutDesc, NULL, &shadOutput);
ID3D11ShaderResourceView *shadOutputSRV = NULL;
m_pDevice->CreateShaderResourceView(shadOutput, NULL, &shadOutputSRV);
ID3D11RenderTargetView *shadOutputRTV = NULL;
m_pDevice->CreateRenderTargetView(shadOutput, NULL, &shadOutputRTV);
@@ -3340,14 +3452,38 @@ vector<PixelModification> D3D11DebugManager::PixelHistory(uint32_t frameID, vect
ID3D11Texture2D *shaddepthOutput = NULL;
m_pDevice->CreateTexture2D(&shadoutDesc, NULL, &shaddepthOutput);
ID3D11DepthStencilView *shadOutputDSV = NULL;
ID3D11DepthStencilView *shaddepthOutputDSV = NULL;
{
D3D11_DEPTH_STENCIL_VIEW_DESC desc;
desc.Flags = 0;
desc.Format = DXGI_FORMAT_D32_FLOAT_S8X24_UINT;
desc.ViewDimension = D3D11_DSV_DIMENSION_TEXTURE2D;
desc.Texture2D.MipSlice = 0;
m_pDevice->CreateDepthStencilView(shaddepthOutput, &desc, &shadOutputDSV);
if(multisampled)
desc.ViewDimension = D3D11_DSV_DIMENSION_TEXTURE2DMS;
m_pDevice->CreateDepthStencilView(shaddepthOutput, &desc, &shaddepthOutputDSV);
}
D3D11_SHADER_RESOURCE_VIEW_DESC copyDepthSRVDesc, copyStencilSRVDesc;
copyDepthSRVDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D;
copyDepthSRVDesc.Texture2D.MipLevels = 1;
copyDepthSRVDesc.Texture2D.MostDetailedMip = 0;
copyStencilSRVDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D;
copyStencilSRVDesc.Texture2D.MipLevels = 1;
copyStencilSRVDesc.Texture2D.MostDetailedMip = 0;
if(multisampled)
copyDepthSRVDesc.ViewDimension = copyStencilSRVDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2DMS;
ID3D11ShaderResourceView *shaddepthOutputDepthSRV = NULL, *shaddepthOutputStencilSRV = NULL;
{
copyDepthSRVDesc.Format = DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS;
m_pDevice->CreateShaderResourceView(shaddepthOutput, &copyDepthSRVDesc, &shaddepthOutputDepthSRV);
copyDepthSRVDesc.Format = DXGI_FORMAT_X32_TYPELESS_G8X24_UINT;
m_pDevice->CreateShaderResourceView(shaddepthOutput, &copyDepthSRVDesc, &shaddepthOutputStencilSRV);
}
// depth texture to copy to, as CopySubresourceRegion can't copy single pixels out of a depth buffer,
@@ -3365,7 +3501,7 @@ vector<PixelModification> D3D11DebugManager::PixelHistory(uint32_t frameID, vect
1U,
1U,
DXGI_FORMAT_R24G8_TYPELESS,
{ 1, 0 },
{ details.sampleCount, details.sampleQuality },
D3D11_USAGE_DEFAULT,
D3D11_BIND_SHADER_RESOURCE,
0,
@@ -3389,35 +3525,55 @@ vector<PixelModification> D3D11DebugManager::PixelHistory(uint32_t frameID, vect
ID3D11Texture2D *depthCopyD16 = NULL;
ID3D11ShaderResourceView *depthCopyD16_DepthSRV = NULL;
D3D11_SHADER_RESOURCE_VIEW_DESC copyDepthSRVDesc, copyStencilSRVDesc;
copyDepthSRVDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D;
copyDepthSRVDesc.Texture2D.MipLevels = 1;
copyDepthSRVDesc.Texture2D.MostDetailedMip = 0;
copyStencilSRVDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D;
copyStencilSRVDesc.Texture2D.MipLevels = 1;
copyStencilSRVDesc.Texture2D.MostDetailedMip = 0;
ID3D11ShaderResourceView *shaddepthOutputDepthSRV = NULL, *shaddepthOutputStencilSRV = NULL;
copyDepthSRVDesc.Format = DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS;
m_pDevice->CreateShaderResourceView(shaddepthOutput, &copyDepthSRVDesc, &shaddepthOutputDepthSRV);
copyDepthSRVDesc.Format = DXGI_FORMAT_X32_TYPELESS_G8X24_UINT;
m_pDevice->CreateShaderResourceView(shaddepthOutput, &copyDepthSRVDesc, &shaddepthOutputStencilSRV);
bool floatTex = false, uintTex = false, intTex = false;
uint32_t srcxyData[4] = { x, y, 0, 0 };
if(IsUIntFormat(details.texFmt) || IsTypelessFormat(details.texFmt))
{
uintTex = true;
}
else if(IsIntFormat(details.texFmt))
{
intTex = true;
}
else
{
floatTex = true;
}
D3D11_SUBRESOURCE_DATA data = { srcxyData, sizeof(uint32_t)*4, sizeof(uint32_t)*4 };
uint32_t srcxyData[8] = {
x, y, sampleIdx,
multisampled,
ID3D11Buffer *srcxyCBuf = MakeCBuffer((float *)srcxyData, sizeof(srcxyData));
ID3D11Buffer *storexyCBuf = MakeCBuffer((float *)srcxyData, sizeof(srcxyData));
floatTex,
uintTex,
intTex,
0,
};
D3D11_SUBRESOURCE_DATA data = { srcxyData, sizeof(srcxyData), sizeof(srcxyData) };
ID3D11Buffer *srcxyCBuf = MakeCBuffer(data.SysMemPitch);
ID3D11Buffer *storexyCBuf = MakeCBuffer(data.SysMemPitch);
FillCBuffer(srcxyCBuf, (float *)srcxyData, sizeof(srcxyData));
// so we do:
// per sample: orig depth --copy--> depthCopyXXX (created/upsized on demand) --CS pixel copy--> pixstoreDepth
// at end: pixstoreDepth --copy--> pixstoreDepthReadback
//
// First copy is needed since orig depth might not be SRV-able
// CS pixel copy is needed since it's the only way to copy only one pixel from depth texture
// First copy is only needed if orig depth is not SRV-able
// CS pixel copy is needed since it's the only way to copy only one pixel from depth texture, CopySubresourceRegion
// can't copy a sub-box of a depth copy. It also is required in the MSAA case to read a specific pixel/sample out.
//
// final copy is needed to get data into a readback texture since we can't have CS writing to staging texture
//
//
// for colour it's simple, it's just
// per sample: orig color --copy--> pixstore
// at end: pixstore --copy--> pixstoreReadback
//
// this is slightly redundant but it only adds one extra copy at the end and an extra target, and allows to handle
// MSAA source textures (which can't copy direct to a staging texture)
ID3D11Resource *targetres = NULL;
@@ -3428,6 +3584,28 @@ vector<PixelModification> D3D11DebugManager::PixelHistory(uint32_t frameID, vect
else if(WrappedID3D11Texture3D::m_TextureList.find(target) != WrappedID3D11Texture3D::m_TextureList.end())
targetres = ((WrappedID3D11Texture3D *)WrappedID3D11Texture3D::m_TextureList[target].m_Texture)->GetReal();
CopyPixelParams colourCopyParams = {};
// common parameters
colourCopyParams.multisampled = multisampled;
colourCopyParams.floatTex = floatTex;
colourCopyParams.uintTex = uintTex;
colourCopyParams.intTex = intTex;
colourCopyParams.srcxyCBuf = srcxyCBuf;
colourCopyParams.storexyCBuf = storexyCBuf;
CopyPixelParams depthCopyParams = colourCopyParams;
colourCopyParams.depthcopy = false;
colourCopyParams.sourceTex = (ID3D11Texture2D *)targetres;
colourCopyParams.srvTex = (ID3D11Texture2D *)details.srvResource;
colourCopyParams.srv[0] = details.srv[details.texType];
colourCopyParams.srv[1] = NULL;
colourCopyParams.uav = pixstoreUAV;
depthCopyParams.depthcopy = true;
depthCopyParams.uav = pixstoreDepthUAV;
// while issuing the above queries we can check to see which tests are enabled so we don't
// bother checking if depth testing failed if the depth test was disabled
vector<uint32_t> flags(events.size());
@@ -3523,8 +3701,18 @@ vector<PixelModification> D3D11DebugManager::PixelHistory(uint32_t frameID, vect
/*AntialiasedLineEnable =*/ FALSE,
};
D3D11_RASTERIZER_DESC rsDesc;
RDCEraseEl(rsDesc);
D3D11_RASTERIZER_DESC rsDesc = {
/*FillMode =*/ D3D11_FILL_SOLID,
/*CullMode =*/ D3D11_CULL_BACK,
/*FrontCounterClockwise =*/ FALSE,
/*DepthBias =*/ D3D11_DEFAULT_DEPTH_BIAS,
/*DepthBiasClamp =*/ D3D11_DEFAULT_DEPTH_BIAS_CLAMP,
/*SlopeScaledDepthBias =*/ D3D11_DEFAULT_SLOPE_SCALED_DEPTH_BIAS,
/*DepthClipEnable =*/ TRUE,
/*ScissorEnable =*/ FALSE,
/*MultisampleEnable =*/ FALSE,
/*AntialiasedLineEnable =*/ FALSE,
};
if(curRS)
{
@@ -3686,6 +3874,11 @@ vector<PixelModification> D3D11DebugManager::PixelHistory(uint32_t frameID, vect
ID3D11ShaderResourceView **copyStencilSRV = NULL;
ID3D11Resource *depthRes = NULL;
// if the depth resource was already BIND_SRV we just create these SRVs pointing to it,
// then release them after, instead of using srvs to texture copies
ID3D11ShaderResourceView *releaseDepthSRV = NULL;
ID3D11ShaderResourceView *releaseStencilSRV = NULL;
{
ID3D11DepthStencilView *dsv = NULL;
m_pImmediateContext->OMGetRenderTargets(0, NULL, &dsv);
@@ -3696,6 +3889,9 @@ vector<PixelModification> D3D11DebugManager::PixelHistory(uint32_t frameID, vect
dsv->GetResource(&depthRes);
D3D11_DEPTH_STENCIL_VIEW_DESC dsvDesc;
dsv->GetDesc(&dsvDesc);
SAFE_RELEASE(dsv);
D3D11_RESOURCE_DIMENSION dim;
@@ -3713,6 +3909,7 @@ vector<PixelModification> D3D11DebugManager::PixelHistory(uint32_t frameID, vect
desc2d.Format = desc1d.Format;
desc2d.Width = desc1d.Width;
desc2d.Height = 1;
desc2d.BindFlags = desc1d.BindFlags;
}
else if(dim == D3D11_RESOURCE_DIMENSION_TEXTURE2D)
{
@@ -3724,6 +3921,15 @@ vector<PixelModification> D3D11DebugManager::PixelHistory(uint32_t frameID, vect
RDCERR("Unexpected size of depth buffer");
}
bool srvable = (dim == D3D11_RESOURCE_DIMENSION_TEXTURE2D) && (desc2d.BindFlags & D3D11_BIND_SHADER_RESOURCE) > 0;
D3D11_SHADER_RESOURCE_VIEW_DESC srvDesc = {};
srvDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D;
if(dsvDesc.ViewDimension == D3D11_DSV_DIMENSION_TEXTURE2DMS)
srvDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2DMS;
srvDesc.Texture2D.MipLevels = 1;
srvDesc.Texture2D.MostDetailedMip = dsvDesc.Texture2D.MipSlice;
D3D11_TEXTURE2D_DESC *copyDesc = NULL;
if(desc2d.Format == DXGI_FORMAT_R16_FLOAT ||
desc2d.Format == DXGI_FORMAT_R16_SINT ||
@@ -3739,6 +3945,14 @@ vector<PixelModification> D3D11DebugManager::PixelHistory(uint32_t frameID, vect
copyStencilSRV = NULL;
copyDepthSRVDesc.Format = DXGI_FORMAT_R16_UNORM;
if(srvable)
{
srvDesc.Format = DXGI_FORMAT_R16_UNORM;
copyTex = (ID3D11Texture2D **)&depthRes;
m_pDevice->CreateShaderResourceView(depthRes, &srvDesc, &releaseDepthSRV); copyDepthSRV = &releaseDepthSRV;
}
}
else if(desc2d.Format == DXGI_FORMAT_R24_UNORM_X8_TYPELESS ||
desc2d.Format == DXGI_FORMAT_R24G8_TYPELESS ||
@@ -3751,6 +3965,16 @@ vector<PixelModification> D3D11DebugManager::PixelHistory(uint32_t frameID, vect
copyDepthSRVDesc.Format = DXGI_FORMAT_R24_UNORM_X8_TYPELESS;
copyStencilSRVDesc.Format = DXGI_FORMAT_X24_TYPELESS_G8_UINT;
if(srvable)
{
srvDesc.Format = DXGI_FORMAT_R24_UNORM_X8_TYPELESS;
copyTex = (ID3D11Texture2D **)&depthRes;
m_pDevice->CreateShaderResourceView(depthRes, &srvDesc, &releaseDepthSRV); copyDepthSRV = &releaseDepthSRV;
srvDesc.Format = DXGI_FORMAT_X24_TYPELESS_G8_UINT;
m_pDevice->CreateShaderResourceView(depthRes, &srvDesc, &releaseStencilSRV); copyStencilSRV = &releaseStencilSRV;
}
}
else if(desc2d.Format == DXGI_FORMAT_R32_FLOAT ||
desc2d.Format == DXGI_FORMAT_R32_SINT ||
@@ -3764,6 +3988,14 @@ vector<PixelModification> D3D11DebugManager::PixelHistory(uint32_t frameID, vect
copyStencilSRV = NULL;
copyDepthSRVDesc.Format = DXGI_FORMAT_R32_FLOAT;
if(srvable)
{
srvDesc.Format = DXGI_FORMAT_R32_FLOAT;
copyTex = (ID3D11Texture2D **)&depthRes;
m_pDevice->CreateShaderResourceView(depthRes, &srvDesc, &releaseDepthSRV); copyDepthSRV = &releaseDepthSRV;
}
}
else if(desc2d.Format == DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS ||
desc2d.Format == DXGI_FORMAT_R32G8X24_TYPELESS ||
@@ -3776,9 +4008,19 @@ vector<PixelModification> D3D11DebugManager::PixelHistory(uint32_t frameID, vect
copyDepthSRVDesc.Format = DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS;
copyStencilSRVDesc.Format = DXGI_FORMAT_X32_TYPELESS_G8X24_UINT;
if(srvable)
{
srvDesc.Format = DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS;
copyTex = (ID3D11Texture2D **)&depthRes;
m_pDevice->CreateShaderResourceView(depthRes, &srvDesc, &releaseDepthSRV); copyDepthSRV = &releaseDepthSRV;
srvDesc.Format = DXGI_FORMAT_X32_TYPELESS_G8X24_UINT;
m_pDevice->CreateShaderResourceView(depthRes, &srvDesc, &releaseStencilSRV); copyStencilSRV = &releaseStencilSRV;
}
}
if(*copyTex == NULL || desc2d.Width > copyDesc->Width || desc2d.Height > copyDesc->Height)
if(!srvable && (*copyTex == NULL || desc2d.Width > copyDesc->Width || desc2d.Height > copyDesc->Height))
{
// recreate texture
SAFE_RELEASE(*copyTex);
@@ -3791,12 +4033,16 @@ vector<PixelModification> D3D11DebugManager::PixelHistory(uint32_t frameID, vect
}
}
}
PixelHistoryCopyPixel(colourCopyParams, storex*pixstoreStride + 0, storey);
depthCopyParams.depthbound = depthBound;
depthCopyParams.sourceTex = (ID3D11Texture2D *)depthRes;
depthCopyParams.srvTex = copyTex ? *copyTex : NULL;
depthCopyParams.srv[0] = copyDepthSRV ? *copyDepthSRV : NULL;
depthCopyParams.srv[1] = copyStencilSRV ? *copyStencilSRV : NULL;
m_pImmediateContext->CopySubresourceRegion(pixstore, 0, storex*pixstoreStride + 0, storey, 0, targetres, 0, &srcbox);
PixelHistoryDepthCopySubresource(depthBound, copyTex ? *copyTex : NULL, pixstoreDepthUAV, depthRes,
copyDepthSRV, copyStencilSRV, srcxyCBuf, storexyCBuf,
storex*pixstoreStride + 0, storey);
PixelHistoryCopyPixel(depthCopyParams, storex*pixstoreStride + 0, storey);
m_pImmediateContext->Begin(occl[ev]);
@@ -3844,9 +4090,15 @@ vector<PixelModification> D3D11DebugManager::PixelHistory(uint32_t frameID, vect
m_pImmediateContext->OMGetRenderTargetsAndUnorderedAccessViews(UAVStartSlot, prevRTVs, &prevDSV,
UAVStartSlot, D3D11_PS_CS_UAV_REGISTER_COUNT-UAVStartSlot, prevUAVs);
m_pImmediateContext->ClearDepthStencilView(shadOutputDSV, D3D11_CLEAR_STENCIL, 1.0f, 0);
CopyPixelParams params = depthCopyParams;
params.depthbound = true;
params.srvTex = params.sourceTex = shaddepthOutput;
params.srv[0] = shaddepthOutputDepthSRV;
params.srv[1] = shaddepthOutputStencilSRV;
m_pImmediateContext->OMSetRenderTargets(0, NULL, shadOutputDSV);
m_pImmediateContext->ClearDepthStencilView(shaddepthOutputDSV, D3D11_CLEAR_STENCIL, 1.0f, 0);
m_pImmediateContext->OMSetRenderTargets(0, NULL, shaddepthOutputDSV);
m_WrappedDevice->ReplayLog(frameID, 0, events[ev].eventID, eReplay_OnlyDraw);
@@ -3862,9 +4114,7 @@ vector<PixelModification> D3D11DebugManager::PixelHistory(uint32_t frameID, vect
}
SAFE_RELEASE(prevDSV);
PixelHistoryDepthCopySubresource(true, NULL, pixstoreDepthUAV, shaddepthOutput,
&shaddepthOutputDepthSRV, &shaddepthOutputStencilSRV, srcxyCBuf, storexyCBuf,
storex*pixstoreStride + 2, storey);
PixelHistoryCopyPixel(params, storex*pixstoreStride + 2, storey);
}
m_pImmediateContext->RSSetState(curRS);
@@ -3883,11 +4133,11 @@ vector<PixelModification> D3D11DebugManager::PixelHistory(uint32_t frameID, vect
// replay only draw to get immediately post-modification values
m_WrappedDevice->ReplayLog(frameID, events[ev].eventID, events[ev].eventID, eReplay_OnlyDraw);
m_pImmediateContext->CopySubresourceRegion(pixstore, 0, storex*pixstoreStride + 1, storey, 0, targetres, 0, &srcbox);
PixelHistoryDepthCopySubresource(depthBound, copyTex ? *copyTex : NULL, pixstoreDepthUAV, depthRes,
copyDepthSRV, copyStencilSRV, srcxyCBuf, storexyCBuf,
storex*pixstoreStride + 1, storey);
PixelHistoryCopyPixel(colourCopyParams, storex*pixstoreStride + 1, storey);
PixelHistoryCopyPixel(depthCopyParams, storex*pixstoreStride + 1, storey);
SAFE_RELEASE(releaseDepthSRV);
SAFE_RELEASE(releaseStencilSRV);
if(ev < events.size()-1)
m_WrappedDevice->ReplayLog(frameID, events[ev].eventID+1, events[ev+1].eventID, eReplay_WithoutDraw);
@@ -4313,10 +4563,11 @@ vector<PixelModification> D3D11DebugManager::PixelHistory(uint32_t frameID, vect
SAFE_RELEASE(occl[i]);
}
m_pImmediateContext->CopyResource(pixstoreReadback, pixstore);
m_pImmediateContext->CopyResource(pixstoreDepthReadback, pixstoreDepth);
D3D11_MAPPED_SUBRESOURCE mapped = {0};
m_pImmediateContext->Map(pixstore, 0, D3D11_MAP_READ, 0, &mapped);
m_pImmediateContext->Map(pixstoreReadback, 0, D3D11_MAP_READ, 0, &mapped);
D3D11_MAPPED_SUBRESOURCE mappedDepth = {0};
m_pImmediateContext->Map(pixstoreDepthReadback, 0, D3D11_MAP_READ, 0, &mappedDepth);
@@ -4439,7 +4690,7 @@ vector<PixelModification> D3D11DebugManager::PixelHistory(uint32_t frameID, vect
}
m_pImmediateContext->Unmap(pixstoreDepthReadback, 0);
m_pImmediateContext->Unmap(pixstore, 0);
m_pImmediateContext->Unmap(pixstoreReadback, 0);
/////////////////////////////////////////////////////////////////////////
// simple loop to expand out the history events by number of fragments,
@@ -4475,6 +4726,15 @@ vector<PixelModification> D3D11DebugManager::PixelHistory(uint32_t frameID, vect
ID3D11DepthStencilState *ds = NULL;
CopyPixelParams shadoutCopyParams = colourCopyParams;
shadoutCopyParams.sourceTex = shadoutCopyParams.srvTex = shadOutput;
shadoutCopyParams.srv[0] = shadOutputSRV;
shadoutCopyParams.uav = shadoutStoreUAV;
depthCopyParams.sourceTex = shadoutCopyParams.srvTex = shaddepthOutput;
depthCopyParams.srv[0] = shaddepthOutputDepthSRV;
depthCopyParams.srv[1] = shaddepthOutputStencilSRV;
for(size_t h=0; h < history.size(); h++)
{
const FetchDrawcall *draw = m_WrappedDevice->GetDrawcall(frameID, history[h].eventID);
@@ -4607,24 +4867,24 @@ vector<PixelModification> D3D11DebugManager::PixelHistory(uint32_t frameID, vect
float cleardepth = RDCCLAMP(history[h].preMod.depth, 0.0f, 1.0f);
m_pImmediateContext->ClearDepthStencilView(shadOutputDSV, D3D11_CLEAR_DEPTH|D3D11_CLEAR_STENCIL, cleardepth, 0);
m_pImmediateContext->ClearDepthStencilView(shaddepthOutputDSV, D3D11_CLEAR_DEPTH|D3D11_CLEAR_STENCIL, cleardepth, 0);
m_pImmediateContext->OMSetDepthStencilState(ds, history[h].fragIndex);
// if we're not the last modification in our event, need to fetch post fragment value
if(h+1 < history.size() && history[h].eventID == history[h+1].eventID)
{
m_pImmediateContext->OMSetRenderTargets(rtIndex+1, RTVs, shadOutputDSV);
m_pImmediateContext->OMSetRenderTargets(rtIndex+1, RTVs, shaddepthOutputDSV);
m_WrappedDevice->ReplayLog(frameID, 0, history[h].eventID, eReplay_OnlyDraw);
m_pImmediateContext->CopySubresourceRegion(pixstore, 0, postColSlot%2048, postColSlot/2048, 0, targetres, 0, &srcbox);
PixelHistoryCopyPixel(colourCopyParams, postColSlot%2048, postColSlot/2048);
postColSlot++;
}
m_pImmediateContext->OMSetDepthStencilState(m_DebugRender.StencIncrEqDepthState, history[h].fragIndex);
m_pImmediateContext->ClearDepthStencilView(shadOutputDSV, D3D11_CLEAR_DEPTH|D3D11_CLEAR_STENCIL, cleardepth, 0);
m_pImmediateContext->ClearDepthStencilView(shaddepthOutputDSV, D3D11_CLEAR_DEPTH|D3D11_CLEAR_STENCIL, cleardepth, 0);
// fetch shader output value & primitive ID
{
@@ -4636,26 +4896,24 @@ vector<PixelModification> D3D11DebugManager::PixelHistory(uint32_t frameID, vect
{
ID3D11RenderTargetView *sparseRTVs[8] = { 0 };
sparseRTVs[rtIndex] = shadOutputRTV;
m_pImmediateContext->OMSetRenderTargets(rtIndex+1, sparseRTVs, shadOutputDSV);
m_pImmediateContext->OMSetRenderTargets(rtIndex+1, sparseRTVs, shaddepthOutputDSV);
m_WrappedDevice->ReplayLog(frameID, 0, history[h].eventID, eReplay_OnlyDraw);
m_pImmediateContext->CopySubresourceRegion(shadoutStore, 0, shadColSlot%2048, shadColSlot/2048, 0, shadOutput, 0, &srcbox);
PixelHistoryCopyPixel(shadoutCopyParams, shadColSlot%2048, shadColSlot/2048);
shadColSlot++;
m_pImmediateContext->OMSetRenderTargets(0, NULL, NULL);
PixelHistoryDepthCopySubresource(true, NULL, pixstoreDepthUAV, shaddepthOutput,
&shaddepthOutputDepthSRV, &shaddepthOutputStencilSRV, srcxyCBuf, storexyCBuf,
depthSlot%2048, depthSlot/2048);
PixelHistoryCopyPixel(depthCopyParams, depthSlot%2048, depthSlot/2048);
depthSlot++;
}
m_pImmediateContext->ClearDepthStencilView(shadOutputDSV, D3D11_CLEAR_DEPTH|D3D11_CLEAR_STENCIL, cleardepth, 0);
m_pImmediateContext->ClearDepthStencilView(shaddepthOutputDSV, D3D11_CLEAR_DEPTH|D3D11_CLEAR_STENCIL, cleardepth, 0);
// fetch primitive ID
{
m_pImmediateContext->OMSetRenderTargets(1, &shadOutputRTV, shadOutputDSV);
m_pImmediateContext->OMSetRenderTargets(1, &shadOutputRTV, shaddepthOutputDSV);
m_pImmediateContext->PSGetShader(&curPS, curInst, &curNumInst);
m_pImmediateContext->PSSetShader(m_DebugRender.PrimitiveIDPS, NULL, 0);
@@ -4668,8 +4926,8 @@ vector<PixelModification> D3D11DebugManager::PixelHistory(uint32_t frameID, vect
SAFE_RELEASE(curInst[i]);
SAFE_RELEASE(curPS);
m_pImmediateContext->CopySubresourceRegion(shadoutStore, 0, shadColSlot%2048, shadColSlot/2048, 0, shadOutput, 0, &srcbox);
PixelHistoryCopyPixel(shadoutCopyParams, shadColSlot%2048, shadColSlot/2048);
shadColSlot++;
}
@@ -4682,14 +4940,15 @@ vector<PixelModification> D3D11DebugManager::PixelHistory(uint32_t frameID, vect
for(int i=0; i < D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT; i++)
SAFE_RELEASE(RTVs[i]);
m_pImmediateContext->CopyResource(shadoutStoreReadback, shadoutStore);
m_pImmediateContext->CopyResource(pixstoreReadback, pixstore);
m_pImmediateContext->CopyResource(pixstoreDepthReadback, pixstoreDepth);
m_pImmediateContext->Map(pixstore, 0, D3D11_MAP_READ, 0, &mapped);
m_pImmediateContext->Map(pixstoreDepthReadback, 0, D3D11_MAP_READ, 0, &mappedDepth);
D3D11_MAPPED_SUBRESOURCE mappedShadout = {0};
m_pImmediateContext->Map(shadoutStore, 0, D3D11_MAP_READ, 0, &mappedShadout);
m_pImmediateContext->Map(pixstoreReadback, 0, D3D11_MAP_READ, 0, &mapped);
m_pImmediateContext->Map(pixstoreDepthReadback, 0, D3D11_MAP_READ, 0, &mappedDepth);
m_pImmediateContext->Map(shadoutStoreReadback, 0, D3D11_MAP_READ, 0, &mappedShadout);
byte *shadoutStoreData = (byte *)mappedShadout.pData;
pixstoreData = (byte *)mapped.pData;
@@ -4849,8 +5108,8 @@ vector<PixelModification> D3D11DebugManager::PixelHistory(uint32_t frameID, vect
}
}
m_pImmediateContext->Unmap(shadoutStore, 0);
m_pImmediateContext->Unmap(pixstore, 0);
m_pImmediateContext->Unmap(shadoutStoreReadback, 0);
m_pImmediateContext->Unmap(pixstoreReadback, 0);
m_pImmediateContext->Unmap(pixstoreDepthReadback, 0);
// interpret float/unorm values
@@ -4970,17 +5229,23 @@ vector<PixelModification> D3D11DebugManager::PixelHistory(uint32_t frameID, vect
SAFE_RELEASE(pixstore);
SAFE_RELEASE(shadoutStore);
SAFE_RELEASE(pixstoreDepth);
SAFE_RELEASE(pixstoreReadback);
SAFE_RELEASE(shadoutStoreReadback);
SAFE_RELEASE(pixstoreDepthReadback);
SAFE_RELEASE(pixstoreUAV);
SAFE_RELEASE(shadoutStoreUAV);
SAFE_RELEASE(pixstoreDepthUAV);
SAFE_RELEASE(shadOutput);
SAFE_RELEASE(shadOutputSRV);
SAFE_RELEASE(shadOutputRTV);
SAFE_RELEASE(shaddepthOutput);
SAFE_RELEASE(shadOutputDSV);
SAFE_RELEASE(shaddepthOutputDSV);
SAFE_RELEASE(shaddepthOutputDepthSRV);
SAFE_RELEASE(shaddepthOutputStencilSRV);
SAFE_RELEASE(pixstoreDepthReadback);
SAFE_RELEASE(pixstoreDepth);
SAFE_RELEASE(pixstoreDepthUAV);
SAFE_RELEASE(depthCopyD24S8);
SAFE_RELEASE(depthCopyD24S8_DepthSRV);
@@ -4996,5 +5261,8 @@ vector<PixelModification> D3D11DebugManager::PixelHistory(uint32_t frameID, vect
SAFE_RELEASE(depthCopyD16);
SAFE_RELEASE(depthCopyD16_DepthSRV);
SAFE_RELEASE(srcxyCBuf);
SAFE_RELEASE(storexyCBuf);
return history;
}
+1 -1
View File
@@ -785,7 +785,7 @@ bool D3D11DebugManager::InitDebugRendering()
m_DebugRender.QOResolvePS = MakePShader(displayhlsl.c_str(), "RENDERDOC_QOResolvePS", "ps_5_0");
m_DebugRender.PixelHistoryUnusedCS = MakeCShader(displayhlsl.c_str(), "RENDERDOC_PixelHistoryUnused", "cs_5_0");
m_DebugRender.PixelHistoryDepthCopyCS = MakeCShader(displayhlsl.c_str(), "RENDERDOC_PixelHistoryCopyDepthStencil", "cs_5_0");
m_DebugRender.PixelHistoryCopyCS = MakeCShader(displayhlsl.c_str(), "RENDERDOC_PixelHistoryCopyPixel", "cs_5_0");
m_DebugRender.PrimitiveIDPS = MakePShader(displayhlsl.c_str(), "RENDERDOC_PrimitiveIDPS", "ps_5_0");
string multisamplehlsl = GetEmbeddedResource(multisample_hlsl);
+5 -5
View File
@@ -86,6 +86,8 @@ struct PostVSData
}
};
struct CopyPixelParams;
class D3D11DebugManager
{
public:
@@ -320,9 +322,7 @@ class D3D11DebugManager
void CreateCustomShaderTex(uint32_t w, uint32_t h);
void PixelHistoryDepthCopySubresource(bool depthbound, ID3D11Texture2D *uavres, ID3D11UnorderedAccessView *uav, ID3D11Resource *depthres,
ID3D11ShaderResourceView **copyDepthSRV, ID3D11ShaderResourceView **copyStencilSRV,
ID3D11Buffer *srcxyCBuf, ID3D11Buffer *storexyCBuf, uint32_t x, uint32_t y);
void PixelHistoryCopyPixel(CopyPixelParams &params, uint32_t x, uint32_t y);
static const int FONT_TEX_WIDTH = 4096;
static const int FONT_TEX_HEIGHT = 48;
@@ -396,7 +396,7 @@ class D3D11DebugManager
SAFE_RELEASE(DepthCopyMSToArrayPS);
SAFE_RELEASE(DepthCopyArrayToMSPS);
SAFE_RELEASE(PixelHistoryUnusedCS);
SAFE_RELEASE(PixelHistoryDepthCopyCS);
SAFE_RELEASE(PixelHistoryCopyCS);
SAFE_RELEASE(PrimitiveIDPS);
SAFE_RELEASE(QuadOverdrawPS);
@@ -461,7 +461,7 @@ class D3D11DebugManager
ID3D11PixelShader *CopyMSToArrayPS, *CopyArrayToMSPS;
ID3D11PixelShader *FloatCopyMSToArrayPS, *FloatCopyArrayToMSPS;
ID3D11PixelShader *DepthCopyMSToArrayPS, *DepthCopyArrayToMSPS;
ID3D11ComputeShader *PixelHistoryUnusedCS, *PixelHistoryDepthCopyCS;
ID3D11ComputeShader *PixelHistoryUnusedCS, *PixelHistoryCopyCS;
ID3D11PixelShader *PrimitiveIDPS;
ID3D11PixelShader *QuadOverdrawPS, *QOResolvePS;