mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-10-25 16:20:36 +00:00
Fetch primitive ID
This commit is contained in:
1 parent
0b580f32c3
commit
f63b89b16e
4 files changed
+36
No files matched your search
@@ -408,3 +408,8 @@ void RENDERDOC_PixelHistoryCopyDepthStencil()
|
||||
depth_src[src_coord.xy].r,
|
||||
copy_stencil > 0 ? (float)stencil_src[src_coord.xy].g : -1.0f);
|
||||
}
|
||||
|
||||
float4 RENDERDOC_PrimitiveIDPS(uint prim : SV_PrimitiveID) : SV_Target0
|
||||
{
|
||||
return asfloat(prim).xxxx;
|
||||
}
|
||||
@@ -4288,6 +4288,23 @@ vector<PixelModification> D3D11DebugManager::PixelHistory(uint32_t frameID, vect
|
||||
depthSlot%2048, depthSlot/2048);
|
||||
depthSlot++;
|
||||
}
|
||||
|
||||
m_pImmediateContext->ClearDepthStencilView(shadOutputDSV, D3D11_CLEAR_STENCIL, 1.0f, 0);
|
||||
|
||||
// fetch primitive ID
|
||||
{
|
||||
m_pImmediateContext->OMSetRenderTargets(1, &shadOutputRTV, shadOutputDSV);
|
||||
|
||||
m_pImmediateContext->PSGetShader(&curPS, curInst, &curNumInst);
|
||||
m_pImmediateContext->PSSetShader(m_DebugRender.PrimitiveIDPS, NULL, 0);
|
||||
|
||||
m_WrappedDevice->ReplayLog(frameID, 0, history[h].eventID, eReplay_OnlyDraw);
|
||||
|
||||
m_pImmediateContext->PSSetShader(curPS, curInst, curNumInst);
|
||||
|
||||
m_pImmediateContext->CopySubresourceRegion(shadoutStore, 0, shadColSlot%2048, shadColSlot/2048, 0, shadOutput, 0, &srcbox);
|
||||
shadColSlot++;
|
||||
}
|
||||
}
|
||||
|
||||
for(int i=0; i < D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT; i++)
|
||||
@@ -4404,6 +4421,17 @@ vector<PixelModification> D3D11DebugManager::PixelHistory(uint32_t frameID, vect
|
||||
shadColSlot++;
|
||||
depthSlot++;
|
||||
}
|
||||
|
||||
// fetch primitive ID
|
||||
{
|
||||
// shader output is always 4 32bit components, so we can copy straight
|
||||
byte *rowdata = shadoutStoreData + mapped.RowPitch * (shadColSlot/2048);
|
||||
byte *data = rowdata + 4 * sizeof(float) * (shadColSlot%2048);
|
||||
|
||||
memcpy(&history[h].primitiveID, data, sizeof(uint32_t));
|
||||
|
||||
shadColSlot++;
|
||||
}
|
||||
}
|
||||
|
||||
m_pImmediateContext->Unmap(shadoutStore, 0);
|
||||
|
||||
@@ -786,6 +786,7 @@ bool D3D11DebugManager::InitDebugRendering()
|
||||
|
||||
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.PrimitiveIDPS = MakePShader(displayhlsl.c_str(), "RENDERDOC_PrimitiveIDPS", "ps_5_0");
|
||||
|
||||
string multisamplehlsl = GetEmbeddedResource(multisample_hlsl);
|
||||
|
||||
|
||||
@@ -398,6 +398,7 @@ class D3D11DebugManager
|
||||
SAFE_RELEASE(DepthCopyArrayToMSPS);
|
||||
SAFE_RELEASE(PixelHistoryUnusedCS);
|
||||
SAFE_RELEASE(PixelHistoryDepthCopyCS);
|
||||
SAFE_RELEASE(PrimitiveIDPS);
|
||||
|
||||
SAFE_RELEASE(QuadOverdrawPS);
|
||||
SAFE_RELEASE(QOResolvePS);
|
||||
@@ -462,6 +463,7 @@ class D3D11DebugManager
|
||||
ID3D11PixelShader *FloatCopyMSToArrayPS, *FloatCopyArrayToMSPS;
|
||||
ID3D11PixelShader *DepthCopyMSToArrayPS, *DepthCopyArrayToMSPS;
|
||||
ID3D11ComputeShader *PixelHistoryUnusedCS, *PixelHistoryDepthCopyCS;
|
||||
ID3D11PixelShader *PrimitiveIDPS;
|
||||
|
||||
ID3D11PixelShader *QuadOverdrawPS, *QOResolvePS;
|
||||
|
||||
|
||||
Reference in new issue
Block a user