mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-09-23 14:15:42 +00:00
Pass vulkan shader modules into DisassembleSPIRV
This commit is contained in:
@@ -51,7 +51,7 @@ void WrappedOpenGL::ShaderData::Compile(const GLHookSet &gl)
|
||||
|
||||
string s = CompileSPIRV(SPIRVShaderStage(ShaderIdx(type)), sources, spirv);
|
||||
if(!spirv.empty())
|
||||
DisassembleSPIRV(SPIRVShaderStage(ShaderIdx(type)), spirv, s);
|
||||
DisassembleSPIRV(SPIRVShaderStage(ShaderIdx(type)), &spirv.front(), spirv.size(), s);
|
||||
|
||||
reflection.Disassembly = s;
|
||||
|
||||
|
||||
@@ -37,6 +37,7 @@ enum SPIRVShaderStage
|
||||
eSPIRVGeometry,
|
||||
eSPIRVFragment,
|
||||
eSPIRVCompute,
|
||||
eSPIRVGeneric,
|
||||
eSPIRVInvalid,
|
||||
};
|
||||
|
||||
@@ -44,4 +45,4 @@ void InitSPIRVCompiler();
|
||||
void ShutdownSPIRVCompiler();
|
||||
|
||||
string CompileSPIRV(SPIRVShaderStage shadType, const vector<string> &sources, vector<uint32_t> &spirv);
|
||||
void DisassembleSPIRV(SPIRVShaderStage shadType, const vector<uint32_t> &spirv, string &disasm);
|
||||
void DisassembleSPIRV(SPIRVShaderStage shadType, uint32_t *spirv, size_t spirvLength, string &disasm);
|
||||
|
||||
@@ -862,6 +862,7 @@ struct SPVModule
|
||||
"Geometry Shader",
|
||||
"Fragment Shader",
|
||||
"Compute Shader",
|
||||
"Unknown Shader Target",
|
||||
};
|
||||
|
||||
disasm = header[(int)shadType];
|
||||
@@ -1410,7 +1411,7 @@ struct SPVModule
|
||||
}
|
||||
};
|
||||
|
||||
void DisassembleSPIRV(SPIRVShaderStage shadType, const vector<uint32_t> &spirv, string &disasm)
|
||||
void DisassembleSPIRV(SPIRVShaderStage shadType, uint32_t *spirv, size_t spirvLength, string &disasm)
|
||||
{
|
||||
#if 1
|
||||
return;
|
||||
@@ -1440,7 +1441,7 @@ void DisassembleSPIRV(SPIRVShaderStage shadType, const vector<uint32_t> &spirv,
|
||||
SPVBlock *curBlock = NULL;
|
||||
|
||||
size_t it = 5;
|
||||
while(it < spirv.size())
|
||||
while(it < spirvLength)
|
||||
{
|
||||
uint16_t WordCount = spirv[it]>>16;
|
||||
|
||||
@@ -2062,7 +2063,7 @@ void DisassembleSPIRV(SPIRVShaderStage shadType, const vector<uint32_t> &spirv,
|
||||
|
||||
// second pass now that we have all ids set up, apply decorations/names/etc
|
||||
it = 5;
|
||||
while(it < spirv.size())
|
||||
while(it < spirvLength)
|
||||
{
|
||||
uint16_t WordCount = spirv[it]>>16;
|
||||
spv::Op op = spv::Op(spirv[it]&0xffff);
|
||||
|
||||
@@ -24,6 +24,8 @@
|
||||
|
||||
#include "../vk_core.h"
|
||||
|
||||
#include "driver/shaders/spirv/spirv_common.h"
|
||||
|
||||
// Shader functions
|
||||
bool WrappedVulkan::Serialise_vkCreatePipelineLayout(
|
||||
VkDevice device,
|
||||
@@ -131,6 +133,10 @@ bool WrappedVulkan::Serialise_vkCreateShaderModule(
|
||||
{
|
||||
ResourceId live = GetResourceManager()->WrapResource(Unwrap(device), sh);
|
||||
GetResourceManager()->AddLiveResource(id, sh);
|
||||
|
||||
string disasm;
|
||||
RDCASSERT(info.codeSize % sizeof(uint32_t) == 0);
|
||||
DisassembleSPIRV(eSPIRVGeneric, (uint32_t *)info.pCode, info.codeSize/sizeof(uint32_t), disasm);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user