mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-06 01:50:38 +00:00
Add a way to return basic information about all resources in a capture
* This provides a way to find the name of any resource besides 'special' resources like textures and buffers. In a follow-up commit, the names will be removed from their descriptors. * It also allows us to list which chunks in the structured file were used to initialise the resource, giving the ability to look up and display the initialisation parameters. * At the same time we also list the derived/parent resources to better allow the user to browse between related resources.
This commit is contained in:
@@ -147,6 +147,57 @@ struct TextureFilter
|
||||
|
||||
DECLARE_REFLECTION_STRUCT(TextureFilter);
|
||||
|
||||
DOCUMENT("A description of any type of resource.");
|
||||
struct ResourceDescription
|
||||
{
|
||||
DOCUMENT("The unique :class:`ResourceId` that identifies this resource.");
|
||||
ResourceId ID;
|
||||
|
||||
DOCUMENT("The :class:`ResourceType` of the resource.");
|
||||
ResourceType type = ResourceType::Unknown;
|
||||
|
||||
DOCUMENT(R"(``True`` if :data:`name` was just autogenerated based on the ID, not assigned a
|
||||
human-readable name by the application.
|
||||
)");
|
||||
bool autogeneratedName = true;
|
||||
|
||||
DOCUMENT("The name given to this resource.");
|
||||
rdcstr name;
|
||||
|
||||
DOCUMENT(R"(The chunk indices in the structured file that initialised this resource.
|
||||
|
||||
This will at least contain the first call that created it, but may contain other auxilliary calls.
|
||||
)");
|
||||
rdcarray<uint32_t> initialisationChunks;
|
||||
|
||||
DOCUMENT(R"(The :class:`ResourceId` of any derived resources, such as resource views or aliases.
|
||||
|
||||
Can be empty if there are no derived resources.
|
||||
|
||||
This is the inverse of :data:`parentResources` in a potentially many:many relationship, but
|
||||
typically it is one parent to many derived.
|
||||
)");
|
||||
rdcarray<ResourceId> derivedResources;
|
||||
|
||||
DOCUMENT(R"(The :class:`ResourceId` of parent resources, of which this is derived.
|
||||
|
||||
Can be empty if there are no parent resources.
|
||||
|
||||
This is the inverse of :data:derivedResources in a potentially many:many relationship, but
|
||||
typically it is one parent to many derived.
|
||||
)");
|
||||
rdcarray<ResourceId> parentResources;
|
||||
|
||||
DOCUMENT("Utility function for setting up a custom name to overwrite the auto-generated one.");
|
||||
inline void SetCustomName(const rdcstr &givenName)
|
||||
{
|
||||
autogeneratedName = false;
|
||||
name = givenName;
|
||||
}
|
||||
};
|
||||
|
||||
DECLARE_REFLECTION_STRUCT(ResourceDescription);
|
||||
|
||||
DOCUMENT("A description of a buffer resource.");
|
||||
struct BufferDescription
|
||||
{
|
||||
|
||||
@@ -800,19 +800,29 @@ understanding as well as the type and unit of the resulting information.
|
||||
)");
|
||||
virtual CounterDescription DescribeCounter(GPUCounter counterID) = 0;
|
||||
|
||||
DOCUMENT(R"(Retrieve the list of all resources in the capture.
|
||||
|
||||
This includes any object allocated a :class:`ResourceId`, that don't have any other state or
|
||||
are only used as intermediary elements.
|
||||
|
||||
:return: The list of resources in the capture.
|
||||
:rtype: ``list`` of :class:`ResourceDescription`
|
||||
)");
|
||||
virtual const rdcarray<ResourceDescription> &GetResources() = 0;
|
||||
|
||||
DOCUMENT(R"(Retrieve the list of textures alive in the capture.
|
||||
|
||||
:return: The list of textures in the capture.
|
||||
:rtype: ``list`` of :class:`TextureDescription`
|
||||
)");
|
||||
virtual rdcarray<TextureDescription> GetTextures() = 0;
|
||||
virtual const rdcarray<TextureDescription> &GetTextures() = 0;
|
||||
|
||||
DOCUMENT(R"(Retrieve the list of buffers alive in the capture.
|
||||
|
||||
:return: The list of buffers in the capture.
|
||||
:rtype: ``list`` of :class:`BufferDescription`
|
||||
)");
|
||||
virtual rdcarray<BufferDescription> GetBuffers() = 0;
|
||||
virtual const rdcarray<BufferDescription> &GetBuffers() = 0;
|
||||
|
||||
DOCUMENT(R"(Retrieve a list of any newly generated diagnostic messages.
|
||||
|
||||
|
||||
@@ -416,6 +416,33 @@ std::string DoStringise(const AddressMode &el)
|
||||
END_ENUM_STRINGISE();
|
||||
}
|
||||
|
||||
template <>
|
||||
std::string DoStringise(const ResourceType &el)
|
||||
{
|
||||
BEGIN_ENUM_STRINGISE(ResourceType)
|
||||
{
|
||||
STRINGISE_ENUM_CLASS(Unknown);
|
||||
STRINGISE_ENUM_CLASS(Device);
|
||||
STRINGISE_ENUM_CLASS(Queue);
|
||||
STRINGISE_ENUM_CLASS(CommandBuffer);
|
||||
STRINGISE_ENUM_CLASS(Texture);
|
||||
STRINGISE_ENUM_CLASS(Buffer);
|
||||
STRINGISE_ENUM_CLASS(View);
|
||||
STRINGISE_ENUM_CLASS(Sampler);
|
||||
STRINGISE_ENUM_CLASS(SwapchainImage);
|
||||
STRINGISE_ENUM_CLASS(Memory);
|
||||
STRINGISE_ENUM_CLASS(Shader);
|
||||
STRINGISE_ENUM_CLASS(ShaderBinding);
|
||||
STRINGISE_ENUM_CLASS(PipelineState);
|
||||
STRINGISE_ENUM_CLASS(StateObject);
|
||||
STRINGISE_ENUM_CLASS(RenderPass);
|
||||
STRINGISE_ENUM_CLASS(Query);
|
||||
STRINGISE_ENUM_CLASS(Sync);
|
||||
STRINGISE_ENUM_CLASS(Pool);
|
||||
}
|
||||
END_ENUM_STRINGISE();
|
||||
}
|
||||
|
||||
template <>
|
||||
std::string DoStringise(const TextureDim &el)
|
||||
{
|
||||
|
||||
@@ -252,6 +252,127 @@ enum class AddressMode : uint32_t
|
||||
|
||||
DECLARE_REFLECTION_ENUM(AddressMode);
|
||||
|
||||
DOCUMENT(R"(The type of a resource referred to by binding or API usage.
|
||||
|
||||
In some cases there is a little overlap or fudging when mapping API concepts - this is primarily
|
||||
just intended for e.g. fuzzy user filtering or rough categorisation. Precise mapping would require
|
||||
API-specific concepts.
|
||||
|
||||
.. data:: Unknown
|
||||
|
||||
An unknown type of resource.
|
||||
|
||||
.. data:: Device
|
||||
|
||||
A system-level object, typically unique.
|
||||
|
||||
.. data:: Queue
|
||||
|
||||
A queue representing the ability to execute commands in a single stream, possibly in parallel to
|
||||
other queues.
|
||||
|
||||
.. data:: CommandBuffer
|
||||
|
||||
A recorded set of commands that can then be subsequently executed.
|
||||
|
||||
.. data:: Texture
|
||||
|
||||
A texture - one- to three- dimensional, possibly with array layers and mip levels. See
|
||||
:class:`TextureDescription`.
|
||||
|
||||
.. data:: Buffer
|
||||
|
||||
A linear (possibly typed) view of memory. See :class:`BufferDescription`.
|
||||
|
||||
.. data:: View
|
||||
|
||||
A particular view into a texture or buffer, e.g. either accessing the underlying resource through
|
||||
a different type, or only a subset of the resource.
|
||||
|
||||
.. data:: Sampler
|
||||
|
||||
The information regarding how a texture is accessed including wrapping, minification/magnification
|
||||
and other information. The precise details are API-specific and listed in the API state when
|
||||
bound.
|
||||
|
||||
.. data:: SwapchainImage
|
||||
|
||||
A special class of :data:`Texture` that is owned by the swapchain and is used for presentation.
|
||||
|
||||
.. data:: Memory
|
||||
|
||||
An object corresponding to an actual memory allocation, which other resources can then be bound
|
||||
to.
|
||||
|
||||
.. data:: Shader
|
||||
|
||||
A single shader object for any shader stage. May be bound directly, or used to compose into a
|
||||
:data:`PipelineState` depending on the API.
|
||||
|
||||
.. data:: ShaderBinding
|
||||
|
||||
An object that determines some manner of shader binding. Since this varies significantly by API,
|
||||
different concepts used for shader resource binding fall under this type.
|
||||
|
||||
.. data:: PipelineState
|
||||
|
||||
A single object containing all information regarding the current GPU pipeline, containing both
|
||||
shader objects, potentially some shader binding information, and fixed-function state.
|
||||
|
||||
.. data:: StateObject
|
||||
|
||||
A single object encapsulating some amount of related state that can be set together, instead of
|
||||
setting each individual state separately.
|
||||
|
||||
.. data:: RenderPass
|
||||
|
||||
An object related to collecting render pass information together. This may not be an actual
|
||||
explicit render pass object if it doesn't exist in the API, it may also be a collection of
|
||||
textures in a framebuffer that are bound together to the API for rendering.
|
||||
|
||||
.. data:: Query
|
||||
|
||||
A query for retrieving some kind of feedback from the GPU, either as a fixed number or a boolean
|
||||
value which can be used in predicated rendering.
|
||||
|
||||
.. data:: Sync
|
||||
|
||||
A synchronisation object used for either synchronisation between GPU and CPU, or GPU-to-GPU work.
|
||||
|
||||
.. data:: Pool
|
||||
|
||||
An object which pools together other objects in an opaque way, either for runtime allocation and
|
||||
deallocation, or for caching purposes.
|
||||
)");
|
||||
enum class ResourceType : uint32_t
|
||||
{
|
||||
Unknown,
|
||||
|
||||
Device,
|
||||
Queue,
|
||||
CommandBuffer,
|
||||
|
||||
Texture,
|
||||
Buffer,
|
||||
View,
|
||||
Sampler,
|
||||
SwapchainImage,
|
||||
Memory,
|
||||
|
||||
Shader,
|
||||
ShaderBinding,
|
||||
PipelineState,
|
||||
|
||||
StateObject,
|
||||
RenderPass,
|
||||
|
||||
Query,
|
||||
Sync,
|
||||
Pool,
|
||||
};
|
||||
|
||||
DECLARE_REFLECTION_ENUM(ResourceType);
|
||||
|
||||
DOCUMENT(R"(The dimensionality of a texture binding.
|
||||
|
||||
.. data:: Unknown
|
||||
|
||||
@@ -55,6 +55,11 @@ public:
|
||||
|
||||
RefreshFile();
|
||||
|
||||
m_Resources.push_back(ResourceDescription());
|
||||
m_Resources[0].ID = m_TextureID;
|
||||
m_Resources[0].autogeneratedName = false;
|
||||
m_Resources[0].name = m_Filename;
|
||||
|
||||
m_PipelineState.m_OM.RenderTargets.resize(1);
|
||||
m_PipelineState.m_OM.RenderTargets[0].Resource = m_TextureID;
|
||||
}
|
||||
@@ -135,7 +140,8 @@ public:
|
||||
{
|
||||
return m_Proxy->ApplyCustomShader(shader, m_TextureID, mip, arrayIdx, sampleIdx, typeHint);
|
||||
}
|
||||
vector<ResourceId> GetTextures() { return {m_TextureID}; }
|
||||
const std::vector<ResourceDescription> &GetResources() { return m_Resources; }
|
||||
std::vector<ResourceId> GetTextures() { return {m_TextureID}; }
|
||||
TextureDescription GetTexture(ResourceId id) { return m_Proxy->GetTexture(m_TextureID); }
|
||||
void GetTextureData(ResourceId tex, uint32_t arrayIdx, uint32_t mip,
|
||||
const GetTextureDataParams ¶ms, bytebuf &data)
|
||||
@@ -153,7 +159,7 @@ public:
|
||||
void RenderMesh(uint32_t eventID, const vector<MeshFormat> &secondaryDraws, const MeshDisplay &cfg)
|
||||
{
|
||||
}
|
||||
vector<ResourceId> GetBuffers() { return vector<ResourceId>(); }
|
||||
std::vector<ResourceId> GetBuffers() { return vector<ResourceId>(); }
|
||||
vector<DebugMessage> GetDebugMessages() { return vector<DebugMessage>(); }
|
||||
BufferDescription GetBuffer(ResourceId id)
|
||||
{
|
||||
@@ -277,6 +283,7 @@ private:
|
||||
IReplayDriver *m_Proxy;
|
||||
string m_Filename;
|
||||
ResourceId m_TextureID;
|
||||
std::vector<ResourceDescription> m_Resources;
|
||||
SDFile m_File;
|
||||
TextureDescription m_TexDetails;
|
||||
};
|
||||
|
||||
@@ -261,6 +261,30 @@ std::vector<ResourceId> ReplayProxy::GetBuffers()
|
||||
PROXY_FUNCTION(GetBuffers);
|
||||
}
|
||||
|
||||
template <typename ParamSerialiser, typename ReturnSerialiser>
|
||||
const std::vector<ResourceDescription> &ReplayProxy::Proxied_GetResources(ParamSerialiser ¶mser,
|
||||
ReturnSerialiser &retser)
|
||||
{
|
||||
const ReplayProxyPacket packet = eReplayProxy_GetResources;
|
||||
|
||||
{
|
||||
BEGIN_PARAMS();
|
||||
END_PARAMS();
|
||||
}
|
||||
|
||||
if(paramser.IsReading() && !paramser.IsErrored() && !m_IsErrored)
|
||||
m_Resources = m_Remote->GetResources();
|
||||
|
||||
SERIALISE_RETURN(m_Resources);
|
||||
|
||||
return m_Resources;
|
||||
}
|
||||
|
||||
const std::vector<ResourceDescription> &ReplayProxy::GetResources()
|
||||
{
|
||||
PROXY_FUNCTION(GetResources);
|
||||
}
|
||||
|
||||
template <typename ParamSerialiser, typename ReturnSerialiser>
|
||||
BufferDescription ReplayProxy::Proxied_GetBuffer(ParamSerialiser ¶mser,
|
||||
ReturnSerialiser &retser, ResourceId id)
|
||||
@@ -1461,6 +1485,7 @@ bool ReplayProxy::Tick(int type)
|
||||
case eReplayProxy_FetchStructuredFile: FetchStructuredFile(); break;
|
||||
case eReplayProxy_GetAPIProperties: GetAPIProperties(); break;
|
||||
case eReplayProxy_GetPassEvents: GetPassEvents(0); break;
|
||||
case eReplayProxy_GetResources: GetResources(); break;
|
||||
case eReplayProxy_GetTextures: GetTextures(); break;
|
||||
case eReplayProxy_GetTexture: GetTexture(ResourceId()); break;
|
||||
case eReplayProxy_GetBuffers: GetBuffers(); break;
|
||||
|
||||
@@ -42,6 +42,7 @@ enum ReplayProxyPacket
|
||||
|
||||
eReplayProxy_GetPassEvents,
|
||||
|
||||
eReplayProxy_GetResources,
|
||||
eReplayProxy_GetTextures,
|
||||
eReplayProxy_GetTexture,
|
||||
eReplayProxy_GetBuffers,
|
||||
@@ -391,6 +392,8 @@ public:
|
||||
const SDFile &GetStructuredFile() { return m_StructuredFile; }
|
||||
IMPLEMENT_FUNCTION_PROXIED(void, FetchStructuredFile);
|
||||
|
||||
IMPLEMENT_FUNCTION_PROXIED(const std::vector<ResourceDescription> &, GetResources);
|
||||
|
||||
IMPLEMENT_FUNCTION_PROXIED(std::vector<ResourceId>, GetBuffers);
|
||||
IMPLEMENT_FUNCTION_PROXIED(BufferDescription, GetBuffer, ResourceId id);
|
||||
|
||||
@@ -559,6 +562,8 @@ private:
|
||||
|
||||
SDFile m_StructuredFile;
|
||||
|
||||
std::vector<ResourceDescription> m_Resources;
|
||||
|
||||
D3D11Pipe::State m_D3D11PipelineState;
|
||||
D3D12Pipe::State m_D3D12PipelineState;
|
||||
GLPipe::State m_GLPipelineState;
|
||||
|
||||
@@ -2184,7 +2184,7 @@ void WrappedID3D11Device::ReleaseResource(ID3D11DeviceChild *res)
|
||||
|
||||
SCOPED_LOCK(m_D3DLock);
|
||||
|
||||
ResourceType type = IdentifyTypeByPtr(res);
|
||||
D3D11ResourceType type = IdentifyTypeByPtr(res);
|
||||
|
||||
D3D11ResourceRecord *record = m_DeviceRecord;
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
|
||||
bool WrappedID3D11Device::Prepare_InitialState(ID3D11DeviceChild *res)
|
||||
{
|
||||
ResourceType type = IdentifyTypeByPtr(res);
|
||||
D3D11ResourceType type = IdentifyTypeByPtr(res);
|
||||
ResourceId Id = GetIDForResource(res);
|
||||
|
||||
RDCASSERT(IsCaptureMode(m_State));
|
||||
@@ -284,7 +284,7 @@ uint32_t WrappedID3D11Device::GetSize_InitialState(ResourceId id, ID3D11DeviceCh
|
||||
// pessimistic DepthPitch alignment
|
||||
const UINT WorstDepthPitchAlign = 256;
|
||||
|
||||
ResourceType type = IdentifyTypeByPtr(res);
|
||||
D3D11ResourceType type = IdentifyTypeByPtr(res);
|
||||
|
||||
if(type == Resource_UnorderedAccessView)
|
||||
{
|
||||
@@ -401,7 +401,7 @@ template <typename SerialiserType>
|
||||
bool WrappedID3D11Device::Serialise_InitialState(SerialiserType &ser, ResourceId resid,
|
||||
ID3D11DeviceChild *res)
|
||||
{
|
||||
ResourceType type = Resource_Unknown;
|
||||
D3D11ResourceType type = Resource_Unknown;
|
||||
ResourceId Id = ResourceId();
|
||||
|
||||
if(IsCaptureMode(m_State))
|
||||
@@ -937,7 +937,7 @@ void WrappedID3D11Device::Create_InitialState(ResourceId id, ID3D11DeviceChild *
|
||||
if(IsStructuredExporting(m_State))
|
||||
return;
|
||||
|
||||
ResourceType type = IdentifyTypeByPtr(live);
|
||||
D3D11ResourceType type = IdentifyTypeByPtr(live);
|
||||
|
||||
{
|
||||
RDCDEBUG("Create_InitialState(%llu)", id);
|
||||
|
||||
@@ -391,9 +391,28 @@ APIProperties D3D11Replay::GetAPIProperties()
|
||||
return ret;
|
||||
}
|
||||
|
||||
vector<ResourceId> D3D11Replay::GetBuffers()
|
||||
ResourceDescription &D3D11Replay::GetResourceDesc(ResourceId id)
|
||||
{
|
||||
vector<ResourceId> ret;
|
||||
auto it = m_ResourceIdx.find(id);
|
||||
if(it == m_ResourceIdx.end())
|
||||
{
|
||||
m_ResourceIdx[id] = m_Resources.size();
|
||||
m_Resources.push_back(ResourceDescription());
|
||||
m_Resources.back().ID = id;
|
||||
return m_Resources.back();
|
||||
}
|
||||
|
||||
return m_Resources[it->second];
|
||||
}
|
||||
|
||||
const std::vector<ResourceDescription> &D3D11Replay::GetResources()
|
||||
{
|
||||
return m_Resources;
|
||||
}
|
||||
|
||||
std::vector<ResourceId> D3D11Replay::GetBuffers()
|
||||
{
|
||||
std::vector<ResourceId> ret;
|
||||
|
||||
ret.reserve(WrappedID3D11Buffer::m_BufferList.size());
|
||||
|
||||
@@ -452,9 +471,9 @@ BufferDescription D3D11Replay::GetBuffer(ResourceId id)
|
||||
return ret;
|
||||
}
|
||||
|
||||
vector<ResourceId> D3D11Replay::GetTextures()
|
||||
std::vector<ResourceId> D3D11Replay::GetTextures()
|
||||
{
|
||||
vector<ResourceId> ret;
|
||||
std::vector<ResourceId> ret;
|
||||
|
||||
ret.reserve(WrappedID3D11Texture1D::m_TextureList.size() +
|
||||
WrappedID3D11Texture2D1::m_TextureList.size() +
|
||||
|
||||
@@ -48,10 +48,13 @@ public:
|
||||
void SetDevice(WrappedID3D11Device *d) { m_pDevice = d; }
|
||||
APIProperties GetAPIProperties();
|
||||
|
||||
vector<ResourceId> GetBuffers();
|
||||
ResourceDescription &GetResourceDesc(ResourceId id);
|
||||
const std::vector<ResourceDescription> &GetResources();
|
||||
|
||||
std::vector<ResourceId> GetBuffers();
|
||||
BufferDescription GetBuffer(ResourceId id);
|
||||
|
||||
vector<ResourceId> GetTextures();
|
||||
std::vector<ResourceId> GetTextures();
|
||||
TextureDescription GetTexture(ResourceId id);
|
||||
|
||||
vector<DebugMessage> GetDebugMessages();
|
||||
@@ -174,6 +177,9 @@ private:
|
||||
|
||||
WrappedID3D11Device *m_pDevice;
|
||||
|
||||
std::vector<ResourceDescription> m_Resources;
|
||||
std::map<ResourceId, size_t> m_ResourceIdx;
|
||||
|
||||
D3D11Pipe::State m_CurPipelineState;
|
||||
D3D12Pipe::State m_D3D12State;
|
||||
VKPipe::State m_VKState;
|
||||
|
||||
@@ -349,7 +349,7 @@ ResourceId GetIDForDeviceChild(ID3D11DeviceChild *ptr)
|
||||
return ResourceId();
|
||||
}
|
||||
|
||||
ResourceType IdentifyTypeByPtr(IUnknown *ptr)
|
||||
D3D11ResourceType IdentifyTypeByPtr(IUnknown *ptr)
|
||||
{
|
||||
if(WrappedID3D11InputLayout::IsAlloc(ptr))
|
||||
return Resource_InputLayout;
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
#include "driver/d3d11/d3d11_manager.h"
|
||||
#include "driver/shaders/dxbc/dxbc_inspect.h"
|
||||
|
||||
enum ResourceType
|
||||
enum D3D11ResourceType
|
||||
{
|
||||
Resource_Unknown = 0,
|
||||
Resource_InputLayout,
|
||||
@@ -60,9 +60,9 @@ enum ResourceType
|
||||
Resource_DeviceState,
|
||||
};
|
||||
|
||||
DECLARE_REFLECTION_ENUM(ResourceType);
|
||||
DECLARE_REFLECTION_ENUM(D3D11ResourceType);
|
||||
|
||||
ResourceType IdentifyTypeByPtr(IUnknown *ptr);
|
||||
D3D11ResourceType IdentifyTypeByPtr(IUnknown *ptr);
|
||||
ResourceId GetIDForDeviceChild(ID3D11DeviceChild *ptr);
|
||||
template <typename T>
|
||||
inline ResourceId GetIDForResource(T *ptr);
|
||||
|
||||
@@ -27,9 +27,9 @@
|
||||
#include "d3d11_resources.h"
|
||||
|
||||
template <>
|
||||
std::string DoStringise(const ResourceType &el)
|
||||
std::string DoStringise(const D3D11ResourceType &el)
|
||||
{
|
||||
BEGIN_ENUM_STRINGISE(ResourceType);
|
||||
BEGIN_ENUM_STRINGISE(D3D11ResourceType);
|
||||
{
|
||||
STRINGISE_ENUM(Resource_InputLayout)
|
||||
STRINGISE_ENUM(Resource_Buffer)
|
||||
|
||||
@@ -86,9 +86,28 @@ const SDFile &D3D12Replay::GetStructuredFile()
|
||||
return m_pDevice->GetStructuredFile();
|
||||
}
|
||||
|
||||
vector<ResourceId> D3D12Replay::GetBuffers()
|
||||
ResourceDescription &D3D12Replay::GetResourceDesc(ResourceId id)
|
||||
{
|
||||
vector<ResourceId> ret;
|
||||
auto it = m_ResourceIdx.find(id);
|
||||
if(it == m_ResourceIdx.end())
|
||||
{
|
||||
m_ResourceIdx[id] = m_Resources.size();
|
||||
m_Resources.push_back(ResourceDescription());
|
||||
m_Resources.back().ID = id;
|
||||
return m_Resources.back();
|
||||
}
|
||||
|
||||
return m_Resources[it->second];
|
||||
}
|
||||
|
||||
const std::vector<ResourceDescription> &D3D12Replay::GetResources()
|
||||
{
|
||||
return m_Resources;
|
||||
}
|
||||
|
||||
std::vector<ResourceId> D3D12Replay::GetBuffers()
|
||||
{
|
||||
std::vector<ResourceId> ret;
|
||||
|
||||
for(auto it = WrappedID3D12Resource::GetList().begin();
|
||||
it != WrappedID3D12Resource::GetList().end(); it++)
|
||||
@@ -98,9 +117,9 @@ vector<ResourceId> D3D12Replay::GetBuffers()
|
||||
return ret;
|
||||
}
|
||||
|
||||
vector<ResourceId> D3D12Replay::GetTextures()
|
||||
std::vector<ResourceId> D3D12Replay::GetTextures()
|
||||
{
|
||||
vector<ResourceId> ret;
|
||||
std::vector<ResourceId> ret;
|
||||
|
||||
for(auto it = WrappedID3D12Resource::GetList().begin();
|
||||
it != WrappedID3D12Resource::GetList().end(); it++)
|
||||
|
||||
@@ -46,10 +46,13 @@ public:
|
||||
void SetDevice(WrappedID3D12Device *d) { m_pDevice = d; }
|
||||
APIProperties GetAPIProperties();
|
||||
|
||||
vector<ResourceId> GetBuffers();
|
||||
ResourceDescription &GetResourceDesc(ResourceId id);
|
||||
const std::vector<ResourceDescription> &GetResources();
|
||||
|
||||
std::vector<ResourceId> GetBuffers();
|
||||
BufferDescription GetBuffer(ResourceId id);
|
||||
|
||||
vector<ResourceId> GetTextures();
|
||||
std::vector<ResourceId> GetTextures();
|
||||
TextureDescription GetTexture(ResourceId id);
|
||||
|
||||
vector<DebugMessage> GetDebugMessages();
|
||||
@@ -184,6 +187,9 @@ private:
|
||||
|
||||
vector<ID3D12Resource *> m_ProxyResources;
|
||||
|
||||
std::vector<ResourceDescription> m_Resources;
|
||||
std::map<ResourceId, size_t> m_ResourceIdx;
|
||||
|
||||
D3D12Pipe::State m_PipelineState;
|
||||
D3D11Pipe::State m_D3D11State;
|
||||
VKPipe::State m_VKState;
|
||||
|
||||
@@ -145,9 +145,9 @@ APIProperties GLReplay::GetAPIProperties()
|
||||
return ret;
|
||||
}
|
||||
|
||||
vector<ResourceId> GLReplay::GetBuffers()
|
||||
std::vector<ResourceId> GLReplay::GetBuffers()
|
||||
{
|
||||
vector<ResourceId> ret;
|
||||
std::vector<ResourceId> ret;
|
||||
|
||||
for(auto it = m_pDriver->m_Buffers.begin(); it != m_pDriver->m_Buffers.end(); ++it)
|
||||
{
|
||||
@@ -161,9 +161,28 @@ vector<ResourceId> GLReplay::GetBuffers()
|
||||
return ret;
|
||||
}
|
||||
|
||||
vector<ResourceId> GLReplay::GetTextures()
|
||||
ResourceDescription &GLReplay::GetResourceDesc(ResourceId id)
|
||||
{
|
||||
vector<ResourceId> ret;
|
||||
auto it = m_ResourceIdx.find(id);
|
||||
if(it == m_ResourceIdx.end())
|
||||
{
|
||||
m_ResourceIdx[id] = m_Resources.size();
|
||||
m_Resources.push_back(ResourceDescription());
|
||||
m_Resources.back().ID = id;
|
||||
return m_Resources.back();
|
||||
}
|
||||
|
||||
return m_Resources[it->second];
|
||||
}
|
||||
|
||||
const std::vector<ResourceDescription> &GLReplay::GetResources()
|
||||
{
|
||||
return m_Resources;
|
||||
}
|
||||
|
||||
std::vector<ResourceId> GLReplay::GetTextures()
|
||||
{
|
||||
std::vector<ResourceId> ret;
|
||||
ret.reserve(m_pDriver->m_Textures.size());
|
||||
|
||||
for(auto it = m_pDriver->m_Textures.begin(); it != m_pDriver->m_Textures.end(); ++it)
|
||||
|
||||
@@ -93,10 +93,13 @@ public:
|
||||
void SetDriver(WrappedOpenGL *d) { m_pDriver = d; }
|
||||
APIProperties GetAPIProperties();
|
||||
|
||||
vector<ResourceId> GetBuffers();
|
||||
ResourceDescription &GetResourceDesc(ResourceId id);
|
||||
const std::vector<ResourceDescription> &GetResources();
|
||||
|
||||
std::vector<ResourceId> GetBuffers();
|
||||
BufferDescription GetBuffer(ResourceId id);
|
||||
|
||||
vector<ResourceId> GetTextures();
|
||||
std::vector<ResourceId> GetTextures();
|
||||
TextureDescription GetTexture(ResourceId id);
|
||||
ShaderReflection *GetShader(ResourceId shader, string entryPoint);
|
||||
|
||||
@@ -412,6 +415,9 @@ private:
|
||||
|
||||
WrappedOpenGL *m_pDriver;
|
||||
|
||||
std::vector<ResourceDescription> m_Resources;
|
||||
std::map<ResourceId, size_t> m_ResourceIdx;
|
||||
|
||||
GLPipe::State m_CurPipelineState;
|
||||
D3D11Pipe::State m_D3D11State;
|
||||
D3D12Pipe::State m_D3D12State;
|
||||
|
||||
@@ -750,9 +750,28 @@ vector<DebugMessage> VulkanReplay::GetDebugMessages()
|
||||
return m_pDriver->GetDebugMessages();
|
||||
}
|
||||
|
||||
vector<ResourceId> VulkanReplay::GetTextures()
|
||||
ResourceDescription &VulkanReplay::GetResourceDesc(ResourceId id)
|
||||
{
|
||||
vector<ResourceId> texs;
|
||||
auto it = m_ResourceIdx.find(id);
|
||||
if(it == m_ResourceIdx.end())
|
||||
{
|
||||
m_ResourceIdx[id] = m_Resources.size();
|
||||
m_Resources.push_back(ResourceDescription());
|
||||
m_Resources.back().ID = id;
|
||||
return m_Resources.back();
|
||||
}
|
||||
|
||||
return m_Resources[it->second];
|
||||
}
|
||||
|
||||
const std::vector<ResourceDescription> &VulkanReplay::GetResources()
|
||||
{
|
||||
return m_Resources;
|
||||
}
|
||||
|
||||
std::vector<ResourceId> VulkanReplay::GetTextures()
|
||||
{
|
||||
std::vector<ResourceId> texs;
|
||||
|
||||
for(auto it = m_pDriver->m_ImageLayouts.begin(); it != m_pDriver->m_ImageLayouts.end(); ++it)
|
||||
{
|
||||
@@ -766,9 +785,9 @@ vector<ResourceId> VulkanReplay::GetTextures()
|
||||
return texs;
|
||||
}
|
||||
|
||||
vector<ResourceId> VulkanReplay::GetBuffers()
|
||||
std::vector<ResourceId> VulkanReplay::GetBuffers()
|
||||
{
|
||||
vector<ResourceId> bufs;
|
||||
std::vector<ResourceId> bufs;
|
||||
|
||||
for(auto it = m_pDriver->m_CreationInfo.m_Buffer.begin();
|
||||
it != m_pDriver->m_CreationInfo.m_Buffer.end(); ++it)
|
||||
|
||||
@@ -136,10 +136,13 @@ public:
|
||||
void SetDriver(WrappedVulkan *d) { m_pDriver = d; }
|
||||
APIProperties GetAPIProperties();
|
||||
|
||||
vector<ResourceId> GetBuffers();
|
||||
ResourceDescription &GetResourceDesc(ResourceId id);
|
||||
const std::vector<ResourceDescription> &GetResources();
|
||||
|
||||
std::vector<ResourceId> GetBuffers();
|
||||
BufferDescription GetBuffer(ResourceId id);
|
||||
|
||||
vector<ResourceId> GetTextures();
|
||||
std::vector<ResourceId> GetTextures();
|
||||
TextureDescription GetTexture(ResourceId id);
|
||||
|
||||
ShaderReflection *GetShader(ResourceId shader, string entryPoint);
|
||||
@@ -321,6 +324,9 @@ private:
|
||||
VulkanResourceManager *m_ResourceManager;
|
||||
};
|
||||
|
||||
std::vector<ResourceDescription> m_Resources;
|
||||
std::map<ResourceId, size_t> m_ResourceIdx;
|
||||
|
||||
VKPipe::State m_VulkanPipelineState;
|
||||
D3D11Pipe::State m_D3D11State;
|
||||
D3D12Pipe::State m_D3D12State;
|
||||
|
||||
@@ -323,6 +323,20 @@ void DoSerialise(SerialiserType &ser, TextureFilter &el)
|
||||
SIZE_CHECK(16);
|
||||
}
|
||||
|
||||
template <typename SerialiserType>
|
||||
void DoSerialise(SerialiserType &ser, ResourceDescription &el)
|
||||
{
|
||||
SERIALISE_MEMBER(ID);
|
||||
SERIALISE_MEMBER(type);
|
||||
SERIALISE_MEMBER(name);
|
||||
SERIALISE_MEMBER(autogeneratedName);
|
||||
SERIALISE_MEMBER(initialisationChunks);
|
||||
SERIALISE_MEMBER(derivedResources);
|
||||
SERIALISE_MEMBER(parentResources);
|
||||
|
||||
SIZE_CHECK(80);
|
||||
}
|
||||
|
||||
template <typename SerialiserType>
|
||||
void DoSerialise(SerialiserType &ser, TextureDescription &el)
|
||||
{
|
||||
@@ -2202,6 +2216,7 @@ INSTANTIATE_SERIALISE_TYPE(ShaderReflection)
|
||||
INSTANTIATE_SERIALISE_TYPE(ShaderVariable)
|
||||
INSTANTIATE_SERIALISE_TYPE(ShaderDebugState)
|
||||
INSTANTIATE_SERIALISE_TYPE(ShaderDebugTrace)
|
||||
INSTANTIATE_SERIALISE_TYPE(ResourceDescription)
|
||||
INSTANTIATE_SERIALISE_TYPE(TextureDescription)
|
||||
INSTANTIATE_SERIALISE_TYPE(BufferDescription)
|
||||
INSTANTIATE_SERIALISE_TYPE(APIProperties)
|
||||
|
||||
@@ -293,33 +293,18 @@ CounterDescription ReplayController::DescribeCounter(GPUCounter counterID)
|
||||
return m_pDevice->DescribeCounter(counterID);
|
||||
}
|
||||
|
||||
rdcarray<BufferDescription> ReplayController::GetBuffers()
|
||||
const rdcarray<ResourceDescription> &ReplayController::GetResources()
|
||||
{
|
||||
if(m_Buffers.empty())
|
||||
{
|
||||
vector<ResourceId> ids = m_pDevice->GetBuffers();
|
||||
|
||||
m_Buffers.resize(ids.size());
|
||||
|
||||
for(size_t i = 0; i < ids.size(); i++)
|
||||
m_Buffers[i] = m_pDevice->GetBuffer(ids[i]);
|
||||
}
|
||||
return m_Resources;
|
||||
}
|
||||
|
||||
const rdcarray<BufferDescription> &ReplayController::GetBuffers()
|
||||
{
|
||||
return m_Buffers;
|
||||
}
|
||||
|
||||
rdcarray<TextureDescription> ReplayController::GetTextures()
|
||||
const rdcarray<TextureDescription> &ReplayController::GetTextures()
|
||||
{
|
||||
if(m_Textures.empty())
|
||||
{
|
||||
vector<ResourceId> ids = m_pDevice->GetTextures();
|
||||
|
||||
m_Textures.resize(ids.size());
|
||||
|
||||
for(size_t i = 0; i < ids.size(); i++)
|
||||
m_Textures[i] = m_pDevice->GetTexture(ids[i]);
|
||||
}
|
||||
|
||||
return m_Textures;
|
||||
}
|
||||
|
||||
@@ -1564,6 +1549,26 @@ ReplayStatus ReplayController::PostCreateInit(IReplayDriver *device, RDCFile *rd
|
||||
|
||||
FetchPipelineState();
|
||||
|
||||
{
|
||||
std::vector<ResourceId> ids = m_pDevice->GetBuffers();
|
||||
|
||||
m_Buffers.resize(ids.size());
|
||||
|
||||
for(size_t i = 0; i < ids.size(); i++)
|
||||
m_Buffers[i] = m_pDevice->GetBuffer(ids[i]);
|
||||
}
|
||||
|
||||
{
|
||||
std::vector<ResourceId> ids = m_pDevice->GetTextures();
|
||||
|
||||
m_Textures.resize(ids.size());
|
||||
|
||||
for(size_t i = 0; i < ids.size(); i++)
|
||||
m_Textures[i] = m_pDevice->GetTexture(ids[i]);
|
||||
}
|
||||
|
||||
m_Resources = m_pDevice->GetResources();
|
||||
|
||||
m_FrameRecord = m_pDevice->GetFrameRecord();
|
||||
|
||||
DrawcallDescription *previous = NULL;
|
||||
|
||||
@@ -162,8 +162,9 @@ public:
|
||||
rdcarray<CounterResult> FetchCounters(const rdcarray<GPUCounter> &counters);
|
||||
rdcarray<GPUCounter> EnumerateCounters();
|
||||
CounterDescription DescribeCounter(GPUCounter counterID);
|
||||
rdcarray<TextureDescription> GetTextures();
|
||||
rdcarray<BufferDescription> GetBuffers();
|
||||
const rdcarray<TextureDescription> &GetTextures();
|
||||
const rdcarray<BufferDescription> &GetBuffers();
|
||||
const rdcarray<ResourceDescription> &GetResources();
|
||||
rdcarray<DebugMessage> GetDebugMessages();
|
||||
|
||||
rdcarray<PixelModification> PixelHistory(ResourceId target, uint32_t x, uint32_t y, uint32_t slice,
|
||||
@@ -218,8 +219,9 @@ private:
|
||||
|
||||
std::vector<ReplayOutput *> m_Outputs;
|
||||
|
||||
std::vector<BufferDescription> m_Buffers;
|
||||
std::vector<TextureDescription> m_Textures;
|
||||
rdcarray<ResourceDescription> m_Resources;
|
||||
rdcarray<BufferDescription> m_Buffers;
|
||||
rdcarray<TextureDescription> m_Textures;
|
||||
|
||||
IReplayDriver *m_pDevice;
|
||||
|
||||
|
||||
@@ -90,10 +90,12 @@ public:
|
||||
|
||||
virtual APIProperties GetAPIProperties() = 0;
|
||||
|
||||
virtual vector<ResourceId> GetBuffers() = 0;
|
||||
virtual const std::vector<ResourceDescription> &GetResources() = 0;
|
||||
|
||||
virtual std::vector<ResourceId> GetBuffers() = 0;
|
||||
virtual BufferDescription GetBuffer(ResourceId id) = 0;
|
||||
|
||||
virtual vector<ResourceId> GetTextures() = 0;
|
||||
virtual std::vector<ResourceId> GetTextures() = 0;
|
||||
virtual TextureDescription GetTexture(ResourceId id) = 0;
|
||||
|
||||
virtual vector<DebugMessage> GetDebugMessages() = 0;
|
||||
|
||||
Reference in New Issue
Block a user