Fix EntryPointTests WGSL shaders for Tint roll
Should fix Chromium FYI and Dawn CQ. Followup to https://dawn-review.googlesource.com/c/dawn/+/29521 Change-Id: I62ba98ff234d3aceb6cc429d1e23c28f3a1adcbf Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/29760 Commit-Queue: Kai Ninomiya <kainino@chromium.org> Reviewed-by: Austin Eng <enga@chromium.org>
This commit is contained in:
parent
4171134daf
commit
6b4a4a85df
|
@ -25,19 +25,21 @@ TEST_P(EntryPointTests, FragAndVertexSameModule) {
|
|||
DAWN_SKIP_TEST_IF(IsVulkan());
|
||||
|
||||
wgpu::ShaderModule module = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||
[[builtin position]] var<out> Position : vec4<f32>;
|
||||
[[builtin(position)]] var<out> Position : vec4<f32>;
|
||||
|
||||
[[stage(vertex)]]
|
||||
fn vertex_main() -> void {
|
||||
Position = vec4<f32>(0.0, 0.0, 0.0, 1.0);
|
||||
return;
|
||||
}
|
||||
entry_point vertex = vertex_main;
|
||||
|
||||
[[location 0]] var<out> outColor : vec4<f32>;
|
||||
[[location(0)]] var<out> outColor : vec4<f32>;
|
||||
|
||||
[[stage(fragment)]]
|
||||
fn fragment_main() -> void {
|
||||
outColor = vec4<f32>(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<out> Position : vec4<f32>;
|
||||
fn vertex_main() -> void {
|
||||
[[builtin(position)]] var<out> Position : vec4<f32>;
|
||||
|
||||
[[stage(vertex)]]
|
||||
fn main() -> void {
|
||||
Position = vec4<f32>(0.0, 0.0, 0.0, 1.0);
|
||||
return;
|
||||
}
|
||||
entry_point vertex as "main" = vertex_main;
|
||||
|
||||
[[location 0]] var<out> outColor : vec4<f32>;
|
||||
fn fragment_main() -> void {
|
||||
[[location(0)]] var<out> outColor : vec4<f32>;
|
||||
|
||||
[[stage(fragment)]]
|
||||
fn main() -> void {
|
||||
outColor = vec4<f32>(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<storage_buffer> data : Data;
|
||||
[[binding(0), set(0)]] var<storage_buffer> 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.
|
||||
|
|
|
@ -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<out> Position : vec4<f32>;
|
||||
|
||||
)" + attributes + R"(
|
||||
[[builtin position]] var<out> Position : vec4<f32>;
|
||||
|
||||
fn vtx_main() -> void {
|
||||
[[stage(vertex)]]
|
||||
fn main() -> void {
|
||||
if ()" + successExpression + R"() {
|
||||
# Success case, move the vertex out of the viewport
|
||||
Position = vec4<f32>(-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<out> outColor : vec4<f32>;
|
||||
fn frag_main() -> void {
|
||||
[[location(0)]] var<out> outColor : vec4<f32>;
|
||||
|
||||
[[stage(fragment)]]
|
||||
fn main() -> void {
|
||||
outColor = vec4<f32>(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<in> a : f32;", "a == 473.0", std::move(vertexState), vertexBuffer, 0,
|
||||
false);
|
||||
DoTest("[[location(0)]] var<in> 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<in> a : f32;", "a == 473.0", std::move(vertexState), vertexBuffer, 4,
|
||||
true);
|
||||
DoTest("[[location(0)]] var<in> 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<in> a : i32;", "a == 473", std::move(vertexState), vertexBuffer, 4,
|
||||
DoTest("[[location(0)]] var<in> 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<in> a : u32;", "a == 473", std::move(vertexState), vertexBuffer, 4,
|
||||
DoTest("[[location(0)]] var<in> 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<in> a : vec2<f32>;", "a[0] == 473.0 && a[1] == 473.0",
|
||||
DoTest("[[location(0)]] var<in> a : vec2<f32>;", "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<in> a : vec3<f32>;",
|
||||
DoTest("[[location(0)]] var<in> a : vec3<f32>;",
|
||||
"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<in> a : vec4<f32>;",
|
||||
DoTest("[[location(0)]] var<in> a : vec4<f32>;",
|
||||
"a[0] == 473.0 && a[1] == 473.0 && a[2] == 473.0 && a[3] == 473.0",
|
||||
std::move(vertexState), vertexBuffer, 16, true);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue