diff --git a/src/tests/end2end/EntryPointTests.cpp b/src/tests/end2end/EntryPointTests.cpp index 1347262ff8..619999b418 100644 --- a/src/tests/end2end/EntryPointTests.cpp +++ b/src/tests/end2end/EntryPointTests.cpp @@ -25,19 +25,21 @@ TEST_P(EntryPointTests, FragAndVertexSameModule) { DAWN_SKIP_TEST_IF(IsVulkan()); wgpu::ShaderModule module = utils::CreateShaderModuleFromWGSL(device, R"( - [[builtin position]] var Position : vec4; + [[builtin(position)]] var Position : vec4; + + [[stage(vertex)]] fn vertex_main() -> void { Position = vec4(0.0, 0.0, 0.0, 1.0); return; } - entry_point vertex = vertex_main; - [[location 0]] var outColor : vec4; + [[location(0)]] var outColor : vec4; + + [[stage(fragment)]] fn fragment_main() -> void { outColor = vec4(1.0, 0.0, 0.0, 1.0); return; } - entry_point fragment = fragment_main; )"); // Create a point pipeline from the module. @@ -71,19 +73,21 @@ TEST_P(EntryPointTests, FragAndVertexSameModuleSameName) { DAWN_SKIP_TEST_IF(IsVulkan()); wgpu::ShaderModule module = utils::CreateShaderModuleFromWGSL(device, R"( - [[builtin position]] var Position : vec4; - fn vertex_main() -> void { + [[builtin(position)]] var Position : vec4; + + [[stage(vertex)]] + fn main() -> void { Position = vec4(0.0, 0.0, 0.0, 1.0); return; } - entry_point vertex as "main" = vertex_main; - [[location 0]] var outColor : vec4; - fn fragment_main() -> void { + [[location(0)]] var outColor : vec4; + + [[stage(fragment)]] + fn main() -> void { outColor = vec4(1.0, 0.0, 0.0, 1.0); return; } - entry_point fragment as "main" = fragment_main; )"); // Create a point pipeline from the module. @@ -118,20 +122,21 @@ TEST_P(EntryPointTests, TwoComputeInModule) { wgpu::ShaderModule module = utils::CreateShaderModuleFromWGSL(device, R"( type Data = [[block]] struct { - [[offset 0]] data : u32; + [[offset(0)]] data : u32; }; - [[binding 0, set 0]] var data : Data; + [[binding(0), set(0)]] var data : Data; + [[stage(compute)]] fn write1() -> void { data.data = 1u; return; } + + [[stage(compute)]] fn write42() -> void { data.data = 42u; return; } - entry_point compute = write1; - entry_point compute = write42; )"); // Create both pipelines from the module. diff --git a/src/tests/end2end/VertexBufferRobustnessTests.cpp b/src/tests/end2end/VertexBufferRobustnessTests.cpp index b2ae2c4698..d6a5ab9f32 100644 --- a/src/tests/end2end/VertexBufferRobustnessTests.cpp +++ b/src/tests/end2end/VertexBufferRobustnessTests.cpp @@ -32,13 +32,11 @@ class VertexBufferRobustnessTest : public DawnTest { // viewport. wgpu::ShaderModule CreateVertexModule(const std::string& attributes, const std::string& successExpression) { - return utils::CreateShaderModuleFromWGSL(device, (R"( - entry_point vertex as "main" = vtx_main; + return utils::CreateShaderModuleFromWGSL(device, (attributes + R"( + [[builtin(position)]] var Position : vec4; - )" + attributes + R"( - [[builtin position]] var Position : vec4; - - fn vtx_main() -> void { + [[stage(vertex)]] + fn main() -> void { if ()" + successExpression + R"() { # Success case, move the vertex out of the viewport Position = vec4(-10.0, 0.0, 0.0, 1.0); @@ -61,9 +59,10 @@ class VertexBufferRobustnessTest : public DawnTest { bool expectation) { wgpu::ShaderModule vsModule = CreateVertexModule(attributes, successExpression); wgpu::ShaderModule fsModule = utils::CreateShaderModuleFromWGSL(device, R"( - entry_point fragment as "main" = frag_main; - [[location 0]] var outColor : vec4; - fn frag_main() -> void { + [[location(0)]] var outColor : vec4; + + [[stage(fragment)]] + fn main() -> void { outColor = vec4(1.0, 1.0, 1.0, 1.0); return; } @@ -111,8 +110,8 @@ TEST_P(VertexBufferRobustnessTest, DetectInvalidValues) { wgpu::Buffer vertexBuffer = utils::CreateBufferFromData(device, kVertices, sizeof(kVertices), wgpu::BufferUsage::Vertex); - DoTest("[[location 0]] var a : f32;", "a == 473.0", std::move(vertexState), vertexBuffer, 0, - false); + DoTest("[[location(0)]] var a : f32;", "a == 473.0", std::move(vertexState), vertexBuffer, + 0, false); } TEST_P(VertexBufferRobustnessTest, FloatClamp) { @@ -129,8 +128,8 @@ TEST_P(VertexBufferRobustnessTest, FloatClamp) { wgpu::Buffer vertexBuffer = utils::CreateBufferFromData(device, kVertices, sizeof(kVertices), wgpu::BufferUsage::Vertex); - DoTest("[[location 0]] var a : f32;", "a == 473.0", std::move(vertexState), vertexBuffer, 4, - true); + DoTest("[[location(0)]] var a : f32;", "a == 473.0", std::move(vertexState), vertexBuffer, + 4, true); } TEST_P(VertexBufferRobustnessTest, IntClamp) { @@ -147,7 +146,7 @@ TEST_P(VertexBufferRobustnessTest, IntClamp) { wgpu::Buffer vertexBuffer = utils::CreateBufferFromData(device, kVertices, sizeof(kVertices), wgpu::BufferUsage::Vertex); - DoTest("[[location 0]] var a : i32;", "a == 473", std::move(vertexState), vertexBuffer, 4, + DoTest("[[location(0)]] var a : i32;", "a == 473", std::move(vertexState), vertexBuffer, 4, true); } @@ -165,7 +164,7 @@ TEST_P(VertexBufferRobustnessTest, UIntClamp) { wgpu::Buffer vertexBuffer = utils::CreateBufferFromData(device, kVertices, sizeof(kVertices), wgpu::BufferUsage::Vertex); - DoTest("[[location 0]] var a : u32;", "a == 473", std::move(vertexState), vertexBuffer, 4, + DoTest("[[location(0)]] var a : u32;", "a == 473", std::move(vertexState), vertexBuffer, 4, true); } @@ -183,7 +182,7 @@ TEST_P(VertexBufferRobustnessTest, Float2Clamp) { wgpu::Buffer vertexBuffer = utils::CreateBufferFromData(device, kVertices, sizeof(kVertices), wgpu::BufferUsage::Vertex); - DoTest("[[location 0]] var a : vec2;", "a[0] == 473.0 && a[1] == 473.0", + DoTest("[[location(0)]] var a : vec2;", "a[0] == 473.0 && a[1] == 473.0", std::move(vertexState), vertexBuffer, 8, true); } @@ -201,7 +200,7 @@ TEST_P(VertexBufferRobustnessTest, Float3Clamp) { wgpu::Buffer vertexBuffer = utils::CreateBufferFromData(device, kVertices, sizeof(kVertices), wgpu::BufferUsage::Vertex); - DoTest("[[location 0]] var a : vec3;", + DoTest("[[location(0)]] var a : vec3;", "a[0] == 473.0 && a[1] == 473.0 && a[2] == 473.0", std::move(vertexState), vertexBuffer, 12, true); } @@ -220,7 +219,7 @@ TEST_P(VertexBufferRobustnessTest, Float4Clamp) { wgpu::Buffer vertexBuffer = utils::CreateBufferFromData(device, kVertices, sizeof(kVertices), wgpu::BufferUsage::Vertex); - DoTest("[[location 0]] var a : vec4;", + DoTest("[[location(0)]] var a : vec4;", "a[0] == 473.0 && a[1] == 473.0 && a[2] == 473.0 && a[3] == 473.0", std::move(vertexState), vertexBuffer, 16, true); }