matinfo / matdbg: fix SPIRV version, add validation.
The value we pass to spvContextCreate() is not SPV_ENV_UNIVERSAL_1_3, which is what we use in GLSLPostProcessor. Also add a call to spvValidateBinary(), which would have caught this oversight.
This commit is contained in:
@@ -106,10 +106,16 @@ CString ShaderExtractor::spirvToGLSL(const uint32_t* data, size_t wordCount) {
|
||||
// but please do not submit. We prefer to use the syntax that the standalone "spirv-dis" tool
|
||||
// uses, which lets us easily generate test cases for the spirv-cross project.
|
||||
CString ShaderExtractor::spirvToText(const uint32_t* begin, size_t wordCount) {
|
||||
auto context = spvContextCreate(SPV_ENV_UNIVERSAL_1_1);
|
||||
spv_context context = spvContextCreate(SPV_ENV_UNIVERSAL_1_3);
|
||||
if (SPV_SUCCESS != spvValidateBinary(context, begin, wordCount, nullptr)) {
|
||||
spvContextDestroy(context);
|
||||
return CString("Validation failure.");
|
||||
}
|
||||
|
||||
spv_text text = nullptr;
|
||||
const uint32_t options = SPV_BINARY_TO_TEXT_OPTION_INDENT |
|
||||
SPV_BINARY_TO_TEXT_OPTION_FRIENDLY_NAMES;
|
||||
|
||||
spvBinaryToText(context, begin, wordCount, options, &text, nullptr);
|
||||
CString result(text->str);
|
||||
spvTextDestroy(text);
|
||||
|
||||
Reference in New Issue
Block a user