From d7f4e808e78b8f37c616e01c7dd75cea4cc7667c Mon Sep 17 00:00:00 2001 From: Austin Eng Date: Thu, 26 Nov 2020 15:36:26 +0000 Subject: [PATCH] Update RenderBundleTests to use WGSL Bug: dawn:572 Change-Id: Ide2ec5c70cc4f0abe8374bd9262ef9da02c9a4ad Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/33881 Commit-Queue: Corentin Wallez Reviewed-by: Ben Clayton --- src/tests/end2end/RenderBundleTests.cpp | 33 ++++++++++++------------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/src/tests/end2end/RenderBundleTests.cpp b/src/tests/end2end/RenderBundleTests.cpp index 2e14597c2d..baf731fef5 100644 --- a/src/tests/end2end/RenderBundleTests.cpp +++ b/src/tests/end2end/RenderBundleTests.cpp @@ -31,24 +31,23 @@ class RenderBundleTest : public DawnTest { renderPass = utils::CreateBasicRenderPass(device, kRTSize, kRTSize); - wgpu::ShaderModule vsModule = - utils::CreateShaderModule(device, utils::SingleShaderStage::Vertex, R"( - #version 450 - layout(location = 0) in vec4 pos; - void main() { - gl_Position = pos; - })"); + wgpu::ShaderModule vsModule = utils::CreateShaderModuleFromWGSL(device, R"( + [[location(0)]] var pos : vec4; + [[builtin(position)]] var Position : vec4; + [[stage(vertex)]] fn main() -> void { + Position = pos; + })"); - wgpu::ShaderModule fsModule = - utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, R"( - #version 450 - layout(location = 0) out vec4 fragColor; - layout (set = 0, binding = 0) uniform fragmentUniformBuffer { - vec4 color; - }; - void main() { - fragColor = color; - })"); + wgpu::ShaderModule fsModule = utils::CreateShaderModuleFromWGSL(device, R"( + [[location(0)]] var fragColor : vec4; + [[block]] struct Ubo { + [[offset(0)]] color : vec4; + }; + [[set(0), binding(0)]] var fragmentUniformBuffer : Ubo; + + [[stage(fragment)]] fn main() -> void { + fragColor = fragmentUniformBuffer.color; + })"); utils::ComboRenderPipelineDescriptor descriptor(device); descriptor.vertexStage.module = vsModule;