Added D3D12 helper DoesCommandSignatureModifyRootArgs()

Moved code out of D3D12 Shader Feedback ready to be used by the D3D12 Overlay code
This commit is contained in:
Jake Turner committed 2026-05-20 10:16:30 +01:00
1 parent 42ffc71a0d
commit 2723a9e96e
3 files changed
+21 -15

No files matched your search

+17
View File
@@ -3562,3 +3562,20 @@ void AddDebugDescriptorsToRenderState(WrappedID3D12Device *pDevice, D3D12RenderS
sig.sigelems[sigElem] =
D3D12RenderState::SignatureElement(eRootTable, newHandle.heap, newHandle.index);
}
// Does a command signature modify root arguments i.e. setting root constants, updating bindings.
bool DoesCommandSignatureModifyRootArgs(ID3D12CommandSignature *comSig)
{
WrappedID3D12CommandSignature *rdComSig = (WrappedID3D12CommandSignature *)comSig;
for(D3D12_INDIRECT_ARGUMENT_DESC &arg : rdComSig->sig.arguments)
{
D3D12_INDIRECT_ARGUMENT_TYPE argType = arg.Type;
if(argType == D3D12_INDIRECT_ARGUMENT_TYPE_CONSTANT ||
argType == D3D12_INDIRECT_ARGUMENT_TYPE_CONSTANT_BUFFER_VIEW ||
argType == D3D12_INDIRECT_ARGUMENT_TYPE_SHADER_RESOURCE_VIEW ||
argType == D3D12_INDIRECT_ARGUMENT_TYPE_UNORDERED_ACCESS_VIEW ||
argType == D3D12_INDIRECT_ARGUMENT_TYPE_INCREMENTING_CONSTANT)
return true;
}
return false;
}
+3
View File
@@ -332,3 +332,6 @@ void AddDebugDescriptorsToRenderState(WrappedID3D12Device *pDevice, D3D12RenderS
bool compute, const rdcarray<PortableHandle> &handles,
D3D12_DESCRIPTOR_HEAP_TYPE heapType, uint32_t sigElem,
std::set<ResourceId> &copiedHeaps);
// Does a command signature modify root arguments i.e. setting root constants, updating bindings.
bool DoesCommandSignatureModifyRootArgs(ID3D12CommandSignature *comSig);
@@ -1236,21 +1236,7 @@ struct D3D12StatCallback : public D3D12ActionCallback
{
// Need to create a new command signature using our modified root signature if the command
// signature modifies the root arguments i.e. setting root constants, updating bindings.
bool needNewCommandSig = false;
for(D3D12_INDIRECT_ARGUMENT_DESC &arg : comSig->sig.arguments)
{
D3D12_INDIRECT_ARGUMENT_TYPE argType = arg.Type;
if(argType == D3D12_INDIRECT_ARGUMENT_TYPE_CONSTANT ||
argType == D3D12_INDIRECT_ARGUMENT_TYPE_CONSTANT_BUFFER_VIEW ||
argType == D3D12_INDIRECT_ARGUMENT_TYPE_SHADER_RESOURCE_VIEW ||
argType == D3D12_INDIRECT_ARGUMENT_TYPE_UNORDERED_ACCESS_VIEW ||
argType == D3D12_INDIRECT_ARGUMENT_TYPE_INCREMENTING_CONSTANT)
{
needNewCommandSig = true;
break;
}
}
if(needNewCommandSig)
if(DoesCommandSignatureModifyRootArgs(comSig))
{
D3D12_COMMAND_SIGNATURE_DESC comSigDesc;
comSigDesc.ByteStride = comSig->sig.ByteStride;