diff --git a/src/tests/end2end/ClipSpaceTests.cpp b/src/tests/end2end/ClipSpaceTests.cpp index cb58525201..980fe1e183 100644 --- a/src/tests/end2end/ClipSpaceTests.cpp +++ b/src/tests/end2end/ClipSpaceTests.cpp @@ -25,28 +25,31 @@ class ClipSpaceTest : public DawnTest { // Draw two triangles: // 1. The depth value of the top-left one is >= 0.5 // 2. The depth value of the bottom-right one is <= 0.5 - const char* vs = - R"(#version 450 - const vec3 pos[6] = vec3[6](vec3(-1.0f, 1.0f, 1.0f), - vec3(-1.0f, -1.0f, 0.5f), - vec3( 1.0f, 1.0f, 0.5f), - vec3( 1.0f, 1.0f, 0.5f), - vec3(-1.0f, -1.0f, 0.5f), - vec3( 1.0f, -1.0f, 0.0f)); - void main() { - gl_Position = vec4(pos[gl_VertexIndex], 1.0); - })"; - pipelineDescriptor.vertexStage.module = - utils::CreateShaderModule(device, utils::SingleShaderStage::Vertex, vs); + pipelineDescriptor.vertexStage.module = utils::CreateShaderModuleFromWGSL(device, R"( + const pos : array, 6> = array, 6>( + vec3(-1.0, 1.0, 1.0), + vec3(-1.0, -1.0, 0.5), + vec3( 1.0, 1.0, 0.5), + vec3( 1.0, 1.0, 0.5), + vec3(-1.0, -1.0, 0.5), + vec3( 1.0, -1.0, 0.0)); - const char* fs = - R"(#version 450 - layout(location = 0) out vec4 fragColor; - void main() { - fragColor = vec4(1.0, 0.0, 0.0, 1.0); - })"; - pipelineDescriptor.cFragmentStage.module = - utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, fs); + [[builtin(vertex_idx)]] var VertexIndex : i32; + [[builtin(position)]] var Position : vec4; + + [[stage(vertex)]] + fn main() -> void { + Position = vec4(pos[VertexIndex], 1.0); + return; + })"); + + pipelineDescriptor.cFragmentStage.module = utils::CreateShaderModuleFromWGSL(device, R"( + [[location(0)]] var fragColor : vec4;; + [[stage(fragment)]] + fn main() -> void { + fragColor = vec4(1.0, 0.0, 0.0, 1.0); + return; + })"); pipelineDescriptor.cDepthStencilState.depthCompare = wgpu::CompareFunction::LessEqual; pipelineDescriptor.depthStencilState = &pipelineDescriptor.cDepthStencilState;