Add specific error when failing to disassemble DXIL shaders

This commit is contained in:
baldurk
2021-02-19 14:48:54 +00:00
parent f244d970c7
commit 4e569cfe97
+12 -1
View File
@@ -126,7 +126,8 @@ rdcstr DisassembleDXBC(const bytebuf &shaderBytes, const rdcstr &target)
// we do a little mini parse of the DXBC file, just enough to get the shader code out. This is
// because we're getting called from outside the D3D backend where the shader bytes are opaque.
const char *dxbcParseError = "; Failed to fetch D3D shader code from DXBC";
const char *dxbcParseError =
"; Failed to fetch D3D shader code from shader module, invalid DXBC container";
const byte *base = shaderBytes.data();
const uint32_t *end = (const uint32_t *)(base + shaderBytes.size());
@@ -159,6 +160,8 @@ rdcstr DisassembleDXBC(const bytebuf &shaderBytes, const rdcstr &target)
in.pShaderByteCode = NULL;
in.byteCodeLength = 0;
bool dxil = false;
for(uint32_t offs : chunkOffsets)
{
dxbc = (const uint32_t *)(base + offs);
@@ -178,10 +181,18 @@ rdcstr DisassembleDXBC(const bytebuf &shaderBytes, const rdcstr &target)
break;
}
else if(*dxbc == MAKE_FOURCC('D', 'X', 'I', 'L') || *dxbc == MAKE_FOURCC('I', 'L', 'D', 'B'))
{
dxil = true;
}
}
if(in.byteCodeLength == 0)
{
if(dxil)
return "; Shader disassembly for DXIL shaders is not supported.";
return dxbcParseError;
}
out.size = sizeof(out);