mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-13 23:26:24 +00:00
Validate SPIR-V code when creating ShaderModules
This integrates spirv-val in dawn_native so that regular and WebGPU-specific validation of shaders is done. Also adds tests to check OpUndef is correctly rejected so we know WebGPU-specific validation is working. Change-Id: If49d276c98bca8cd3c6c1a420903fe34923a2942
This commit is contained in:
committed by
Corentin Wallez
parent
ae62847f1c
commit
21d8438ad6
@@ -69,6 +69,9 @@ bool ValidationTest::EndExpectDeviceError() {
|
||||
mExpectError = false;
|
||||
return mError;
|
||||
}
|
||||
std::string ValidationTest::GetLastDeviceErrorMessage() const {
|
||||
return mDeviceErrorMessage;
|
||||
}
|
||||
|
||||
dawn::RenderPassDescriptor ValidationTest::CreateSimpleRenderPass() {
|
||||
dawn::TextureDescriptor descriptor;
|
||||
@@ -91,14 +94,16 @@ dawn::RenderPassDescriptor ValidationTest::CreateSimpleRenderPass() {
|
||||
}
|
||||
|
||||
void ValidationTest::OnDeviceError(const char* message, dawnCallbackUserdata userdata) {
|
||||
auto self = reinterpret_cast<ValidationTest*>(static_cast<uintptr_t>(userdata));
|
||||
self->mDeviceErrorMessage = message;
|
||||
|
||||
// Skip this one specific error that is raised when a builder is used after it got an error
|
||||
// this is important because we don't want to wrap all creation tests in ASSERT_DEVICE_ERROR.
|
||||
// Yes the error message is misleading.
|
||||
if (std::string(message) == "Builder cannot be used after GetResult") {
|
||||
if (self->mDeviceErrorMessage == "Builder cannot be used after GetResult") {
|
||||
return;
|
||||
}
|
||||
|
||||
auto self = reinterpret_cast<ValidationTest*>(static_cast<uintptr_t>(userdata));
|
||||
ASSERT_TRUE(self->mExpectError) << "Got unexpected device error: " << message;
|
||||
ASSERT_FALSE(self->mError) << "Got two errors in expect block";
|
||||
self->mError = true;
|
||||
|
||||
Reference in New Issue
Block a user