Expose queries for descriptor stores and D3D12 root signature range

* This will allow a UI viewer or consumer of the replay API to more easily query
  'all' descriptors for a given store.
This commit is contained in:
baldurk
2024-04-10 18:58:53 +01:00
parent 9a18e871e5
commit 153cd2aa16
26 changed files with 689 additions and 75 deletions
+223 -3
View File
@@ -550,6 +550,219 @@ struct ResourceData
rdcarray<ResourceState> states;
};
DOCUMENT("Contains the structure of a single range within a root table definition.");
struct RootTableRange
{
DOCUMENT("");
RootTableRange() = default;
RootTableRange(const RootTableRange &) = default;
RootTableRange &operator=(const RootTableRange &) = default;
bool operator==(const RootTableRange &o) const
{
return category == o.category && space == o.space && baseRegister == o.baseRegister &&
count == o.count && tableByteOffset == o.tableByteOffset;
}
bool operator<(const RootTableRange &o) const
{
if(!(category == o.category))
return category < o.category;
if(!(space == o.space))
return space < o.space;
if(!(baseRegister == o.baseRegister))
return baseRegister < o.baseRegister;
if(!(count == o.count))
return count < o.count;
if(!(tableByteOffset == o.tableByteOffset))
return tableByteOffset < o.tableByteOffset;
return false;
}
DOCUMENT(R"(The descriptor category specified in this range.
:type: DescriptorCategory
)");
DescriptorCategory category = DescriptorCategory::Unknown;
DOCUMENT(R"(The register space of this range.
:type: int
)");
uint32_t space = 0;
DOCUMENT(R"(The first register in this range.
:type: int
)");
uint32_t baseRegister = 0;
DOCUMENT(R"(The number of registers in this range.
:type: int
)");
uint32_t count = 0;
DOCUMENT(R"(The offset in bytes from the start of the table as defined in :class:`D3D12RootParam`.
:type: int
)");
uint32_t tableByteOffset = 0;
DOCUMENT(R"(Whether or not this table was appended after the previous, leading to an auto-calculated
offset in :data:`tableByteOffset`.
:type: bool
)");
bool appended = false;
};
DOCUMENT("Contains the structure and content of a single root parameter.");
struct RootParam
{
DOCUMENT("");
RootParam() = default;
RootParam(const RootParam &) = default;
RootParam &operator=(const RootParam &) = default;
bool operator==(const RootParam &o) const
{
return visibility == o.visibility && heap == o.heap && heapByteOffset == o.heapByteOffset &&
tableRanges == o.tableRanges && descriptor == o.descriptor && constants == o.constants;
}
bool operator<(const RootParam &o) const
{
if(!(visibility == o.visibility))
return visibility < o.visibility;
if(!(heap == o.heap))
return heap < o.heap;
if(!(heapByteOffset == o.heapByteOffset))
return heapByteOffset < o.heapByteOffset;
if(!(tableRanges == o.tableRanges))
return tableRanges < o.tableRanges;
if(!(descriptor == o.descriptor))
return descriptor < o.descriptor;
if(!(constants == o.constants))
return constants < o.constants;
return false;
}
DOCUMENT(R"(The shader stage that can access this parameter.
:type: ShaderStageMask
)");
ShaderStageMask visibility;
DOCUMENT(R"(For a root constant parameter, the words defined.
:type: bytes
)");
bytebuf constants;
DOCUMENT(R"(For a root descriptor parameter, the descriptor itself.
:type: Descriptor
)");
Descriptor descriptor;
DOCUMENT(R"(For a root table parameter, the descriptor heap bound to this parameter. See
:data:`heapByteOffset` and :data:`tableRanges`.
:type: ResourceId
)");
ResourceId heap;
DOCUMENT(R"(For a root table parameter, the byte offset into the descriptor heap bound to this
parameter. See :data:`heap` and :data:`tableRanges`.
:type: ResourceId
)");
uint32_t heapByteOffset = 0;
DOCUMENT(R"(For a root table parameter, the descriptor ranges that define this table. See
:data:`heap` and :data:`heapByteOffset`.
:type: List[D3D12RootTableRange]
)");
rdcarray<RootTableRange> tableRanges;
};
DOCUMENT("Contains the details of a single static sampler in a root signature.");
struct StaticSampler
{
DOCUMENT("");
StaticSampler() = default;
StaticSampler(const StaticSampler &) = default;
StaticSampler &operator=(const StaticSampler &) = default;
bool operator==(const StaticSampler &o) const
{
return visibility == o.visibility && space == o.space && reg == o.reg &&
descriptor == o.descriptor;
}
bool operator<(const StaticSampler &o) const
{
if(!(visibility == o.visibility))
return visibility < o.visibility;
if(!(space == o.space))
return space < o.space;
if(!(reg == o.reg))
return reg < o.reg;
if(!(descriptor == o.descriptor))
return descriptor < o.descriptor;
return false;
}
DOCUMENT(R"(The shader stage that can access this sampler.
:type: ShaderStageMask
)");
ShaderStageMask visibility;
DOCUMENT(R"(The register space of this sampler.
:type: int
)");
uint32_t space = 0;
DOCUMENT(R"(The register number of this sampler.
:type: int
)");
uint32_t reg = 0;
DOCUMENT(R"(The details of the sampler descriptor itself.
:type: SamplerDescriptor
)");
SamplerDescriptor descriptor;
};
DOCUMENT("Contains the root signature structure and root parameters.");
struct RootSignature
{
DOCUMENT("");
RootSignature() = default;
RootSignature(const RootSignature &) = default;
RootSignature &operator=(const RootSignature &) = default;
DOCUMENT(R"(The :class:`ResourceId` of the root signature object.
:type: ResourceId
)");
ResourceId resourceId;
DOCUMENT(R"(The parameters in this root signature.
:type: List[D3D12RootParam]
)");
rdcarray<RootParam> parameters;
DOCUMENT(R"(The static samplers defined in this root signature.
:type: List[SamplerDescriptor]
)");
rdcarray<StaticSampler> staticSamplers;
};
DOCUMENT("The full current D3D12 pipeline state.");
struct State
{
@@ -562,15 +775,18 @@ struct State
DOCUMENT("The :class:`ResourceId` of the pipeline state object.");
ResourceId pipelineResourceId;
DOCUMENT("The :class:`ResourceId` of the root signature object.");
ResourceId rootSignatureResourceId;
DOCUMENT(R"(The descriptor heaps currently bound.
:type: List[ResourceId]
)");
rdcarray<ResourceId> descriptorHeaps;
DOCUMENT(R"(Details of the root signature structure and root parameters.
:type: D3D12RootSignature
)");
RootSignature rootSignature;
DOCUMENT(R"(The input assembly pipeline stage.
:type: D3D12InputAssembly
@@ -659,4 +875,8 @@ DECLARE_REFLECTION_STRUCT(D3D12Pipe::BlendState);
DECLARE_REFLECTION_STRUCT(D3D12Pipe::OM);
DECLARE_REFLECTION_STRUCT(D3D12Pipe::ResourceState);
DECLARE_REFLECTION_STRUCT(D3D12Pipe::ResourceData);
DECLARE_REFLECTION_STRUCT(D3D12Pipe::RootTableRange);
DECLARE_REFLECTION_STRUCT(D3D12Pipe::RootParam);
DECLARE_REFLECTION_STRUCT(D3D12Pipe::StaticSampler);
DECLARE_REFLECTION_STRUCT(D3D12Pipe::RootSignature);
DECLARE_REFLECTION_STRUCT(D3D12Pipe::State);
+44
View File
@@ -596,6 +596,50 @@ typically it is one parent to many derived.
DECLARE_REFLECTION_STRUCT(ResourceDescription);
DOCUMENT("A description of a descriptor store.");
struct DescriptorStoreDescription
{
DOCUMENT("");
DescriptorStoreDescription() = default;
DescriptorStoreDescription(const DescriptorStoreDescription &) = default;
DescriptorStoreDescription &operator=(const DescriptorStoreDescription &) = default;
bool operator==(const DescriptorStoreDescription &o) const { return resourceId == o.resourceId; }
bool operator<(const DescriptorStoreDescription &o) const
{
if(!(resourceId == o.resourceId))
return resourceId < o.resourceId;
return false;
}
DOCUMENT(R"(The unique :class:`ResourceId` that identifies this descriptor store.
:type: ResourceId
)");
ResourceId resourceId;
DOCUMENT(R"(For descriptor stores which contain desriptors all of identical size, the size of each
descriptor. Descriptors are assumed to be tightly packed so stride is equal to size.
:type: int
)");
uint32_t descriptorByteSize = 1;
DOCUMENT(R"(The byte offset within the store to the first descriptor.
:type: int
)");
uint32_t firstDescriptorOffset = 0;
DOCUMENT(R"(The number of descriptors within this storage object.
:type: int
)");
uint32_t descriptorCount = 0;
};
DECLARE_REFLECTION_STRUCT(DescriptorStoreDescription);
DOCUMENT("A description of a buffer resource.");
struct BufferDescription
{
+7
View File
@@ -850,6 +850,13 @@ are only used as intermediary elements.
)");
virtual const rdcarray<BufferDescription> &GetBuffers() = 0;
DOCUMENT(R"(Retrieve the list of descriptor storage objects alive in the capture.
:return: The list of descriptor storage objects in the capture.
:rtype: List[DescriptorStoreDescription]
)");
virtual const rdcarray<DescriptorStoreDescription> &GetDescriptorStores() = 0;
DOCUMENT(R"(Retrieve a list of any newly generated diagnostic messages.
Every time this function is called, any debug messages returned will not be returned again. Only