mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-07-05 12:46:11 +00:00
ShaderModule: Include extra information in shader errors
If the SPIR-V fails to validate, include the SPIR-V disassembly in the error. If the shader fails to compile, include the shader source in the error. Change-Id: I05f93b5dec7985c42ddf9cd14621af2a855ee640 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/37282 Commit-Queue: Ben Clayton <bclayton@google.com> Reviewed-by: Austin Eng <enga@chromium.org>
This commit is contained in:
parent
2f1278e68b
commit
3639186e7e
@ -166,6 +166,12 @@ namespace dawn_native {
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (!spirvTools.Validate(code, codeSize)) {
|
if (!spirvTools.Validate(code, codeSize)) {
|
||||||
|
std::string disassembly;
|
||||||
|
if (spirvTools.Disassemble(std::vector<uint32_t>(code, code + codeSize),
|
||||||
|
&disassembly)) {
|
||||||
|
errorStream << "disassembly:" << std::endl << disassembly;
|
||||||
|
}
|
||||||
|
|
||||||
return DAWN_VALIDATION_ERROR(errorStream.str().c_str());
|
return DAWN_VALIDATION_ERROR(errorStream.str().c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -180,7 +186,9 @@ namespace dawn_native {
|
|||||||
tint::reader::wgsl::Parser parser(file);
|
tint::reader::wgsl::Parser parser(file);
|
||||||
if (!parser.Parse()) {
|
if (!parser.Parse()) {
|
||||||
auto err = tint::diag::Formatter{}.format(parser.diagnostics());
|
auto err = tint::diag::Formatter{}.format(parser.diagnostics());
|
||||||
errorStream << "Parser: " << err << std::endl;
|
errorStream << "Parser: " << err << std::endl
|
||||||
|
<< "Shader: " << std::endl
|
||||||
|
<< file->content << std::endl;
|
||||||
return DAWN_VALIDATION_ERROR(errorStream.str().c_str());
|
return DAWN_VALIDATION_ERROR(errorStream.str().c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user