mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-05 01:20:42 +00:00
Add UUIDs to counter descriptors to allow uniquely identifiying them.
For built-in types, use a hard-coded GUID and just modify the last 32-bits; for the AMD counters, we just hash the description/name for now.
This commit is contained in:
committed by
baldurk
parent
72ef43b969
commit
cb84ff695e
@@ -878,7 +878,7 @@ with software rendering, or with some functionality disabled due to lack of supp
|
||||
|
||||
DECLARE_REFLECTION_STRUCT(APIProperties);
|
||||
|
||||
DOCUMENT("A 128-bit Uuid.")
|
||||
DOCUMENT("A 128-bit Uuid.");
|
||||
struct Uuid
|
||||
{
|
||||
Uuid(uint32_t a, uint32_t b, uint32_t c, uint32_t d)
|
||||
@@ -890,6 +890,14 @@ struct Uuid
|
||||
}
|
||||
|
||||
Uuid() { bytes[0] = bytes[1] = bytes[2] = bytes[3] = 0; }
|
||||
DOCUMENT("Compares two ``Uuid`` objects for less-than.");
|
||||
bool operator<(const Uuid &rhs) const
|
||||
{
|
||||
return std::lexicographical_compare(bytes, bytes + 4, rhs.bytes, rhs.bytes + 4);
|
||||
}
|
||||
|
||||
DOCUMENT("Compares two ``Uuid`` objects for equality.");
|
||||
bool operator==(const Uuid &rhs) const { return ::memcmp(bytes, rhs.bytes, sizeof(bytes)) == 0; }
|
||||
DOCUMENT("The Uuid bytes.")
|
||||
uint32_t bytes[4];
|
||||
};
|
||||
@@ -921,6 +929,9 @@ struct CounterDescription
|
||||
|
||||
DOCUMENT("The :class:`CounterUnit` for the result value.");
|
||||
CounterUnit unit;
|
||||
|
||||
DOCUMENT("The :class:`Uuid` of this counter, which uniquely identifies it.");
|
||||
Uuid uuid;
|
||||
};
|
||||
|
||||
DECLARE_REFLECTION_STRUCT(CounterDescription);
|
||||
|
||||
@@ -1602,8 +1602,9 @@ void Serialiser::Serialise(const char *name, CounterDescription &el)
|
||||
Serialise("", el.resultByteWidth);
|
||||
Serialise("", el.unit);
|
||||
Serialise("", el.category);
|
||||
Serialise("", el.uuid);
|
||||
|
||||
SIZE_CHECK(72);
|
||||
SIZE_CHECK(88);
|
||||
}
|
||||
|
||||
template <>
|
||||
|
||||
@@ -90,6 +90,12 @@ void D3D11DebugManager::DescribeCounter(GPUCounter counterID, CounterDescription
|
||||
}
|
||||
}
|
||||
|
||||
// 448A0516-B50E-4312-A6DC-CFE7222FC1AC
|
||||
desc.uuid.bytes[0] = 0x448A0516;
|
||||
desc.uuid.bytes[1] = 0xB50E4312;
|
||||
desc.uuid.bytes[2] = 0xA6DCCFE7;
|
||||
desc.uuid.bytes[3] = 0x222FC1AC ^ (uint32_t)counterID;
|
||||
|
||||
desc.category = "D3D11";
|
||||
|
||||
switch(counterID)
|
||||
|
||||
@@ -66,6 +66,11 @@ vector<GPUCounter> D3D12Replay::EnumerateCounters()
|
||||
void D3D12Replay::DescribeCounter(GPUCounter counterID, CounterDescription &desc)
|
||||
{
|
||||
desc.counterID = counterID;
|
||||
// 0808CC9B-79DF-4549-81F7-85494E648F22
|
||||
desc.uuid.bytes[0] = 0x0808CC9B;
|
||||
desc.uuid.bytes[1] = 0x79DF4549;
|
||||
desc.uuid.bytes[2] = 0x81F78549;
|
||||
desc.uuid.bytes[3] = 0x4E648F22 ^ (uint32_t)counterID;
|
||||
|
||||
switch(counterID)
|
||||
{
|
||||
|
||||
@@ -66,6 +66,11 @@ vector<GPUCounter> GLReplay::EnumerateCounters()
|
||||
void GLReplay::DescribeCounter(GPUCounter counterID, CounterDescription &desc)
|
||||
{
|
||||
desc.counterID = counterID;
|
||||
// FFBA5548-FBF8-405D-BA18-F0329DA370A0
|
||||
desc.uuid.bytes[0] = 0xFFBA5548;
|
||||
desc.uuid.bytes[1] = 0xFBF8405D;
|
||||
desc.uuid.bytes[2] = 0xBA18F032;
|
||||
desc.uuid.bytes[3] = 0x9DA370A0 ^ (uint32_t)counterID;
|
||||
|
||||
switch(counterID)
|
||||
{
|
||||
|
||||
@@ -28,6 +28,8 @@
|
||||
#include "official/GPUPerfAPI/Include/GPUPerfAPI.h"
|
||||
#include "official/GPUPerfAPI/Include/GPUPerfAPIFunctionTypes.h"
|
||||
|
||||
#include "serialise/string_utils.h"
|
||||
|
||||
typedef GPA_Status(__stdcall *PFN_GPA_INITIALIZE)();
|
||||
typedef GPA_Status(__stdcall *PFN_GPA_OPENCONTEXT)(void *pContext);
|
||||
typedef GPA_Status(__stdcall *PFN_GPA_GET_NUM_COUNTERS)(gpa_uint32 *pCount);
|
||||
@@ -343,6 +345,12 @@ CounterDescription AMDCounters::InternalGetCounterDescription(uint32_t internalI
|
||||
default: desc.resultType = CompType::UInt; desc.resultByteWidth = sizeof(uint32_t);
|
||||
}
|
||||
|
||||
// C8958C90-B706-4F22-8AF5-E0A3831B2C39
|
||||
desc.uuid.bytes[0] = 0xC8958C90;
|
||||
desc.uuid.bytes[1] = 0xB7064F22;
|
||||
desc.uuid.bytes[2] = 0x8AF5E0A3 ^ strhash(desc.name.c_str());
|
||||
desc.uuid.bytes[3] = 0x831B2C39 ^ strhash(desc.description.c_str());
|
||||
|
||||
return desc;
|
||||
}
|
||||
|
||||
|
||||
@@ -77,6 +77,11 @@ vector<GPUCounter> VulkanReplay::EnumerateCounters()
|
||||
void VulkanReplay::DescribeCounter(GPUCounter counterID, CounterDescription &desc)
|
||||
{
|
||||
desc.counterID = counterID;
|
||||
// 6839CB5B-FBD2-4550-B606-8C65157C684C
|
||||
desc.uuid.bytes[0] = 0x6839CB5B;
|
||||
desc.uuid.bytes[1] = 0xFBD24550;
|
||||
desc.uuid.bytes[2] = 0xB6068C65;
|
||||
desc.uuid.bytes[3] = 0x157C684C ^ (uint32_t)counterID;
|
||||
|
||||
switch(counterID)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user