From 21c1e5f62303083128c84af6d2bab4c716876db2 Mon Sep 17 00:00:00 2001 From: Austin Eng Date: Thu, 26 Nov 2020 13:23:55 +0000 Subject: [PATCH] Update DeviceLostTests to use WGSL Bug: dawn:572 Change-Id: I0555f88baa42c6fdd236478ab2ad4d7ba59448ee Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/33763 Commit-Queue: Corentin Wallez Reviewed-by: Ben Clayton --- src/tests/end2end/DeviceLostTests.cpp | 28 +++++++++++++-------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/src/tests/end2end/DeviceLostTests.cpp b/src/tests/end2end/DeviceLostTests.cpp index 57051a8323..18e5fb4a3d 100644 --- a/src/tests/end2end/DeviceLostTests.cpp +++ b/src/tests/end2end/DeviceLostTests.cpp @@ -110,14 +110,13 @@ TEST_P(DeviceLostTest, CreateBindGroupLayoutFails) { // Test that GetBindGroupLayout fails when device is lost TEST_P(DeviceLostTest, GetBindGroupLayoutFails) { - wgpu::ShaderModule csModule = - utils::CreateShaderModule(device, utils::SingleShaderStage::Compute, R"( - #version 450 - layout(set = 0, binding = 0) uniform UniformBuffer { - vec4 pos; - }; - void main() { - })"); + wgpu::ShaderModule csModule = utils::CreateShaderModuleFromWGSL(device, R"( + [[block]] struct UniformBuffer { + [[offset(0)]] pos : vec4; + }; + [[set(0), binding(0)]] var ubo : UniformBuffer; + [[stage(compute)]] fn main() -> void { + })"); wgpu::ComputePipelineDescriptor descriptor; descriptor.layout = nullptr; @@ -199,13 +198,12 @@ TEST_P(DeviceLostTest, CreateSamplerFails) { TEST_P(DeviceLostTest, CreateShaderModuleFails) { SetCallbackAndLoseForTesting(); - ASSERT_DEVICE_ERROR(utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, R"( - #version 450 - layout(location = 0) in vec4 color; - layout(location = 0) out vec4 fragColor; - void main() { - fragColor = color; - })")); + ASSERT_DEVICE_ERROR(utils::CreateShaderModuleFromWGSL(device, R"( + [[location(0)]] var color : vec4; + [[location(0)]] var fragColor : vec4; + [[stage(fragment)]] fn main() -> void { + fragColor = color; + })")); } // Tests that CreateSwapChain fails when device is lost