From 564bea9da18827d6e9e7340ad66624ded080ca48 Mon Sep 17 00:00:00 2001 From: Austin Eng Date: Mon, 30 Nov 2020 20:36:31 +0000 Subject: [PATCH] Update ScissorTests to use WGSL Bug: dawn:572 Change-Id: Id083979bf24360d4db25eb5afa0e60eb0151d750 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/33768 Commit-Queue: Austin Eng Reviewed-by: Ben Clayton --- src/tests/end2end/ScissorTests.cpp | 33 ++++++++++++++++-------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/src/tests/end2end/ScissorTests.cpp b/src/tests/end2end/ScissorTests.cpp index 5b3149bd43..3cf0fe580d 100644 --- a/src/tests/end2end/ScissorTests.cpp +++ b/src/tests/end2end/ScissorTests.cpp @@ -20,23 +20,26 @@ class ScissorTest : public DawnTest { protected: wgpu::RenderPipeline CreateQuadPipeline(wgpu::TextureFormat format) { - wgpu::ShaderModule vsModule = - utils::CreateShaderModule(device, utils::SingleShaderStage::Vertex, R"( - #version 450 - const vec2 pos[6] = vec2[6]( - vec2(-1.0f, -1.0f), vec2(-1.0f, 1.0f), vec2(1.0f, -1.0f), - vec2(1.0f, 1.0f), vec2(-1.0f, 1.0f), vec2(1.0f, -1.0f) - ); - void main() { - gl_Position = vec4(pos[gl_VertexIndex], 0.5, 1.0); + wgpu::ShaderModule vsModule = utils::CreateShaderModuleFromWGSL(device, R"( + [[builtin(vertex_idx)]] var VertexIndex : u32; + [[builtin(position)]] var Position : vec4; + + const pos : array, 6> = array, 6>( + vec2(-1.0, -1.0), + vec2(-1.0, 1.0), + vec2( 1.0, -1.0), + vec2( 1.0, 1.0), + vec2(-1.0, 1.0), + vec2( 1.0, -1.0)); + + [[stage(vertex)]] fn main() -> void { + Position = vec4(pos[VertexIndex], 0.5, 1.0); })"); - wgpu::ShaderModule fsModule = - utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, R"( - #version 450 - layout(location = 0) out vec4 fragColor; - void main() { - fragColor = vec4(0.0f, 1.0f, 0.0f, 1.0f); + wgpu::ShaderModule fsModule = utils::CreateShaderModuleFromWGSL(device, R"( + [[location(0)]] var fragColor : vec4; + [[stage(fragment)]] fn main() -> void { + fragColor = vec4(0.0, 1.0, 0.0, 1.0); })"); utils::ComboRenderPipelineDescriptor descriptor(device);