Class MetadataExtractorEx
Defined in File metadata-extractor-ex.h
Inheritance Relationships
Base Types
public gpa::playback::CallableBroadcaster
(Class CallableBroadcaster)public gpa::playback::CallableReceiver
(Class CallableReceiver)
Class Documentation
-
class MetadataExtractorEx : public gpa::playback::CallableBroadcaster, public gpa::playback::CallableReceiver
Provides access to metadata for a captured range
Range metadata is delivered via
ResourceInfo objects. ResourceInfo objects can be acquired and enumerated using GetResourceInfos(). GetResourceInfos() requires two arguments, the desired ResourceInfo::Usage and the call index. ResourceInfo::Usage specifies the usage to inspect and the call index specifies the GPU ordered call index to inspect for ResourceInfoobjects.
In the following example we're interested in
TextureInfo objects with ResourceInfo::Usage::GRAPHICS_OUTPUT at call index 128. GetResourceInfos() will allow us to loop over all of the ResourceInfoobjects with the specified usage and call index.
Since we're currently only interested in
TextureInfo objects we attempt to convert and process each ResourceInfo.In cases where we're interested in more than one type of ResourceInfo, we can switch() on the ResourceInfoauto usage = ResourceInfo::Usage::GRAPHICS_OUTPUT; auto callIndex = 128; for (auto const& resourceInfo : metadataExtractor.GetResourceInfos(usage, callIndex)) { auto pTextureInfo = resourceInfo.As<TextureInfo>(); if (pTextureInfo) { ProcessTextureInfo(*pTextureInfo); } }
's TypeId.
It's worth noting that a single
ResourceInfo may be associated with more than one ResourceInfo::Usagefor any given call index.
In the following example we're interested in
BufferInfo and TextureInfoobjects.
In our loop we'll switch on the
ResourceInfo's TypeId and process our ResourceInfo objects as their specific type.In general, for any given ResourceInfo::Usage a ResourceInfo will have one or more ResourceInfo::Ex objects associated with it. ResourceInfo::Ex objects are acquired from ResourceInfo objects and converted to their specific types in the same manner as ResourceInfoauto usage = ResourceInfo::Usage::GRAPHICS_DESCRIPTOR; auto callIndex = 128; for (auto const& resourceInfo : metadataExtractor.GetResourceInfos(usage, callIndex)) { switch (resourceInfo.GetTypeId()) { case ResourceInfo::GetTypeId<BufferInfo>(): { ProcessBufferDescriptor(resourceInfo.As<BufferInfo>()); } break; case ResourceInfo::GetTypeId<TextureInfo>(): { ProcessTextureDescriptor(resourceInfo.As<TextureInfo>()); } break; } }
objects.
In the following example we're interested in
IndexBufferInfo and VertexBufferInfo objects. IndexBufferInfo and VertexBufferInfoobjects are delivered via ResourceInfo::Usage::GRAPHICS_INPUT_ASSEMBLY.
As in the previous example we'll switch() on TypeId, but this time we'll use the
ResourceInfo::Ex TypeId.auto usage = ResourceInfo::Usage::GRAPHICS_INPUT_ASSEMBLY; auto callIndex = 128; for (auto const& resourceInfo : metadataExtractor.GetResourceInfos(usage, callIndex)) { for (auto const& resourceInfoEx : resourceInfo.GetResourceInfoExs(usage, callIndex)) { switch (resourceInfoEx.GetTypeId()) { case ResourceInfo::Ex::GetTypeId<IndexBufferInfo>(): { ProcessIndexBuffer(resourceInfoEx.As<IndexBufferInfo>()); } break; case ResourceInfo::Ex::GetTypeId<VertexBufferInfo>(): { ProcessVertexBuffer(resourceInfoEx.As<VertexBufferInfo>()); } break; } } }
Public Functions
-
MetadataExtractorEx() = default
Constructs an instance of MetadataExtractorEx.
-
virtual ~MetadataExtractorEx()
Destroys this instance of MetadataExtractorEx
-
virtual void ConnectExecutionCallbacks(ExecutionCallbacks const &callbacks) final override
-
virtual void DisconnectExecutionCallbacks() final override
-
virtual void PostSetupRange(CallableCache *range) override
-
virtual void PreExecuteRange(CallableCache *range) override
-
virtual void PostExecuteRange(CallableCache *range) override
-
virtual void PostExecuteCall(Callable *callable, uint64_t callIndex) override
Override this method to recieve a call after exectuing the given Callable.
Note
If this method is overriden MetadataExtractorEx::PostExecuteCall() must be called
-
uint64_t GetCallCount() const
Gets the number of calls in the captured range.
- Returns
The number of calls in the captured range
-
ResourceInfo const *GetResourceInfo(ResourceId resourceId) const
Gets a pointer to the ResourceInfo associated with a given ResourceId.
Note
If there is no registerd ResourceInfo with the given ResourceId this method will return nullptr
- Parameters
resourceId -- [in] The ResourceId to get the associated ResourceInfo pointer for
- Returns
A pointer to the ResourceInfo associated with the given ResourceId
-
Enumerator<ResourceInfo> GetResourceInfos() const
Gets an Enumerator<> to all registered ResourceInfos.
Note
Subsequent calls to this method invalidate outstanding Enumerator<> objects and Enumerator<>::Iterator objects
- Returns
An Enumerator<> to all registered ResourceInfos
-
Enumerator<ResourceInfo> GetResourceInfos(ResourceInfo::Usage usage, uint64_t callIndex) const
Gets an Enumerator<> to all registered ResourceInfos for a specified ResourceInfo::Usage at a specified call index.
Note
Subsequent calls to this method invalidate outstanding Enumerator<> objects and Enumerator<>::Iterator objects
- Parameters
usage -- [in] The ResourceInfo::Usage to registered ReseourceInfos for
callIndex -- [in] The call index to get registered ResourceInfos for
- Returns
An Enumerator<> to all registered ResourceInfos for the specified ResourceInfo::Usage at the specified call index
-
introspection::ShaderInterface GetShaderInterface(ShaderInfo const &shaderInfo) const
Gets the introspectino::ShaderInterface for a given ShaderInfo.
- Parameters
shaderInfo -- [in] The ShaderInfo to get the introspection::ShaderInterface for
- Returns
The introspection::ShaderInterface for the given ShaderInfo
-
virtual bool GetShaderSource(ShaderInfo const &shaderInfo, api_types::ShaderLanguage language, gpa::api_types::ShaderSource &source) const
Gets the source code for a given ShaderInfo in a specified api_types::ShaderLanguage.
Note
If pSourceCode is null, pSourceCodeSize will be populated with the size in bytes of the source code including the null terminator
Note
If pSourceCode is not null, pSourceCodeSize will be used to determine the max number of bytes to write to pSourceCode
Note
If pSourceCode is not null and pSourceCodeSize is less than the size of the source code, a null terminator will not be appended
Note
If pSourceCodeSize and pSourceCode are both null, this method will return whether or not the specified api_types::ShaderLanguage is available for the given ShaderInfo
- Parameters
shaderInfo -- [in] The ShaderInfo to get source code for
language -- [in] The api_types::ShaderLanguage to get source code in
pSourceCodeSize -- [inout] The size in bytes of the source code including the null terminator
pSourceCode -- [out] A C str to populate with the source code of the given ShaderInfo in the specified api_types::ShaderLanguage
- Returns
Whether or not the specified api_types::ShaderLanguage is available for the given ShaderInfo
-
virtual serialization::StructDataManager GetResourceStructDataManager(ResourceInfo const *pResourceInfo) const
Gets the serialization::StructDataManager representation of the API specific creation structure for a given ResourceInfo.
- Parameters
pResourceInfo -- [in] A pointer to the ResourceInfo to get the serialization::StructDataManager for
- Returns
The serialization::StructDataManager representation of the API specific creation structure for the given ResourceInfo
-
virtual void GetResourceStructJson(ResourceInfo const *pResourceInfo, size_t *pJsonSize, char *pJson) const
Gets the JSON representation of the API specific creation structure for a given ResourceInfo.
Note
If pJson is null, pJsonSize will be populated with the size in bytes of the JSON including the null terminator
Note
If pJson is not null, pJsonSize will be used to determine the max number of bytes to write to pJson
Note
If pJson is not null and pJsonSize is less than the size of the JSON, a null terminator will not be appended
- Parameters
pResourceInfo -- [in] A pointer to the ResourceInfo to get the JSON for
pJsonSize -- [inout] The size in bytes of the JSON including the null terminator
pJson -- [out] A C str to populate with the JSON representation of the API specific creation structure for the given ResourceInfo
Protected Functions
-
MetadataExtractorEx(MetadataExtractorEx const&) = delete
-
MetadataExtractorEx &operator=(MetadataExtractorEx const&) = delete
Protected Attributes
-
detail::ResourceInfoRegistry mRegistry
-
mutable std::vector<api_types::ManagedShaderSource> mShaderSources
-
ExecutionCallbacks mExecutionCallbacks
-
MetadataExtractorEx() = default