mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-07-08 16:50:44 +00:00
Add utility for setting only root elements, instead of the whole state
This commit is contained in:
@@ -129,7 +129,7 @@ ResourceId D3D12RenderState::GetDSVID() const
|
||||
return ResourceId();
|
||||
}
|
||||
|
||||
void D3D12RenderState::ApplyState(ID3D12GraphicsCommandList *cmd)
|
||||
void D3D12RenderState::ApplyState(ID3D12GraphicsCommandList *cmd) const
|
||||
{
|
||||
if(pipe != ResourceId())
|
||||
cmd->SetPipelineState(GetResourceManager()->GetCurrentAs<ID3D12PipelineState>(pipe));
|
||||
@@ -207,21 +207,7 @@ void D3D12RenderState::ApplyState(ID3D12GraphicsCommandList *cmd)
|
||||
cmd->SetGraphicsRootSignature(
|
||||
GetResourceManager()->GetCurrentAs<ID3D12RootSignature>(graphics.rootsig));
|
||||
|
||||
for(size_t i = 0; i < graphics.sigelems.size(); i++)
|
||||
{
|
||||
// just don't set tables that aren't in the descriptor heaps, since it's invalid and can crash
|
||||
// and is probably just from stale bindings that aren't going to be used
|
||||
if(graphics.sigelems[i].type != eRootTable ||
|
||||
std::find(heaps.begin(), heaps.end(), graphics.sigelems[i].id) != heaps.end())
|
||||
{
|
||||
graphics.sigelems[i].SetToGraphics(GetResourceManager(), cmd, (UINT)i);
|
||||
}
|
||||
else
|
||||
{
|
||||
RDCDEBUG("Skipping setting possibly stale graphics root table referring to heap %llu",
|
||||
graphics.sigelems[i].id);
|
||||
}
|
||||
}
|
||||
ApplyGraphicsRootElements(cmd);
|
||||
}
|
||||
|
||||
if(compute.rootsig != ResourceId())
|
||||
@@ -229,20 +215,44 @@ void D3D12RenderState::ApplyState(ID3D12GraphicsCommandList *cmd)
|
||||
cmd->SetComputeRootSignature(
|
||||
GetResourceManager()->GetCurrentAs<ID3D12RootSignature>(compute.rootsig));
|
||||
|
||||
for(size_t i = 0; i < compute.sigelems.size(); i++)
|
||||
ApplyComputeRootElements(cmd);
|
||||
}
|
||||
}
|
||||
|
||||
void D3D12RenderState::ApplyComputeRootElements(ID3D12GraphicsCommandList *cmd) const
|
||||
{
|
||||
for(size_t i = 0; i < compute.sigelems.size(); i++)
|
||||
{
|
||||
// just don't set tables that aren't in the descriptor heaps, since it's invalid and can crash
|
||||
// and is probably just from stale bindings that aren't going to be used
|
||||
if(compute.sigelems[i].type != eRootTable ||
|
||||
std::find(heaps.begin(), heaps.end(), compute.sigelems[i].id) != heaps.end())
|
||||
{
|
||||
// just don't set tables that aren't in the descriptor heaps, since it's invalid and can crash
|
||||
// and is probably just from stale bindings that aren't going to be used
|
||||
if(compute.sigelems[i].type != eRootTable ||
|
||||
std::find(heaps.begin(), heaps.end(), compute.sigelems[i].id) != heaps.end())
|
||||
{
|
||||
compute.sigelems[i].SetToCompute(GetResourceManager(), cmd, (UINT)i);
|
||||
}
|
||||
else
|
||||
{
|
||||
RDCDEBUG("Skipping setting possibly stale compute root table referring to heap %llu",
|
||||
compute.sigelems[i].id);
|
||||
}
|
||||
compute.sigelems[i].SetToCompute(GetResourceManager(), cmd, (UINT)i);
|
||||
}
|
||||
else
|
||||
{
|
||||
RDCDEBUG("Skipping setting possibly stale compute root table referring to heap %llu",
|
||||
compute.sigelems[i].id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void D3D12RenderState::ApplyGraphicsRootElements(ID3D12GraphicsCommandList *cmd) const
|
||||
{
|
||||
for(size_t i = 0; i < graphics.sigelems.size(); i++)
|
||||
{
|
||||
// just don't set tables that aren't in the descriptor heaps, since it's invalid and can crash
|
||||
// and is probably just from stale bindings that aren't going to be used
|
||||
if(graphics.sigelems[i].type != eRootTable ||
|
||||
std::find(heaps.begin(), heaps.end(), graphics.sigelems[i].id) != heaps.end())
|
||||
{
|
||||
graphics.sigelems[i].SetToGraphics(GetResourceManager(), cmd, (UINT)i);
|
||||
}
|
||||
else
|
||||
{
|
||||
RDCDEBUG("Skipping setting possibly stale graphics root table referring to heap %llu",
|
||||
graphics.sigelems[i].id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,7 +45,9 @@ struct D3D12RenderState
|
||||
D3D12RenderState();
|
||||
D3D12RenderState &operator=(const D3D12RenderState &o);
|
||||
|
||||
void ApplyState(ID3D12GraphicsCommandList *list);
|
||||
void ApplyState(ID3D12GraphicsCommandList *list) const;
|
||||
void ApplyComputeRootElements(ID3D12GraphicsCommandList *cmd) const;
|
||||
void ApplyGraphicsRootElements(ID3D12GraphicsCommandList *cmd) const;
|
||||
|
||||
vector<D3D12_VIEWPORT> views;
|
||||
vector<D3D12_RECT> scissors;
|
||||
@@ -72,7 +74,7 @@ struct D3D12RenderState
|
||||
memcpy(&constants[offs], vals, numVals * sizeof(UINT));
|
||||
}
|
||||
|
||||
void SetToGraphics(D3D12ResourceManager *rm, ID3D12GraphicsCommandList *cmd, UINT slot)
|
||||
void SetToGraphics(D3D12ResourceManager *rm, ID3D12GraphicsCommandList *cmd, UINT slot) const
|
||||
{
|
||||
if(type == eRootConst)
|
||||
{
|
||||
@@ -102,7 +104,7 @@ struct D3D12RenderState
|
||||
}
|
||||
}
|
||||
|
||||
void SetToCompute(D3D12ResourceManager *rm, ID3D12GraphicsCommandList *cmd, UINT slot)
|
||||
void SetToCompute(D3D12ResourceManager *rm, ID3D12GraphicsCommandList *cmd, UINT slot) const
|
||||
{
|
||||
if(type == eRootConst)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user