From b7eb1e15faaab83433f9a84ff4edc43f5ef3dca2 Mon Sep 17 00:00:00 2001 From: Corentin Wallez Date: Thu, 26 Nov 2020 11:30:55 +0000 Subject: [PATCH] Port RenderBundleValidationTests to WGSL Bug: dawn:572 Change-Id: Id71f2d49c60238939c70bb1d7c93a45b25ca3dcb Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/33928 Reviewed-by: Ben Clayton Commit-Queue: Corentin Wallez --- .../RenderBundleValidationTests.cpp | 41 +++++++++++-------- 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/src/tests/unittests/validation/RenderBundleValidationTests.cpp b/src/tests/unittests/validation/RenderBundleValidationTests.cpp index 2d73112afb..f62d76fe50 100644 --- a/src/tests/unittests/validation/RenderBundleValidationTests.cpp +++ b/src/tests/unittests/validation/RenderBundleValidationTests.cpp @@ -27,25 +27,30 @@ namespace { void SetUp() override { ValidationTest::SetUp(); - vsModule = utils::CreateShaderModule(device, utils::SingleShaderStage::Vertex, R"( - #version 450 - layout(location = 0) in vec2 pos; - layout (set = 0, binding = 0) uniform vertexUniformBuffer { - mat2 transform; - }; - void main() { - })"); + vsModule = utils::CreateShaderModuleFromWGSL(device, R"( + [[location(0)]] var pos : vec2; - fsModule = utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, R"( - #version 450 - layout (set = 1, binding = 0) uniform fragmentUniformBuffer { - vec4 color; - }; - layout (set = 1, binding = 1) buffer storageBuffer { - float dummy[]; - }; - void main() { - })"); + [[block]] struct S { + [[offset(0)]] transform : mat2x2; + }; + [[set(0), binding(0)]] var uniforms : S; + + [[stage(vertex)]] fn main() -> void { + })"); + + fsModule = utils::CreateShaderModuleFromWGSL(device, R"( + [[block]] struct Uniforms { + [[offset(0)]] color : vec4; + }; + [[set(1), binding(0)]] var uniforms : Uniforms; + + [[block]] struct Storage { + [[offset(0)]] dummy : [[stride(4)]] array; + }; + [[set(1), binding(1)]] var ssbo : [[access(read_write)]] Storage; + + [[stage(fragment)]] fn main() -> void { + })"); wgpu::BindGroupLayout bgls[] = { utils::MakeBindGroupLayout(