mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-07-30 11:21:01 +00:00
Add a GUID for the shader debug info that is required in a PRIV section
This commit is contained in:
@@ -39,7 +39,21 @@
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Constants not used directly in below API
|
||||
|
||||
// This is a GUID/magic value used for when applications pass a path where shader debug
|
||||
// information can be found to match up with a stripped shader.
|
||||
// the define can be used like so: const GUID RENDERDOC_ShaderDebugMagicValue = RENDERDOC_ShaderDebugMagicValue_value
|
||||
#define RENDERDOC_ShaderDebugMagicValue_struct { 0xeab25520, 0x6670, 0x4865, 0x84, 0x29, 0x6c, 0x8, 0x51, 0x54, 0x00, 0xff }
|
||||
|
||||
// as an alternative when you want a byte array (assuming x86 endianness):
|
||||
#define RENDERDOC_ShaderDebugMagicValue_bytearray { 0x20, 0x55, 0xb2, 0xea, 0x70, 0x66, 0x65, 0x48, 0x84, 0x29, 0x6c, 0x8, 0x51, 0x54, 0x00, 0xff }
|
||||
|
||||
// truncated version when only a uint64_t is available (e.g. Vulkan tags):
|
||||
#define RENDERDOC_ShaderDebugMagicValue_truncated 0x48656670eab25520ULL
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// RenderDoc capture options
|
||||
//
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#include "common/common.h"
|
||||
#include "serialise/serialiser.h"
|
||||
#include "serialise/string_utils.h"
|
||||
#include "api/app/renderdoc_app.h"
|
||||
#include "dxbc_inspect.h"
|
||||
#include "dxbc_sdbg.h"
|
||||
#include "dxbc_spdb.h"
|
||||
@@ -160,10 +161,19 @@ struct PRIVHeader
|
||||
{
|
||||
uint32_t fourcc; // "PRIV"
|
||||
uint32_t chunkLength; // length of this chunk
|
||||
|
||||
GUID debugInfoGUID; // GUID/magic number, since PRIV data could be used for something else.
|
||||
// Set to the value of RENDERDOC_ShaderDebugMagicValue from
|
||||
// renderdoc_app.h which can also be used as a GUID to set the path
|
||||
// at runtime via SetPrivateData (see documentation)
|
||||
|
||||
static const GUID RENDERDOC_ShaderDebugMagicValue;
|
||||
|
||||
void* data;
|
||||
};
|
||||
|
||||
const GUID PRIVHeader::RENDERDOC_ShaderDebugMagicValue = RENDERDOC_ShaderDebugMagicValue_struct;
|
||||
|
||||
struct SIGNElement
|
||||
{
|
||||
uint32_t nameOffset; // relative to the same offset base position as others in similar chunks - after FourCC and chunk length.
|
||||
@@ -517,14 +527,17 @@ string DXBCFile::GetDebugBinaryPath(const void *ByteCode, size_t ByteCodeLength)
|
||||
if(*fourcc == FOURCC_PRIV)
|
||||
{
|
||||
PRIVHeader *privHeader = (PRIVHeader *)fourcc;
|
||||
const char* pathData = (char*)&privHeader->data;
|
||||
size_t pathLength = strnlen(pathData, privHeader->chunkLength);
|
||||
|
||||
if(privHeader->chunkLength == (pathLength + 1))
|
||||
if(privHeader->debugInfoGUID == PRIVHeader::RENDERDOC_ShaderDebugMagicValue)
|
||||
{
|
||||
debugPath.append(pathData, pathData + pathLength);
|
||||
return debugPath;
|
||||
}
|
||||
const char* pathData = (char*)&privHeader->data;
|
||||
size_t pathLength = strnlen(pathData, privHeader->chunkLength);
|
||||
|
||||
if(privHeader->chunkLength == (sizeof(GUID) + pathLength + 1))
|
||||
{
|
||||
debugPath.append(pathData, pathData + pathLength);
|
||||
return debugPath;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user