Update src/tint unittests to new @stage format.

This CL updates all of the Tint unittests to the new @stage shorter
syntax. This also updates the WGSL writer to emit the new short forms
instead of using the deprecated form.

Bug: tint:1503
Change-Id: I8c49e5319a19cccb5b4b5078f3ab39c50f31a9a8
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/92483
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
This commit is contained in:
dan sinclair 2022-06-07 13:55:34 +00:00 committed by Dawn LUCI CQ
parent e7099d4f3b
commit b29892be09
4586 changed files with 10823 additions and 10820 deletions

View File

@ -99,7 +99,7 @@ fn f1(p0 : f32, p1 : i32) -> f32 {
return 1.0;
}
@stage(fragment)
@fragment
fn main() {
f1(1.0, 2);
}

View File

@ -172,16 +172,16 @@ TEST(GetIdentifierTest, GetIdentifierTest1) {
R"(fn clamp_0acf8f() {
var res: vec2<f32> = clamp(vec2<f32>(), vec2<f32>(), vec2<f32>());
}
@stage(vertex)
@vertex
fn vertex_main() -> @builtin(position) vec4<f32> {
clamp_0acf8f();"
return vec4<f32>();
}
@stage(fragment)
@fragment
fn fragment_main() {
clamp_0acf8f();
}
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn compute_main() {"
var<private> foo: f32 = 0.0;
clamp_0acf8f();
@ -192,13 +192,13 @@ TEST(GetIdentifierTest, GetIdentifierTest1) {
std::vector<std::pair<size_t, size_t>> ground_truth = {
std::make_pair(3, 12), std::make_pair(28, 3), std::make_pair(37, 4),
std::make_pair(49, 5), std::make_pair(60, 3), std::make_pair(68, 4),
std::make_pair(81, 4), std::make_pair(110, 5), std::make_pair(130, 2),
std::make_pair(140, 4), std::make_pair(151, 7), std::make_pair(169, 4),
std::make_pair(190, 12), std::make_pair(216, 6), std::make_pair(228, 3),
std::make_pair(251, 5), std::make_pair(273, 2), std::make_pair(285, 4),
std::make_pair(302, 12), std::make_pair(333, 5), std::make_pair(349, 14),
std::make_pair(373, 2), std::make_pair(384, 4), std::make_pair(402, 3),
std::make_pair(415, 3), std::make_pair(420, 3), std::make_pair(439, 12)};
std::make_pair(81, 4), std::make_pair(110, 6), std::make_pair(123, 2),
std::make_pair(133, 4), std::make_pair(144, 7), std::make_pair(162, 4),
std::make_pair(183, 12), std::make_pair(209, 6), std::make_pair(221, 3),
std::make_pair(244, 8), std::make_pair(259, 2), std::make_pair(271, 4),
std::make_pair(288, 12), std::make_pair(319, 7), std::make_pair(328, 14),
std::make_pair(352, 2), std::make_pair(363, 4), std::make_pair(381, 3),
std::make_pair(394, 3), std::make_pair(399, 3), std::make_pair(418, 12)};
ASSERT_EQ(ground_truth, identifiers_pos);
}
@ -208,17 +208,17 @@ TEST(TestGetLiteralsValues, TestGetLiteralsValues1) {
R"(fn clamp_0acf8f() {
var res: vec2<f32> = clamp(vec2<f32>(), vec2<f32>(), vec2<f32>());
}
@stage(vertex)
@vertex
fn vertex_main() -> @builtin(position) vec4<f32> {
clamp_0acf8f();
var foo_1: i32 = 3;
return vec4<f32>();
}
@stage(fragment)
@fragment
fn fragment_main() {
clamp_0acf8f();
}
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn compute_main() {
var<private> foo: f32 = 0.0;
var foo_2: i32 = 10;
@ -249,17 +249,17 @@ TEST(InsertReturnTest, FindClosingBrace) {
var res: vec2<f32> = clamp(vec2<f32>(), vec2<f32>(), vec2<f32>());
}
}
@stage(vertex)
@vertex
fn vertex_main() -> @builtin(position) vec4<f32> {
clamp_0acf8f();
var foo_1: i32 = 3;
return vec4<f32>();
}
@stage(fragment)
@fragment
fn fragment_main() {
clamp_0acf8f();
}
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn compute_main() {
var<private> foo: f32 = 0.0;
var foo_2: i32 = 10;
@ -295,17 +295,17 @@ TEST(InsertReturnTest, FindClosingBraceFailing) {
var res: vec2<f32> = clamp(vec2<f32>(), vec2<f32>(), vec2<f32>());
}
}
@stage(vertex)
@vertex
fn vertex_main() -> @builtin(position) vec4<f32> {
clamp_0acf8f();
var foo_1: i32 = 3;
return vec4<f32>();
}
@stage(fragment)
@fragment
fn fragment_main() {
clamp_0acf8f();
}
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn compute_main() {
var<private> foo: f32 = 0.0;
var foo_2: i32 = 10;
@ -334,17 +334,17 @@ TEST(TestInsertReturn, TestInsertReturn1) {
R"(fn clamp_0acf8f() {
var res: vec2<f32> = clamp(vec2<f32>(), vec2<f32>(), vec2<f32>());
}
@stage(vertex)
@vertex
fn vertex_main() -> @builtin(position) vec4<f32> {
clamp_0acf8f();
var foo_1: i32 = 3;
return vec4<f32>();
}
@stage(fragment)
@fragment
fn fragment_main() {
clamp_0acf8f();
}
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn compute_main() {
var<private> foo: f32 = 0.0;
var foo_2: i32 = 10;
@ -367,17 +367,17 @@ TEST(TestInsertReturn, TestInsertReturn1) {
R"(fn clamp_0acf8f() {
var res: vec2<f32> = clamp(vec2<f32>(), vec2<f32>(), vec2<f32>());return true;
}
@stage(vertex)
@vertex
fn vertex_main() -> @builtin(position) vec4<f32> {
clamp_0acf8f();
var foo_1: i32 = 3;
return vec4<f32>();
}
@stage(fragment)
@fragment
fn fragment_main() {
clamp_0acf8f();
}
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn compute_main() {
var<private> foo: f32 = 0.0;
var foo_2: i32 = 10;
@ -394,17 +394,17 @@ TEST(TestInsertReturn, TestFunctionPositions) {
R"(fn clamp_0acf8f() {
var res: vec2<f32> = clamp(vec2<f32>(), vec2<f32>(), vec2<f32>());
}
@stage(vertex)
@vertex
fn vertex_main() -> @builtin(position) vec4<f32> {
clamp_0acf8f();
var foo_1: i32 = 3;
return vec4<f32>();
}
@stage(fragment)
@fragment
fn fragment_main() {
clamp_0acf8f();
}
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn compute_main() {
var<private> foo: f32 = 0.0;
var foo_2: i32 = 10;
@ -419,7 +419,7 @@ TEST(TestInsertReturn, TestFunctionPositions) {
var foo_3 : i32 = -20;)";
std::vector<size_t> function_positions = GetFunctionBodyPositions(wgsl_code);
std::vector<size_t> expected_positions = {187, 607};
std::vector<size_t> expected_positions = {180, 586};
ASSERT_EQ(expected_positions, function_positions);
}
@ -428,17 +428,17 @@ TEST(TestInsertReturn, TestMissingSemicolon) {
R"(fn clamp_0acf8f() {
var res: vec2<f32> = clamp(vec2<f32>(), vec2<f32>(), vec2<f32>())
}
@stage(vertex)
@vertex
fn vertex_main() -> @builtin(position) vec4<f32> {
clamp_0acf8f()
var foo_1: i32 = 3
return vec4<f32>()
}
@stage(fragment)
@fragment
fn fragment_main() {
clamp_0acf8f();
}
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn compute_main() {
var<private> foo: f32 = 0.0;
var foo_2: i32 = 10;
@ -461,17 +461,17 @@ TEST(TestInsertReturn, TestMissingSemicolon) {
R"(fn clamp_0acf8f() {
var res: vec2<f32> = clamp(vec2<f32>(), vec2<f32>(), vec2<f32>())
}
@stage(vertex)
@vertex
fn vertex_main() -> @builtin(position) vec4<f32> {
clamp_0acf8f()
var foo_1: i32 = 3
return vec4<f32>()
}
@stage(fragment)
@fragment
fn fragment_main() {
clamp_0acf8f();
}
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn compute_main() {
var<private> foo: f32 = 0.0;
var foo_2: i32 = 10;

View File

@ -2485,7 +2485,7 @@ TEST_F(InspectorGetExternalTextureResourceBindingsTest, Simple) {
TEST_F(InspectorGetSamplerTextureUsesTest, None) {
std::string shader = R"(
@stage(fragment)
@fragment
fn main() {
})";
@ -2501,7 +2501,7 @@ TEST_F(InspectorGetSamplerTextureUsesTest, Simple) {
@group(0) @binding(1) var mySampler: sampler;
@group(0) @binding(2) var myTexture: texture_2d<f32>;
@stage(fragment)
@fragment
fn main(@location(0) fragUV: vec2<f32>,
@location(1) fragPosition: vec4<f32>) -> @location(0) vec4<f32> {
return textureSample(myTexture, mySampler, fragUV) * fragPosition;
@ -2524,7 +2524,7 @@ TEST_F(InspectorGetSamplerTextureUsesTest, UnknownEntryPoint) {
@group(0) @binding(1) var mySampler: sampler;
@group(0) @binding(2) var myTexture: texture_2d<f32>;
@stage(fragment)
@fragment
fn main(@location(0) fragUV: vec2<f32>,
@location(1) fragPosition: vec4<f32>) -> @location(0) vec4<f32> {
return textureSample(myTexture, mySampler, fragUV) * fragPosition;
@ -2540,7 +2540,7 @@ TEST_F(InspectorGetSamplerTextureUsesTest, MultipleCalls) {
@group(0) @binding(1) var mySampler: sampler;
@group(0) @binding(2) var myTexture: texture_2d<f32>;
@stage(fragment)
@fragment
fn main(@location(0) fragUV: vec2<f32>,
@location(1) fragPosition: vec4<f32>) -> @location(0) vec4<f32> {
return textureSample(myTexture, mySampler, fragUV) * fragPosition;
@ -2565,7 +2565,7 @@ fn doSample(t: texture_2d<f32>, s: sampler, uv: vec2<f32>) -> vec4<f32> {
return textureSample(t, s, uv);
}
@stage(fragment)
@fragment
fn main(@location(0) fragUV: vec2<f32>,
@location(1) fragPosition: vec4<f32>) -> @location(0) vec4<f32> {
return doSample(myTexture, mySampler, fragUV) * fragPosition;
@ -2592,7 +2592,7 @@ fn doSample(s: sampler, uv: vec2<f32>) -> vec4<f32> {
return textureSample(myTexture, s, uv);
}
@stage(fragment)
@fragment
fn main(@location(0) fragUV: vec2<f32>,
@location(1) fragPosition: vec4<f32>) -> @location(0) vec4<f32> {
return doSample(mySampler, fragUV) * fragPosition;
@ -2619,7 +2619,7 @@ fn doSample(t: texture_2d<f32>, uv: vec2<f32>) -> vec4<f32> {
return textureSample(t, mySampler, uv);
}
@stage(fragment)
@fragment
fn main(@location(0) fragUV: vec2<f32>,
@location(1) fragPosition: vec4<f32>) -> @location(0) vec4<f32> {
return doSample(myTexture, fragUV) * fragPosition;
@ -2646,7 +2646,7 @@ fn doSample(uv: vec2<f32>) -> vec4<f32> {
return textureSample(myTexture, mySampler, uv);
}
@stage(fragment)
@fragment
fn main(@location(0) fragUV: vec2<f32>,
@location(1) fragPosition: vec4<f32>) -> @location(0) vec4<f32> {
return doSample(fragUV) * fragPosition;
@ -2686,19 +2686,19 @@ fn Z(t: texture_2d<f32>, s: sampler, uv: vec2<f32>) -> vec4<f32> {
return X(t, s, uv) + Y(t, s, uv);
}
@stage(fragment)
@fragment
fn via_call(@location(0) fragUV: vec2<f32>,
@location(1) fragPosition: vec4<f32>) -> @location(0) vec4<f32> {
return Z(myTexture, mySampler, fragUV) * fragPosition;
}
@stage(fragment)
@fragment
fn via_ptr(@location(0) fragUV: vec2<f32>,
@location(1) fragPosition: vec4<f32>) -> @location(0) vec4<f32> {
return textureSample(myTexture, mySampler, fragUV) + fragPosition;
}
@stage(fragment)
@fragment
fn direct(@location(0) fragUV: vec2<f32>,
@location(1) fragPosition: vec4<f32>) -> @location(0) vec4<f32> {
return textureSample(myTexture, mySampler, fragUV) + fragPosition;
@ -2836,7 +2836,7 @@ TEST_F(InspectorGetUsedExtensionNamesTest, Empty) {
// Test calling GetUsedExtensionNames on a shader with no extension.
TEST_F(InspectorGetUsedExtensionNamesTest, None) {
std::string shader = R"(
@stage(fragment)
@fragment
fn main() {
})";
@ -2851,7 +2851,7 @@ TEST_F(InspectorGetUsedExtensionNamesTest, Simple) {
std::string shader = R"(
enable f16;
@stage(fragment)
@fragment
fn main() {
})";
@ -2869,7 +2869,7 @@ TEST_F(InspectorGetUsedExtensionNamesTest, Duplicated) {
enable f16;
enable f16;
@stage(fragment)
@fragment
fn main() {
})";
@ -2893,7 +2893,7 @@ TEST_F(InspectorGetEnableDirectivesTest, Empty) {
// Test calling GetEnableDirectives on a shader with no extension.
TEST_F(InspectorGetEnableDirectivesTest, None) {
std::string shader = R"(
@stage(fragment)
@fragment
fn main() {
})";
@ -2908,7 +2908,7 @@ TEST_F(InspectorGetEnableDirectivesTest, Simple) {
std::string shader = R"(
enable f16;
@stage(fragment)
@fragment
fn main() {
})";
@ -2927,7 +2927,7 @@ TEST_F(InspectorGetEnableDirectivesTest, Duplicated) {
enable f16;
enable f16;
@stage(fragment)
@fragment
fn main() {
})";
@ -2952,7 +2952,7 @@ fn doSample(t: texture_2d<f32>, s: sampler, uv: vec2<f32>) -> vec4<f32> {
return textureSample(t, s, uv);
}
@stage(fragment)
@fragment
fn main(@location(0) fragUV: vec2<f32>,
@location(1) fragPosition: vec4<f32>) -> @location(0) vec4<f32> {
return doSample(myTexture, mySampler, fragUV) * fragPosition;

View File

@ -59,7 +59,7 @@ fn x_100_1() {
return;
}
@stage(fragment)
@fragment
fn x_100() {
x_100_1();
}
@ -185,7 +185,7 @@ fn x_100_1() {
return;
}
@stage(fragment)
@fragment
fn x_100() {
x_100_1();
}

View File

@ -810,7 +810,7 @@ fn main_1() {
return;
}
@stage(fragment)
@fragment
fn main() {
main_1();
}
@ -850,7 +850,7 @@ OpExecutionMode %main OriginUpperLeft
return;
}
@stage(fragment)
@fragment
fn main() {
main_1();
}

View File

@ -126,7 +126,7 @@ struct main_out {
)")) << program_ast;
EXPECT_THAT(program_ast, HasSubstr(R"(
@stage(vertex)
@vertex
fn main() -> main_out {
)"));
}
@ -144,7 +144,7 @@ TEST_F(SpvParserTest, EmitFunctions_Function_EntryPoint_Fragment) {
Program program = p->program();
const auto program_ast = test::ToString(program);
EXPECT_THAT(program_ast, HasSubstr(R"(
@stage(fragment)
@fragment
fn main() {
)"));
}
@ -162,7 +162,7 @@ TEST_F(SpvParserTest, EmitFunctions_Function_EntryPoint_GLCompute) {
Program program = p->program();
const auto program_ast = test::ToString(program);
EXPECT_THAT(program_ast, HasSubstr(R"(
@stage(compute) @workgroup_size(1i, 1i, 1i)
@compute @workgroup_size(1i, 1i, 1i)
fn main() {
)"));
}
@ -182,11 +182,11 @@ OpExecutionMode %main OriginUpperLeft
Program program = p->program();
const auto program_ast = test::ToString(program);
EXPECT_THAT(program_ast, HasSubstr(R"(
@stage(fragment)
@fragment
fn first_shader() {
)"));
EXPECT_THAT(program_ast, HasSubstr(R"(
@stage(fragment)
@fragment
fn second_shader() {
)"));
}
@ -208,7 +208,7 @@ OpFunctionEnd)";
Program program = p->program();
const auto program_ast = test::ToString(program);
EXPECT_THAT(program_ast, HasSubstr(R"(
@stage(compute) @workgroup_size(2i, 4i, 8i)
@compute @workgroup_size(2i, 4i, 8i)
fn comp_main() {
)")) << program_ast;
}
@ -233,7 +233,7 @@ OpFunctionEnd)";
Program program = p->program();
const auto program_ast = test::ToString(program);
EXPECT_THAT(program_ast, HasSubstr(R"(
@stage(compute) @workgroup_size(3i, 5i, 7i)
@compute @workgroup_size(3i, 5i, 7i)
fn comp_main() {
)")) << program_ast;
}
@ -262,7 +262,7 @@ OpFunctionEnd)";
Program program = p->program();
const auto program_ast = test::ToString(program);
EXPECT_THAT(program_ast, HasSubstr(R"(
@stage(compute) @workgroup_size(3i, 5i, 7i)
@compute @workgroup_size(3i, 5i, 7i)
fn comp_main() {
)")) << program_ast;
}
@ -290,7 +290,7 @@ OpFunctionEnd)";
Program program = p->program();
const auto program_ast = test::ToString(program);
EXPECT_THAT(program_ast, HasSubstr(R"(
@stage(compute) @workgroup_size(3i, 5i, 7i)
@compute @workgroup_size(3i, 5i, 7i)
fn comp_main() {
)")) << program_ast;
}
@ -323,7 +323,7 @@ OpFunctionEnd)";
Program program = p->program();
const auto program_ast = test::ToString(program);
EXPECT_THAT(program_ast, HasSubstr(R"(
@stage(compute) @workgroup_size(3i, 5i, 7i)
@compute @workgroup_size(3i, 5i, 7i)
fn comp_main() {
)")) << program_ast;
}
@ -409,7 +409,7 @@ fn x_100_1() {
return;
}
@stage(fragment)
@fragment
fn x_100() {
x_100_1();
}

View File

@ -460,7 +460,7 @@ struct main_out {
gl_Position : vec4<f32>,
}
@stage(vertex)
@vertex
fn main() -> main_out {
main_1();
return main_out(gl_Position);
@ -519,7 +519,7 @@ struct main_out {
gl_Position : vec4<f32>,
}
@stage(vertex)
@vertex
fn main() -> main_out {
main_1();
return main_out(gl_Position);
@ -575,7 +575,7 @@ struct main_out {
gl_Position : vec4<f32>,
}
@stage(vertex)
@vertex
fn main() -> main_out {
main_1();
return main_out(gl_Position);
@ -634,7 +634,7 @@ struct main_out {
x_2_1 : vec4<f32>,
}
@stage(vertex)
@vertex
fn main() -> main_out {
main_1();
return main_out(x_2);
@ -690,7 +690,7 @@ struct main_out {
x_2_1 : vec4<f32>,
}
@stage(vertex)
@vertex
fn main() -> main_out {
main_1();
return main_out(x_2);
@ -746,7 +746,7 @@ struct main_out {
x_2_1 : vec4<f32>,
}
@stage(vertex)
@vertex
fn main() -> main_out {
main_1();
return main_out(x_2);
@ -782,7 +782,7 @@ struct main_out {
x_2_1 : vec4<f32>,
}
@stage(vertex)
@vertex
fn main() -> main_out {
main_1();
return main_out(x_2);
@ -1650,7 +1650,7 @@ fn main_1() {
return;
}
@stage(fragment)
@fragment
fn main(@builtin(sample_index) x_1_param : u32) {
x_1 = bitcast<i32>(x_1_param);
main_1();
@ -1763,7 +1763,7 @@ fn main_1() {
return;
}
@stage(fragment)
@fragment
fn main(@builtin(sample_index) x_1_param : u32) {
x_1 = bitcast<i32>(x_1_param);
main_1();
@ -1816,7 +1816,7 @@ fn main_1() {
return;
}
@stage(fragment)
@fragment
fn main(@builtin(sample_index) x_1_param : u32) {
x_1 = x_1_param;
main_1();
@ -1846,7 +1846,7 @@ fn main_1() {
return;
}
@stage(fragment)
@fragment
fn main(@builtin(sample_index) x_1_param : u32) {
x_1 = x_1_param;
main_1();
@ -1875,7 +1875,7 @@ fn main_1() {
return;
}
@stage(fragment)
@fragment
fn main(@builtin(sample_index) x_1_param : u32) {
x_1 = x_1_param;
main_1();
@ -1989,7 +1989,7 @@ fn main_1() {
return;
}
@stage(fragment)
@fragment
fn main(@builtin(sample_mask) x_1_param : u32) {
x_1[0i] = x_1_param;
main_1();
@ -2021,7 +2021,7 @@ fn main_1() {
return;
}
@stage(fragment)
@fragment
fn main(@builtin(sample_mask) x_1_param : u32) {
x_1[0i] = x_1_param;
main_1();
@ -2053,7 +2053,7 @@ fn main_1() {
return;
}
@stage(fragment)
@fragment
fn main(@builtin(sample_mask) x_1_param : u32) {
x_1[0i] = x_1_param;
main_1();
@ -2084,7 +2084,7 @@ fn main_1() {
return;
}
@stage(fragment)
@fragment
fn main(@builtin(sample_mask) x_1_param : u32) {
x_1[0i] = bitcast<i32>(x_1_param);
main_1();
@ -2116,7 +2116,7 @@ fn main_1() {
return;
}
@stage(fragment)
@fragment
fn main(@builtin(sample_mask) x_1_param : u32) {
x_1[0i] = bitcast<i32>(x_1_param);
main_1();
@ -2148,7 +2148,7 @@ fn main_1() {
return;
}
@stage(fragment)
@fragment
fn main(@builtin(sample_mask) x_1_param : u32) {
x_1[0i] = bitcast<i32>(x_1_param);
main_1();
@ -2202,7 +2202,7 @@ struct main_out {
x_1_1 : u32,
}
@stage(fragment)
@fragment
fn main() -> main_out {
main_1();
return main_out(x_1[0i]);
@ -2239,7 +2239,7 @@ struct main_out {
x_1_1 : u32,
}
@stage(fragment)
@fragment
fn main() -> main_out {
main_1();
return main_out(x_1[0i]);
@ -2276,7 +2276,7 @@ struct main_out {
x_1_1 : u32,
}
@stage(fragment)
@fragment
fn main() -> main_out {
main_1();
return main_out(x_1[0i]);
@ -2312,7 +2312,7 @@ struct main_out {
x_1_1 : u32,
}
@stage(fragment)
@fragment
fn main() -> main_out {
main_1();
return main_out(bitcast<u32>(x_1[0i]));
@ -2349,7 +2349,7 @@ struct main_out {
x_1_1 : u32,
}
@stage(fragment)
@fragment
fn main() -> main_out {
main_1();
return main_out(bitcast<u32>(x_1[0i]));
@ -2386,7 +2386,7 @@ struct main_out {
x_1_1 : u32,
}
@stage(fragment)
@fragment
fn main() -> main_out {
main_1();
return main_out(bitcast<u32>(x_1[0i]));
@ -2425,7 +2425,7 @@ fn main_1() {
return;
}
@stage(fragment)
@fragment
fn main(@builtin(sample_mask) x_1_param : u32) {
x_1[0i] = x_1_param;
main_1();
@ -2469,7 +2469,7 @@ struct main_out {
x_1_1 : u32,
}
@stage(fragment)
@fragment
fn main() -> main_out {
main_1();
return main_out(x_1[0i]);
@ -2527,7 +2527,7 @@ struct main_out {
x_4_1 : vec4<f32>,
}
@stage(vertex)
@vertex
fn main(@builtin(vertex_index) x_1_param : u32) -> main_out {
x_1 = bitcast<i32>(x_1_param);
main_1();
@ -2565,7 +2565,7 @@ struct main_out {
x_4_1 : vec4<f32>,
}
@stage(vertex)
@vertex
fn main(@builtin(vertex_index) x_1_param : u32) -> main_out {
x_1 = bitcast<i32>(x_1_param);
main_1();
@ -2602,7 +2602,7 @@ struct main_out {
x_4_1 : vec4<f32>,
}
@stage(vertex)
@vertex
fn main(@builtin(vertex_index) x_1_param : u32) -> main_out {
x_1 = bitcast<i32>(x_1_param);
main_1();
@ -2638,7 +2638,7 @@ struct main_out {
x_4_1 : vec4<f32>,
}
@stage(vertex)
@vertex
fn main(@builtin(vertex_index) x_1_param : u32) -> main_out {
x_1 = x_1_param;
main_1();
@ -2676,7 +2676,7 @@ struct main_out {
x_4_1 : vec4<f32>,
}
@stage(vertex)
@vertex
fn main(@builtin(vertex_index) x_1_param : u32) -> main_out {
x_1 = x_1_param;
main_1();
@ -2713,7 +2713,7 @@ struct main_out {
x_4_1 : vec4<f32>,
}
@stage(vertex)
@vertex
fn main(@builtin(vertex_index) x_1_param : u32) -> main_out {
x_1 = x_1_param;
main_1();
@ -2797,7 +2797,7 @@ struct main_out {
position_1 : vec4<f32>,
}
@stage(vertex)
@vertex
fn main(@builtin(instance_index) x_1_param : u32) -> main_out {
x_1 = bitcast<i32>(x_1_param);
main_1();
@ -2835,7 +2835,7 @@ struct main_out {
position_1 : vec4<f32>,
}
@stage(vertex)
@vertex
fn main(@builtin(instance_index) x_1_param : u32) -> main_out {
x_1 = bitcast<i32>(x_1_param);
main_1();
@ -2872,7 +2872,7 @@ struct main_out {
position_1 : vec4<f32>,
}
@stage(vertex)
@vertex
fn main(@builtin(instance_index) x_1_param : u32) -> main_out {
x_1 = bitcast<i32>(x_1_param);
main_1();
@ -2931,7 +2931,7 @@ struct main_out {
position_1 : vec4<f32>,
}
@stage(vertex)
@vertex
fn main(@builtin(instance_index) x_1_param : u32) -> main_out {
x_1 = x_1_param;
main_1();
@ -2969,7 +2969,7 @@ struct main_out {
position_1 : vec4<f32>,
}
@stage(vertex)
@vertex
fn main(@builtin(instance_index) x_1_param : u32) -> main_out {
x_1 = x_1_param;
main_1();
@ -3006,7 +3006,7 @@ struct main_out {
position_1 : vec4<f32>,
}
@stage(vertex)
@vertex
fn main(@builtin(instance_index) x_1_param : u32) -> main_out {
x_1 = x_1_param;
main_1();
@ -3149,7 +3149,7 @@ fn main_1() {
return;
}
@stage(compute) @workgroup_size(1i, 1i, 1i)
@compute @workgroup_size(1i, 1i, 1i)
fn main(@builtin(${wgsl_builtin}) x_1_param : ${unsigned_wgsl_type}) {
x_1 = ${assignment_value};
main_1();
@ -3195,7 +3195,7 @@ fn main_1() {
return;
}
@stage(compute) @workgroup_size(1i, 1i, 1i)
@compute @workgroup_size(1i, 1i, 1i)
fn main(@builtin(${wgsl_builtin}) x_1_param : ${unsigned_wgsl_type}) {
x_1 = ${assignment_value};
main_1();
@ -3240,7 +3240,7 @@ fn main_1() {
return;
}
@stage(compute) @workgroup_size(1i, 1i, 1i)
@compute @workgroup_size(1i, 1i, 1i)
fn main(@builtin(${wgsl_builtin}) x_1_param : ${unsigned_wgsl_type}) {
x_1 = ${assignment_value};
main_1();
@ -3552,7 +3552,7 @@ struct main_out {
x_4_1 : u32,
}
@stage(fragment)
@fragment
fn main(@location(0) @interpolate(flat) x_1_param : u32, @location(30) @interpolate(flat) x_3_param : u32) -> main_out {
x_1 = x_1_param;
x_3 = x_3_param;
@ -3603,7 +3603,7 @@ struct main_out {
x_4_1 : vec4<f32>,
}
@stage(vertex)
@vertex
fn main(@builtin(instance_index) x_1_param : u32) -> main_out {
x_1 = x_1_param;
main_1();
@ -3652,7 +3652,7 @@ struct main_out {
x_4_1 : vec4<f32>,
}
@stage(vertex)
@vertex
fn main(@builtin(instance_index) x_1_param : u32) -> main_out {
x_1 = bitcast<i32>(x_1_param);
main_1();
@ -3692,7 +3692,7 @@ fn main_1() {
return;
}
@stage(fragment)
@fragment
fn main(@builtin(sample_mask) x_1_param : u32) {
x_1[0i] = x_1_param;
main_1();
@ -3730,7 +3730,7 @@ fn main_1() {
return;
}
@stage(fragment)
@fragment
fn main(@builtin(sample_mask) x_1_param : u32) {
x_1[0i] = bitcast<i32>(x_1_param);
main_1();
@ -3776,7 +3776,7 @@ struct main_out {
x_1_1 : u32,
}
@stage(fragment)
@fragment
fn main() -> main_out {
main_1();
return main_out(x_1[0i]);
@ -3822,7 +3822,7 @@ struct main_out {
x_1_1 : u32,
}
@stage(fragment)
@fragment
fn main() -> main_out {
main_1();
return main_out(bitcast<u32>(x_1[0i]));
@ -3865,7 +3865,7 @@ struct main_out {
x_1_1 : f32,
}
@stage(fragment)
@fragment
fn main() -> main_out {
main_1();
return main_out(x_1);
@ -3899,7 +3899,7 @@ struct main_out {
gl_Position : vec4<f32>,
}
@stage(vertex)
@vertex
fn main() -> main_out {
main_1();
return main_out(gl_Position);
@ -3968,7 +3968,7 @@ struct main_out {
gl_Position : vec4<f32>,
}
@stage(vertex)
@vertex
fn main() -> main_out {
main_1();
return main_out(gl_Position);
@ -4025,7 +4025,7 @@ struct main_out {
x_2_1 : vec4<f32>,
}
@stage(vertex)
@vertex
fn main(@location(4) x_1_param : f32, @location(5) x_1_param_1 : f32, @location(6) x_1_param_2 : f32) -> main_out {
x_1[0i] = x_1_param;
x_1[1i] = x_1_param_1;
@ -4083,7 +4083,7 @@ struct main_out {
x_2_1 : vec4<f32>,
}
@stage(vertex)
@vertex
fn main(@location(9) x_1_param : vec4<f32>, @location(10) x_1_param_1 : vec4<f32>) -> main_out {
x_1[0i] = x_1_param;
x_1[1i] = x_1_param_1;
@ -4150,7 +4150,7 @@ struct main_out {
x_2_1 : vec4<f32>,
}
@stage(vertex)
@vertex
fn main(@location(9) x_1_param : f32, @location(10) x_1_param_1 : vec4<f32>) -> main_out {
x_1.alice = x_1_param;
x_1.bob = x_1_param_1;
@ -4209,7 +4209,7 @@ struct main_out {
x_2_1 : vec4<f32>,
}
@stage(vertex)
@vertex
fn main(@location(7) x_1_param : vec4<f32>, @location(8) x_1_param_1 : vec4<f32>, @location(9) x_1_param_2 : vec4<f32>, @location(10) x_1_param_3 : vec4<f32>) -> main_out {
x_1[0i][0i] = x_1_param;
x_1[0i][1i] = x_1_param_1;
@ -4276,7 +4276,7 @@ struct main_out {
x_2_1 : vec4<f32>,
}
@stage(vertex)
@vertex
fn main() -> main_out {
main_1();
return main_out(x_1[0i], x_1[1i], x_1[2i], x_2);
@ -4335,7 +4335,7 @@ struct main_out {
x_2_1 : vec4<f32>,
}
@stage(vertex)
@vertex
fn main() -> main_out {
main_1();
return main_out(x_1[0i], x_1[1i], x_2);
@ -4404,7 +4404,7 @@ struct main_out {
x_2_1 : vec4<f32>,
}
@stage(vertex)
@vertex
fn main() -> main_out {
main_1();
return main_out(x_1.alice, x_1.bob, x_2);
@ -4479,7 +4479,7 @@ struct main_out {
x_3_2 : vec4<f32>,
}
@stage(vertex)
@vertex
fn main(@location(9) x_1_param : f32, @location(11) x_1_param_1 : vec4<f32>) -> main_out {
x_1.alice = x_1_param;
x_1.bob = x_1_param_1;
@ -4558,7 +4558,7 @@ struct main_out {
x_10_1 : vec4<f32>,
}
@stage(vertex)
@vertex
fn main(@location(1) @interpolate(flat) x_1_param : u32, @location(2) @interpolate(flat) x_2_param : vec2<u32>, @location(3) @interpolate(flat) x_3_param : i32, @location(4) @interpolate(flat) x_4_param : vec2<i32>, @location(5) @interpolate(flat) x_5_param : f32, @location(6) @interpolate(flat) x_6_param : vec2<f32>) -> main_out {
x_1 = x_1_param;
x_2 = x_2_param;
@ -4653,7 +4653,7 @@ struct main_out {
x_10_1 : vec4<f32>,
}
@stage(vertex)
@vertex
fn main() -> main_out {
main_1();
return main_out(x_1, x_2, x_3, x_4, x_5, x_6, x_10);
@ -4703,7 +4703,7 @@ fn main_1() {
return;
}
@stage(fragment)
@fragment
fn main(@location(1) @interpolate(flat) x_1_param : f32, @location(2) @interpolate(flat) x_1_param_1 : f32, @location(5) @interpolate(flat) x_2_param : f32, @location(6) @interpolate(flat) x_2_param_1 : f32) {
x_1[0i] = x_1_param;
x_1[1i] = x_1_param_1;
@ -4777,7 +4777,7 @@ fn main_1() {
return;
}
@stage(fragment)
@fragment
fn main(@location(1) x_1_param : f32, @location(2) @interpolate(perspective, centroid) x_2_param : f32, @location(3) @interpolate(perspective, sample) x_3_param : f32, @location(4) @interpolate(linear) x_4_param : f32, @location(5) @interpolate(linear, centroid) x_5_param : f32, @location(6) @interpolate(linear, sample) x_6_param : f32) {
x_1 = x_1_param;
x_2 = x_2_param;
@ -4844,7 +4844,7 @@ fn main_1() {
return;
}
@stage(fragment)
@fragment
fn main(@location(1) x_1_param : f32, @location(2) @interpolate(perspective, centroid) x_1_param_1 : f32, @location(3) @interpolate(perspective, sample) x_1_param_2 : f32, @location(4) @interpolate(linear) x_1_param_3 : f32, @location(5) @interpolate(linear, centroid) x_1_param_4 : f32, @location(6) @interpolate(linear, sample) x_1_param_5 : f32) {
x_1.field0 = x_1_param;
x_1.field1 = x_1_param_1;
@ -4935,7 +4935,7 @@ struct main_out {
x_6_1 : f32,
}
@stage(fragment)
@fragment
fn main() -> main_out {
main_1();
return main_out(x_1, x_2, x_3, x_4, x_5, x_6);
@ -5014,7 +5014,7 @@ struct main_out {
x_1_6 : f32,
}
@stage(fragment)
@fragment
fn main() -> main_out {
main_1();
return main_out(x_1.field0, x_1.field1, x_1.field2, x_1.field3, x_1.field4, x_1.field5);
@ -5100,7 +5100,7 @@ struct main_out {
x_10_1 : vec4<f32>,
}
@stage(vertex)
@vertex
fn main() -> main_out {
main_1();
return main_out(x_1, x_2, x_3, x_4, x_5, x_6, x_10);
@ -5163,7 +5163,7 @@ fn main_1() {
return;
}
@stage(fragment)
@fragment
fn main(@location(1) @interpolate(flat) x_1_param : u32, @location(2) @interpolate(flat) x_2_param : vec2<u32>, @location(3) @interpolate(flat) x_3_param : i32, @location(4) @interpolate(flat) x_4_param : vec2<i32>, @location(5) x_5_param : f32, @location(6) x_6_param : vec2<f32>) {
x_1 = x_1_param;
x_2 = x_2_param;

View File

@ -306,6 +306,7 @@ fn f() { for (var i : i32 = 0; i < 8; i=i+1) {
)");
}
// TODO(crbug.com/tint/1503): Remove this when @stage is removed
TEST_F(ParserImplErrorTest, FunctionDeclStageMissingLParen) {
EXPECT("@stage vertex) fn f() {}",
R"(test.wgsl:1:8 error: expected '(' for stage attribute
@ -566,9 +567,9 @@ let i : vec2<i32> = vec2<i32>(1, 2;
}
TEST_F(ParserImplErrorTest, GlobalDeclInvalidAttribute) {
EXPECT("@stage(vertex) x;",
R"(test.wgsl:1:16 error: expected declaration after attributes
@stage(vertex) x;
EXPECT("@vertex x;",
R"(test.wgsl:1:9 error: expected declaration after attributes
@vertex x;
^
)");
}

View File

@ -18,6 +18,7 @@
namespace tint::reader::wgsl {
namespace {
// TODO(crbug.com/tint/1503): Remove this when @stage is removed
TEST_F(ParserImplTest, AttributeList_Parses_Stage) {
auto p = parser("@workgroup_size(2) @stage(compute)");
auto attrs = p->attribute_list();

View File

@ -212,6 +212,7 @@ TEST_F(ParserImplTest, Attribute_Workgroup_Missing_Z_Value) {
EXPECT_EQ(p->error(), "1:22: expected workgroup_size z parameter");
}
// TODO(crbug.com/tint/1503): Remove when @stage is removed
TEST_F(ParserImplTest, Attribute_Stage) {
auto p = parser("stage(compute)");
auto attr = p->attribute();

View File

@ -137,7 +137,7 @@ TEST_F(ParserImplTest, FunctionDecl_AttributeList) {
TEST_F(ParserImplTest, FunctionDecl_AttributeList_MultipleEntries) {
auto p = parser(R"(
@workgroup_size(2, 3, 4) @stage(compute)
@workgroup_size(2, 3, 4) @compute
fn main() { return; })");
auto attrs = p->attribute_list();
EXPECT_FALSE(p->has_error()) << p->error();
@ -186,7 +186,7 @@ fn main() { return; })");
TEST_F(ParserImplTest, FunctionDecl_AttributeList_MultipleLists) {
auto p = parser(R"(
@workgroup_size(2, 3, 4)
@stage(compute)
@compute
fn main() { return; })");
auto attributes = p->attribute_list();
EXPECT_FALSE(p->has_error()) << p->error();

View File

@ -24,7 +24,7 @@ TEST_F(ParserImplTest, Empty) {
TEST_F(ParserImplTest, Parses) {
auto p = parser(R"(
@stage(fragment)
@fragment
fn main() -> @location(0) vec4<f32> {
return vec4<f32>(.4, .2, .3, 1);
}
@ -112,7 +112,7 @@ TEST_F(ParserImplTest, Comments_TerminatedBlockComment) {
* /* I can nest /**/ comments. */
* // I can nest line comments too.
**/
@stage(fragment) // This is the stage
@fragment // This is the stage
fn main(/*
no
parameters
@ -126,7 +126,7 @@ parameters
TEST_F(ParserImplTest, Comments_UnterminatedBlockComment) {
auto p = parser(R"(
@stage(fragment)
@fragment
fn main() -> @location(0) vec4<f32> {
return vec4<f32>(.4, .2, .3, 1);
} /* unterminated block comments are invalid ...)");

View File

@ -32,7 +32,7 @@ TEST_F(ParserTest, Empty) {
TEST_F(ParserTest, Parses) {
Source::File file("test.wgsl", R"(
@stage(fragment)
@fragment
fn main() -> @location(0) vec4<f32> {
return vec4<f32>(.4, .2, .3, 1.);
}

View File

@ -34,7 +34,7 @@ TEST_F(ResolverBuiltinValidationTest, FunctionTypeMustMatchReturnStatementType_v
}
TEST_F(ResolverBuiltinValidationTest, InvalidPipelineStageDirect) {
// @stage(compute) @workgroup_size(1) fn func { return dpdx(1.0); }
// @compute @workgroup_size(1) fn func { return dpdx(1.0); }
auto* dpdx =
create<ast::CallExpression>(Source{{3, 4}}, Expr("dpdx"), ast::ExpressionList{Expr(1_f)});
@ -49,7 +49,7 @@ TEST_F(ResolverBuiltinValidationTest, InvalidPipelineStageIndirect) {
// fn f0 { return dpdx(1.0); }
// fn f1 { f0(); }
// fn f2 { f1(); }
// @stage(compute) @workgroup_size(1) fn main { return f2(); }
// @compute @workgroup_size(1) fn main { return f2(); }
auto* dpdx =
create<ast::CallExpression>(Source{{3, 4}}, Expr("dpdx"), ast::ExpressionList{Expr(1_f)});

View File

@ -126,7 +126,7 @@ INSTANTIATE_TEST_SUITE_P(ResolverBuiltinsValidationTest,
testing::ValuesIn(cases));
TEST_F(ResolverBuiltinsValidationTest, FragDepthIsInput_Fail) {
// @stage(fragment)
// @fragment
// fn fs_main(
// @builtin(frag_depth) fd: f32,
// ) -> @location(0) f32 { return 1.0; }
@ -144,7 +144,7 @@ TEST_F(ResolverBuiltinsValidationTest, FragDepthIsInputStruct_Fail) {
// struct MyInputs {
// @builtin(frag_depth) ff: f32;
// };
// @stage(fragment)
// @fragment
// fn fragShader(arg: MyInputs) -> @location(0) f32 { return 1.0; }
auto* s = Structure(
@ -165,7 +165,7 @@ TEST_F(ResolverBuiltinsValidationTest, StructBuiltinInsideEntryPoint_Ignored) {
// struct S {
// @builtin(vertex_index) idx: u32;
// };
// @stage(fragment)
// @fragment
// fn fragShader() { var s : S; }
Structure("S", {Member("idx", ty.u32(), {Builtin(ast::Builtin::kVertexIndex)})});
@ -181,7 +181,7 @@ TEST_F(ResolverBuiltinsValidationTest, PositionNotF32_Struct_Fail) {
// struct MyInputs {
// @builtin(kPosition) p: vec4<u32>;
// };
// @stage(fragment)
// @fragment
// fn fragShader(is_front: MyInputs) -> @location(0) f32 { return 1.0; }
auto* m = Member("position", ty.vec4<u32>(),
@ -195,7 +195,7 @@ TEST_F(ResolverBuiltinsValidationTest, PositionNotF32_Struct_Fail) {
}
TEST_F(ResolverBuiltinsValidationTest, PositionNotF32_ReturnType_Fail) {
// @stage(vertex)
// @vertex
// fn main() -> @builtin(position) f32 { return 1.0; }
Func("main", {}, ty.f32(), {Return(1_f)}, {Stage(ast::PipelineStage::kVertex)},
{Builtin(Source{{12, 34}}, ast::Builtin::kPosition)});
@ -208,7 +208,7 @@ TEST_F(ResolverBuiltinsValidationTest, FragDepthNotF32_Struct_Fail) {
// struct MyInputs {
// @builtin(kFragDepth) p: i32;
// };
// @stage(fragment)
// @fragment
// fn fragShader(is_front: MyInputs) -> @location(0) f32 { return 1.0; }
auto* m = Member("frag_depth", ty.i32(),
@ -225,7 +225,7 @@ TEST_F(ResolverBuiltinsValidationTest, SampleMaskNotU32_Struct_Fail) {
// struct MyInputs {
// @builtin(sample_mask) m: f32;
// };
// @stage(fragment)
// @fragment
// fn fragShader(is_front: MyInputs) -> @location(0) f32 { return 1.0; }
auto* s = Structure(
@ -240,7 +240,7 @@ TEST_F(ResolverBuiltinsValidationTest, SampleMaskNotU32_Struct_Fail) {
}
TEST_F(ResolverBuiltinsValidationTest, SampleMaskNotU32_ReturnType_Fail) {
// @stage(fragment)
// @fragment
// fn main() -> @builtin(sample_mask) i32 { return 1; }
Func("main", {}, ty.i32(), {Return(1_i)}, {Stage(ast::PipelineStage::kFragment)},
{Builtin(Source{{12, 34}}, ast::Builtin::kSampleMask)});
@ -250,7 +250,7 @@ TEST_F(ResolverBuiltinsValidationTest, SampleMaskNotU32_ReturnType_Fail) {
}
TEST_F(ResolverBuiltinsValidationTest, SampleMaskIsNotU32_Fail) {
// @stage(fragment)
// @fragment
// fn fs_main(
// @builtin(sample_mask) arg: bool
// ) -> @location(0) f32 { return 1.0; }
@ -266,7 +266,7 @@ TEST_F(ResolverBuiltinsValidationTest, SampleIndexIsNotU32_Struct_Fail) {
// struct MyInputs {
// @builtin(sample_index) m: f32;
// };
// @stage(fragment)
// @fragment
// fn fragShader(is_front: MyInputs) -> @location(0) f32 { return 1.0; }
auto* s = Structure(
@ -281,7 +281,7 @@ TEST_F(ResolverBuiltinsValidationTest, SampleIndexIsNotU32_Struct_Fail) {
}
TEST_F(ResolverBuiltinsValidationTest, SampleIndexIsNotU32_Fail) {
// @stage(fragment)
// @fragment
// fn fs_main(
// @builtin(sample_index) arg: bool
// ) -> @location(0) f32 { return 1.0; }
@ -294,7 +294,7 @@ TEST_F(ResolverBuiltinsValidationTest, SampleIndexIsNotU32_Fail) {
}
TEST_F(ResolverBuiltinsValidationTest, PositionIsNotF32_Fail) {
// @stage(fragment)
// @fragment
// fn fs_main(
// @builtin(kPosition) p: vec3<f32>,
// ) -> @location(0) f32 { return 1.0; }
@ -307,7 +307,7 @@ TEST_F(ResolverBuiltinsValidationTest, PositionIsNotF32_Fail) {
}
TEST_F(ResolverBuiltinsValidationTest, FragDepthIsNotF32_Fail) {
// @stage(fragment)
// @fragment
// fn fs_main() -> @builtin(kFragDepth) f32 { var fd: i32; return fd; }
auto* fd = Var("fd", ty.i32());
Func("fs_main", {}, ty.i32(), {Decl(fd), Return(fd)},
@ -318,7 +318,7 @@ TEST_F(ResolverBuiltinsValidationTest, FragDepthIsNotF32_Fail) {
}
TEST_F(ResolverBuiltinsValidationTest, VertexIndexIsNotU32_Fail) {
// @stage(vertex)
// @vertex
// fn main(
// @builtin(kVertexIndex) vi : f32,
// @builtin(kPosition) p :vec4<f32>
@ -334,7 +334,7 @@ TEST_F(ResolverBuiltinsValidationTest, VertexIndexIsNotU32_Fail) {
}
TEST_F(ResolverBuiltinsValidationTest, InstanceIndexIsNotU32) {
// @stage(vertex)
// @vertex
// fn main(
// @builtin(kInstanceIndex) ii : f32,
// @builtin(kPosition) p :vec4<f32>
@ -350,7 +350,7 @@ TEST_F(ResolverBuiltinsValidationTest, InstanceIndexIsNotU32) {
}
TEST_F(ResolverBuiltinsValidationTest, FragmentBuiltin_Pass) {
// @stage(fragment)
// @fragment
// fn fs_main(
// @builtin(kPosition) p: vec4<f32>,
// @builtin(front_facing) ff: bool,
@ -369,7 +369,7 @@ TEST_F(ResolverBuiltinsValidationTest, FragmentBuiltin_Pass) {
}
TEST_F(ResolverBuiltinsValidationTest, VertexBuiltin_Pass) {
// @stage(vertex)
// @vertex
// fn main(
// @builtin(vertex_index) vi : u32,
// @builtin(instance_index) ii : u32,
@ -392,7 +392,7 @@ TEST_F(ResolverBuiltinsValidationTest, VertexBuiltin_Pass) {
}
TEST_F(ResolverBuiltinsValidationTest, ComputeBuiltin_Pass) {
// @stage(compute) @workgroup_size(1)
// @compute @workgroup_size(1)
// fn main(
// @builtin(local_invocationId) li_id: vec3<u32>,
// @builtin(local_invocationIndex) li_index: u32,
@ -493,7 +493,7 @@ TEST_F(ResolverBuiltinsValidationTest, FragmentBuiltinStruct_Pass) {
// @builtin(sample_index) si: u32;
// @builtin(sample_mask) sm : u32;;
// };
// @stage(fragment)
// @fragment
// fn fragShader(arg: MyInputs) -> @location(0) f32 { return 1.0; }
auto* s = Structure(
@ -509,7 +509,7 @@ TEST_F(ResolverBuiltinsValidationTest, FragmentBuiltinStruct_Pass) {
}
TEST_F(ResolverBuiltinsValidationTest, FrontFacingParamIsNotBool_Fail) {
// @stage(fragment)
// @fragment
// fn fs_main(
// @builtin(front_facing) is_front: i32;
// ) -> @location(0) f32 { return 1.0; }
@ -528,7 +528,7 @@ TEST_F(ResolverBuiltinsValidationTest, FrontFacingMemberIsNotBool_Fail) {
// struct MyInputs {
// @builtin(front_facing) pos: f32;
// };
// @stage(fragment)
// @fragment
// fn fragShader(is_front: MyInputs) -> @location(0) f32 { return 1.0; }
auto* s = Structure(

View File

@ -163,7 +163,7 @@ TEST_F(ResolverCallValidationTest, PointerArgument_FunctionParamWithMain) {
// fn bar(p: ptr<function, i32>) {
// foo(p);
// }
// @stage(fragment)
// @fragment
// fn main() {
// var v: i32;
// bar(&v);
@ -185,7 +185,7 @@ TEST_F(ResolverCallValidationTest, PointerArgument_FunctionParamWithMain) {
TEST_F(ResolverCallValidationTest, LetPointer) {
// fn x(p : ptr<function, i32>) -> i32 {}
// @stage(fragment)
// @fragment
// fn main() {
// var v: i32;
// let p: ptr<function, i32> = &v;
@ -214,7 +214,7 @@ TEST_F(ResolverCallValidationTest, LetPointerPrivate) {
// let p: ptr<private, i32> = &v;
// fn foo(p : ptr<private, i32>) -> i32 {}
// var v: i32;
// @stage(fragment)
// @fragment
// fn main() {
// var c: i32 = foo(p);
// }

View File

@ -47,7 +47,7 @@ using alias = builder::alias<T>;
class ResolverEntryPointValidationTest : public TestHelper, public testing::Test {};
TEST_F(ResolverEntryPointValidationTest, ReturnTypeAttribute_Location) {
// @stage(fragment)
// @fragment
// fn main() -> @location(0) f32 { return 1.0; }
Func(Source{{12, 34}}, "main", {}, ty.f32(), {Return(1_f)},
{Stage(ast::PipelineStage::kFragment)}, {Location(0)});
@ -56,7 +56,7 @@ TEST_F(ResolverEntryPointValidationTest, ReturnTypeAttribute_Location) {
}
TEST_F(ResolverEntryPointValidationTest, ReturnTypeAttribute_Builtin) {
// @stage(vertex)
// @vertex
// fn main() -> @builtin(position) vec4<f32> { return vec4<f32>(); }
Func(Source{{12, 34}}, "main", {}, ty.vec4<f32>(), {Return(Construct(ty.vec4<f32>()))},
{Stage(ast::PipelineStage::kVertex)}, {Builtin(ast::Builtin::kPosition)});
@ -65,7 +65,7 @@ TEST_F(ResolverEntryPointValidationTest, ReturnTypeAttribute_Builtin) {
}
TEST_F(ResolverEntryPointValidationTest, ReturnTypeAttribute_Missing) {
// @stage(vertex)
// @vertex
// fn main() -> f32 {
// return 1.0;
// }
@ -77,7 +77,7 @@ TEST_F(ResolverEntryPointValidationTest, ReturnTypeAttribute_Missing) {
}
TEST_F(ResolverEntryPointValidationTest, ReturnTypeAttribute_Multiple) {
// @stage(vertex)
// @vertex
// fn main() -> @location(0) @builtin(position) vec4<f32> {
// return vec4<f32>();
// }
@ -95,7 +95,7 @@ TEST_F(ResolverEntryPointValidationTest, ReturnType_Struct_Valid) {
// @location(0) a : f32;
// @builtin(frag_depth) b : f32;
// };
// @stage(fragment)
// @fragment
// fn main() -> Output {
// return Output();
// }
@ -112,7 +112,7 @@ TEST_F(ResolverEntryPointValidationTest, ReturnType_Struct_MemberMultipleAttribu
// struct Output {
// @location(0) @builtin(frag_depth) a : f32;
// };
// @stage(fragment)
// @fragment
// fn main() -> Output {
// return Output();
// }
@ -134,7 +134,7 @@ TEST_F(ResolverEntryPointValidationTest, ReturnType_Struct_MemberMissingAttribut
// @location(0) a : f32;
// b : f32;
// };
// @stage(fragment)
// @fragment
// fn main() -> Output {
// return Output();
// }
@ -154,7 +154,7 @@ TEST_F(ResolverEntryPointValidationTest, ReturnType_Struct_DuplicateBuiltins) {
// @builtin(frag_depth) a : f32;
// @builtin(frag_depth) b : f32;
// };
// @stage(fragment)
// @fragment
// fn main() -> Output {
// return Output();
// }
@ -172,7 +172,7 @@ TEST_F(ResolverEntryPointValidationTest, ReturnType_Struct_DuplicateBuiltins) {
}
TEST_F(ResolverEntryPointValidationTest, ParameterAttribute_Location) {
// @stage(fragment)
// @fragment
// fn main(@location(0) param : f32) {}
auto* param = Param("param", ty.f32(), {Location(0)});
Func(Source{{12, 34}}, "main", {param}, ty.void_(), {}, {Stage(ast::PipelineStage::kFragment)});
@ -181,7 +181,7 @@ TEST_F(ResolverEntryPointValidationTest, ParameterAttribute_Location) {
}
TEST_F(ResolverEntryPointValidationTest, ParameterAttribute_Missing) {
// @stage(fragment)
// @fragment
// fn main(param : f32) {}
auto* param = Param(Source{{13, 43}}, "param", ty.vec4<f32>());
Func(Source{{12, 34}}, "main", {param}, ty.void_(), {}, {Stage(ast::PipelineStage::kFragment)});
@ -191,7 +191,7 @@ TEST_F(ResolverEntryPointValidationTest, ParameterAttribute_Missing) {
}
TEST_F(ResolverEntryPointValidationTest, ParameterAttribute_Multiple) {
// @stage(fragment)
// @fragment
// fn main(@location(0) @builtin(sample_index) param : u32) {}
auto* param = Param(
"param", ty.u32(),
@ -208,7 +208,7 @@ TEST_F(ResolverEntryPointValidationTest, Parameter_Struct_Valid) {
// @location(0) a : f32;
// @builtin(sample_index) b : u32;
// };
// @stage(fragment)
// @fragment
// fn main(param : Input) {}
auto* input =
Structure("Input", {Member("a", ty.f32(), {Location(0)}),
@ -223,7 +223,7 @@ TEST_F(ResolverEntryPointValidationTest, Parameter_Struct_MemberMultipleAttribut
// struct Input {
// @location(0) @builtin(sample_index) a : u32;
// };
// @stage(fragment)
// @fragment
// fn main(param : Input) {}
auto* input =
Structure("Input", {Member("a", ty.u32(),
@ -243,7 +243,7 @@ TEST_F(ResolverEntryPointValidationTest, Parameter_Struct_MemberMissingAttribute
// @location(0) a : f32;
// b : f32;
// };
// @stage(fragment)
// @fragment
// fn main(param : Input) {}
auto* input = Structure("Input", {Member(Source{{13, 43}}, "a", ty.f32(), {Location(0)}),
Member(Source{{14, 52}}, "b", ty.f32(), {})});
@ -256,7 +256,7 @@ TEST_F(ResolverEntryPointValidationTest, Parameter_Struct_MemberMissingAttribute
}
TEST_F(ResolverEntryPointValidationTest, Parameter_DuplicateBuiltins) {
// @stage(fragment)
// @fragment
// fn main(@builtin(sample_index) param_a : u32,
// @builtin(sample_index) param_b : u32) {}
auto* param_a = Param("param_a", ty.u32(), {Builtin(ast::Builtin::kSampleIndex)});
@ -277,7 +277,7 @@ TEST_F(ResolverEntryPointValidationTest, Parameter_Struct_DuplicateBuiltins) {
// struct InputB {
// @builtin(sample_index) a : u32;
// };
// @stage(fragment)
// @fragment
// fn main(param_a : InputA, param_b : InputB) {}
auto* input_a =
Structure("InputA", {Member("a", ty.u32(), {Builtin(ast::Builtin::kSampleIndex)})});
@ -296,7 +296,7 @@ TEST_F(ResolverEntryPointValidationTest, Parameter_Struct_DuplicateBuiltins) {
}
TEST_F(ResolverEntryPointValidationTest, VertexShaderMustReturnPosition) {
// @stage(vertex)
// @vertex
// fn main() {}
Func(Source{{12, 34}}, "main", {}, ty.void_(), {}, {Stage(ast::PipelineStage::kVertex)});
@ -337,7 +337,7 @@ static constexpr Params cases[] = {
};
TEST_P(TypeValidationTest, BareInputs) {
// @stage(fragment)
// @fragment
// fn main(@location(0) @interpolate(flat) a : *) {}
auto params = GetParam();
auto* a = Param("a", params.create_ast_type(*this), {Location(0), Flat()});
@ -354,7 +354,7 @@ TEST_P(TypeValidationTest, StructInputs) {
// struct Input {
// @location(0) @interpolate(flat) a : *;
// };
// @stage(fragment)
// @fragment
// fn main(a : Input) {}
auto params = GetParam();
auto* input =
@ -370,7 +370,7 @@ TEST_P(TypeValidationTest, StructInputs) {
}
TEST_P(TypeValidationTest, BareOutputs) {
// @stage(fragment)
// @fragment
// fn main() -> @location(0) * {
// return *();
// }
@ -390,7 +390,7 @@ TEST_P(TypeValidationTest, StructOutputs) {
// struct Output {
// @location(0) a : *;
// };
// @stage(fragment)
// @fragment
// fn main() -> Output {
// return Output();
// }
@ -416,7 +416,7 @@ namespace {
using LocationAttributeTests = ResolverTest;
TEST_F(LocationAttributeTests, Pass) {
// @stage(fragment)
// @fragment
// fn frag_main(@location(0) @interpolate(flat) a: i32) {}
auto* p = Param(Source{{12, 34}}, "a", ty.i32(), {Location(0), Flat()});
@ -426,7 +426,7 @@ TEST_F(LocationAttributeTests, Pass) {
}
TEST_F(LocationAttributeTests, BadType_Input_bool) {
// @stage(fragment)
// @fragment
// fn frag_main(@location(0) a: bool) {}
auto* p = Param(Source{{12, 34}}, "a", ty.bool_(), {Location(Source{{34, 56}}, 0)});
@ -441,7 +441,7 @@ TEST_F(LocationAttributeTests, BadType_Input_bool) {
}
TEST_F(LocationAttributeTests, BadType_Output_Array) {
// @stage(fragment)
// @fragment
// fn frag_main()->@location(0) array<f32, 2> { return array<f32, 2>(); }
Func(Source{{12, 34}}, "frag_main", {}, ty.array<f32, 2>(),
@ -460,7 +460,7 @@ TEST_F(LocationAttributeTests, BadType_Input_Struct) {
// struct Input {
// a : f32;
// };
// @stage(fragment)
// @fragment
// fn main(@location(0) param : Input) {}
auto* input = Structure("Input", {Member("a", ty.f32())});
auto* param = Param(Source{{12, 34}}, "param", ty.Of(input), {Location(Source{{13, 43}}, 0)});
@ -481,7 +481,7 @@ TEST_F(LocationAttributeTests, BadType_Input_Struct_NestedStruct) {
// struct Input {
// a : Inner;
// };
// @stage(fragment)
// @fragment
// fn main(param : Input) {}
auto* inner = Structure("Inner", {Member(Source{{13, 43}}, "a", ty.f32(), {Location(0)})});
auto* input = Structure("Input", {Member(Source{{14, 52}}, "a", ty.Of(inner))});
@ -498,7 +498,7 @@ TEST_F(LocationAttributeTests, BadType_Input_Struct_RuntimeArray) {
// struct Input {
// @location(0) a : array<f32>;
// };
// @stage(fragment)
// @fragment
// fn main(param : Input) {}
auto* input =
Structure("Input", {Member(Source{{13, 43}}, "a", ty.array<f32>(), {Location(0)})});
@ -515,7 +515,7 @@ TEST_F(LocationAttributeTests, BadType_Input_Struct_RuntimeArray) {
TEST_F(LocationAttributeTests, BadMemberType_Input) {
// struct S { @location(0) m: array<i32>; };
// @stage(fragment)
// @fragment
// fn frag_main( a: S) {}
auto* m = Member(Source{{34, 56}}, "m", ty.array<i32>(),
@ -535,7 +535,7 @@ TEST_F(LocationAttributeTests, BadMemberType_Input) {
TEST_F(LocationAttributeTests, BadMemberType_Output) {
// struct S { @location(0) m: atomic<i32>; };
// @stage(fragment)
// @fragment
// fn frag_main() -> S {}
auto* m = Member(Source{{34, 56}}, "m", ty.atomic<i32>(),
ast::AttributeList{Location(Source{{12, 34}}, 0u)});
@ -572,7 +572,7 @@ TEST_F(LocationAttributeTests, ReturnType_Struct_Valid) {
// @location(0) a : f32;
// @builtin(frag_depth) b : f32;
// };
// @stage(fragment)
// @fragment
// fn main() -> Output {
// return Output();
// }
@ -589,7 +589,7 @@ TEST_F(LocationAttributeTests, ReturnType_Struct) {
// struct Output {
// a : f32;
// };
// @stage(vertex)
// @vertex
// fn main() -> @location(0) Output {
// return Output();
// }
@ -612,7 +612,7 @@ TEST_F(LocationAttributeTests, ReturnType_Struct_NestedStruct) {
// struct Output {
// a : Inner;
// };
// @stage(fragment)
// @fragment
// fn main() -> Output { return Output(); }
auto* inner = Structure("Inner", {Member(Source{{13, 43}}, "a", ty.f32(), {Location(0)})});
auto* output = Structure("Output", {Member(Source{{14, 52}}, "a", ty.Of(inner))});
@ -629,7 +629,7 @@ TEST_F(LocationAttributeTests, ReturnType_Struct_RuntimeArray) {
// struct Output {
// @location(0) a : array<f32>;
// };
// @stage(fragment)
// @fragment
// fn main() -> Output {
// return Output();
// }
@ -695,7 +695,7 @@ TEST_F(LocationAttributeTests, ComputeShaderLocationStructMember_Input) {
}
TEST_F(LocationAttributeTests, Duplicate_input) {
// @stage(fragment)
// @fragment
// fn main(@location(1) param_a : f32,
// @location(1) param_b : f32) {}
auto* param_a = Param("param_a", ty.f32(), {Location(1)});
@ -714,7 +714,7 @@ TEST_F(LocationAttributeTests, Duplicate_struct) {
// struct InputB {
// @location(1) a : f32;
// };
// @stage(fragment)
// @fragment
// fn main(param_a : InputA, param_b : InputB) {}
auto* input_a = Structure("InputA", {Member("a", ty.f32(), {Location(1)})});
auto* input_b = Structure("InputB", {Member("a", ty.f32(), {Location(Source{{34, 56}}, 1)})});

View File

@ -342,7 +342,7 @@ TEST_F(ResolverFunctionValidationTest, FunctionTypeMustMatchReturnStatementTypeF
}
TEST_F(ResolverFunctionValidationTest, CannotCallEntryPoint) {
// @stage(compute) @workgroup_size(1) fn entrypoint() {}
// @compute @workgroup_size(1) fn entrypoint() {}
// fn func() { return entrypoint(); }
Func("entrypoint", {}, ty.void_(), {},
{Stage(ast::PipelineStage::kCompute), WorkgroupSize(1_i)});
@ -359,8 +359,8 @@ TEST_F(ResolverFunctionValidationTest, CannotCallEntryPoint) {
}
TEST_F(ResolverFunctionValidationTest, PipelineStage_MustBeUnique_Fail) {
// @stage(fragment)
// @stage(vertex)
// @fragment
// @vertex
// fn main() { return; }
Func(Source{{12, 34}}, "main", {}, ty.void_(),
{
@ -425,7 +425,7 @@ TEST_F(ResolverFunctionValidationTest, FunctionParamsConst) {
TEST_F(ResolverFunctionValidationTest, WorkgroupSize_GoodType_ConstU32) {
// let x = 4u;
// let x = 8u;
// @stage(compute) @workgroup_size(x, y, 16u)
// @compute @workgroup_size(x, y, 16u)
// fn main() {}
auto* x = GlobalConst("x", ty.u32(), Expr(4_u));
auto* y = GlobalConst("y", ty.u32(), Expr(8_u));
@ -447,7 +447,7 @@ TEST_F(ResolverFunctionValidationTest, WorkgroupSize_GoodType_ConstU32) {
}
TEST_F(ResolverFunctionValidationTest, WorkgroupSize_GoodType_I32) {
// @stage(compute) @workgroup_size(1i, 2i, 3i)
// @compute @workgroup_size(1i, 2i, 3i)
// fn main() {}
Func("main", {}, ty.void_(), {},
@ -457,7 +457,7 @@ TEST_F(ResolverFunctionValidationTest, WorkgroupSize_GoodType_I32) {
}
TEST_F(ResolverFunctionValidationTest, WorkgroupSize_GoodType_U32) {
// @stage(compute) @workgroup_size(1u, 2u, 3u)
// @compute @workgroup_size(1u, 2u, 3u)
// fn main() {}
Func("main", {}, ty.void_(), {},
@ -467,7 +467,7 @@ TEST_F(ResolverFunctionValidationTest, WorkgroupSize_GoodType_U32) {
}
TEST_F(ResolverFunctionValidationTest, WorkgroupSize_GoodType_I32_AInt) {
// @stage(compute) @workgroup_size(1, 2i, 3)
// @compute @workgroup_size(1, 2i, 3)
// fn main() {}
Func("main", {}, ty.void_(), {},
@ -477,7 +477,7 @@ TEST_F(ResolverFunctionValidationTest, WorkgroupSize_GoodType_I32_AInt) {
}
TEST_F(ResolverFunctionValidationTest, WorkgroupSize_GoodType_U32_AInt) {
// @stage(compute) @workgroup_size(1u, 2, 3u)
// @compute @workgroup_size(1u, 2, 3u)
// fn main() {}
Func("main", {}, ty.void_(), {},
@ -487,7 +487,7 @@ TEST_F(ResolverFunctionValidationTest, WorkgroupSize_GoodType_U32_AInt) {
}
TEST_F(ResolverFunctionValidationTest, WorkgroupSize_MismatchType_U32) {
// @stage(compute) @workgroup_size(1u, 2, 3_i)
// @compute @workgroup_size(1u, 2, 3_i)
// fn main() {}
Func("main", {}, ty.void_(), {},
@ -499,7 +499,7 @@ TEST_F(ResolverFunctionValidationTest, WorkgroupSize_MismatchType_U32) {
}
TEST_F(ResolverFunctionValidationTest, WorkgroupSize_MismatchType_I32) {
// @stage(compute) @workgroup_size(1_i, 2u, 3)
// @compute @workgroup_size(1_i, 2u, 3)
// fn main() {}
Func("main", {}, ty.void_(), {},
@ -512,7 +512,7 @@ TEST_F(ResolverFunctionValidationTest, WorkgroupSize_MismatchType_I32) {
TEST_F(ResolverFunctionValidationTest, WorkgroupSize_Const_TypeMismatch) {
// let x = 64u;
// @stage(compute) @workgroup_size(1i, x)
// @compute @workgroup_size(1i, x)
// fn main() {}
GlobalConst("x", ty.u32(), Expr(64_u));
Func("main", {}, ty.void_(), {},
@ -526,7 +526,7 @@ TEST_F(ResolverFunctionValidationTest, WorkgroupSize_Const_TypeMismatch) {
TEST_F(ResolverFunctionValidationTest, WorkgroupSize_Const_TypeMismatch2) {
// let x = 64u;
// let y = 32i;
// @stage(compute) @workgroup_size(x, y)
// @compute @workgroup_size(x, y)
// fn main() {}
GlobalConst("x", ty.u32(), Expr(64_u));
GlobalConst("y", ty.i32(), Expr(32_i));
@ -540,7 +540,7 @@ TEST_F(ResolverFunctionValidationTest, WorkgroupSize_Const_TypeMismatch2) {
TEST_F(ResolverFunctionValidationTest, WorkgroupSize_Mismatch_ConstU32) {
// let x = 4u;
// let x = 8u;
// @stage(compute) @workgroup_size(x, y, 16i)
// @compute @workgroup_size(x, y, 16i)
// fn main() {}
GlobalConst("x", ty.u32(), Expr(4_u));
GlobalConst("y", ty.u32(), Expr(8_u));
@ -553,7 +553,7 @@ TEST_F(ResolverFunctionValidationTest, WorkgroupSize_Mismatch_ConstU32) {
}
TEST_F(ResolverFunctionValidationTest, WorkgroupSize_Literal_BadType) {
// @stage(compute) @workgroup_size(64.0)
// @compute @workgroup_size(64.0)
// fn main() {}
Func("main", {}, ty.void_(), {},
@ -566,7 +566,7 @@ TEST_F(ResolverFunctionValidationTest, WorkgroupSize_Literal_BadType) {
}
TEST_F(ResolverFunctionValidationTest, WorkgroupSize_Literal_Negative) {
// @stage(compute) @workgroup_size(-2i)
// @compute @workgroup_size(-2i)
// fn main() {}
Func("main", {}, ty.void_(), {},
@ -577,7 +577,7 @@ TEST_F(ResolverFunctionValidationTest, WorkgroupSize_Literal_Negative) {
}
TEST_F(ResolverFunctionValidationTest, WorkgroupSize_Literal_Zero) {
// @stage(compute) @workgroup_size(0i)
// @compute @workgroup_size(0i)
// fn main() {}
Func("main", {}, ty.void_(), {},
@ -589,7 +589,7 @@ TEST_F(ResolverFunctionValidationTest, WorkgroupSize_Literal_Zero) {
TEST_F(ResolverFunctionValidationTest, WorkgroupSize_Const_BadType) {
// let x = 64.0;
// @stage(compute) @workgroup_size(x)
// @compute @workgroup_size(x)
// fn main() {}
GlobalConst("x", ty.f32(), Expr(64_f));
Func("main", {}, ty.void_(), {},
@ -603,7 +603,7 @@ TEST_F(ResolverFunctionValidationTest, WorkgroupSize_Const_BadType) {
TEST_F(ResolverFunctionValidationTest, WorkgroupSize_Const_Negative) {
// let x = -2i;
// @stage(compute) @workgroup_size(x)
// @compute @workgroup_size(x)
// fn main() {}
GlobalConst("x", ty.i32(), Expr(-2_i));
Func("main", {}, ty.void_(), {},
@ -615,7 +615,7 @@ TEST_F(ResolverFunctionValidationTest, WorkgroupSize_Const_Negative) {
TEST_F(ResolverFunctionValidationTest, WorkgroupSize_Const_Zero) {
// let x = 0i;
// @stage(compute) @workgroup_size(x)
// @compute @workgroup_size(x)
// fn main() {}
GlobalConst("x", ty.i32(), Expr(0_i));
Func("main", {}, ty.void_(), {},
@ -627,7 +627,7 @@ TEST_F(ResolverFunctionValidationTest, WorkgroupSize_Const_Zero) {
TEST_F(ResolverFunctionValidationTest, WorkgroupSize_Const_NestedZeroValueConstructor) {
// let x = i32(i32(i32()));
// @stage(compute) @workgroup_size(x)
// @compute @workgroup_size(x)
// fn main() {}
GlobalConst("x", ty.i32(), Construct(ty.i32(), Construct(ty.i32(), Construct(ty.i32()))));
Func("main", {}, ty.void_(), {},
@ -639,7 +639,7 @@ TEST_F(ResolverFunctionValidationTest, WorkgroupSize_Const_NestedZeroValueConstr
TEST_F(ResolverFunctionValidationTest, WorkgroupSize_NonConst) {
// var<private> x = 64i;
// @stage(compute) @workgroup_size(x)
// @compute @workgroup_size(x)
// fn main() {}
Global("x", ty.i32(), ast::StorageClass::kPrivate, Expr(64_i));
Func("main", {}, ty.void_(), {},
@ -652,7 +652,7 @@ TEST_F(ResolverFunctionValidationTest, WorkgroupSize_NonConst) {
}
TEST_F(ResolverFunctionValidationTest, WorkgroupSize_InvalidExpr) {
// @stage(compute) @workgroup_size(i32(1))
// @compute @workgroup_size(i32(1))
// fn main() {}
Func("main", {}, ty.void_(), {},
{Stage(ast::PipelineStage::kCompute),

View File

@ -143,7 +143,7 @@ enum class Method {
kSwitchCaseWithAbstractCase,
// @workgroup_size(target_expr, abstract_expr, 123)
// @stage(compute)
// @compute
// fn f() {}
kWorkgroupSize
};
@ -608,7 +608,7 @@ enum class Method {
kSwitch,
// @workgroup_size(abstract_expr)
// @stage(compute)
// @compute
// fn f() {}
kWorkgroupSize,

View File

@ -912,7 +912,7 @@ TEST_F(ResolverTest, Function_CallSites) {
}
TEST_F(ResolverTest, Function_WorkgroupSize_NotSet) {
// @stage(compute) @workgroup_size(1)
// @compute @workgroup_size(1)
// fn main() {}
auto* func = Func("main", ast::VariableList{}, ty.void_(), {}, {});
@ -930,7 +930,7 @@ TEST_F(ResolverTest, Function_WorkgroupSize_NotSet) {
}
TEST_F(ResolverTest, Function_WorkgroupSize_Literals) {
// @stage(compute) @workgroup_size(8, 2, 3)
// @compute @workgroup_size(8, 2, 3)
// fn main() {}
auto* func = Func("main", ast::VariableList{}, ty.void_(), {},
{Stage(ast::PipelineStage::kCompute), WorkgroupSize(8_i, 2_i, 3_i)});
@ -952,7 +952,7 @@ TEST_F(ResolverTest, Function_WorkgroupSize_Consts) {
// let width = 16i;
// let height = 8i;
// let depth = 2i;
// @stage(compute) @workgroup_size(width, height, depth)
// @compute @workgroup_size(width, height, depth)
// fn main() {}
GlobalConst("width", ty.i32(), Expr(16_i));
GlobalConst("height", ty.i32(), Expr(8_i));
@ -977,7 +977,7 @@ TEST_F(ResolverTest, Function_WorkgroupSize_Consts) {
TEST_F(ResolverTest, Function_WorkgroupSize_Consts_NestedInitializer) {
// let width = i32(i32(i32(8i)));
// let height = i32(i32(i32(4i)));
// @stage(compute) @workgroup_size(width, height)
// @compute @workgroup_size(width, height)
// fn main() {}
GlobalConst("width", ty.i32(),
Construct(ty.i32(), Construct(ty.i32(), Construct(ty.i32(), 8_i))));
@ -1003,7 +1003,7 @@ TEST_F(ResolverTest, Function_WorkgroupSize_OverridableConsts) {
// @id(0) override width = 16i;
// @id(1) override height = 8i;
// @id(2) override depth = 2i;
// @stage(compute) @workgroup_size(width, height, depth)
// @compute @workgroup_size(width, height, depth)
// fn main() {}
auto* width = Override("width", ty.i32(), Expr(16_i), {Id(0)});
auto* height = Override("height", ty.i32(), Expr(8_i), {Id(1)});
@ -1029,7 +1029,7 @@ TEST_F(ResolverTest, Function_WorkgroupSize_OverridableConsts_NoInit) {
// @id(0) override width : i32;
// @id(1) override height : i32;
// @id(2) override depth : i32;
// @stage(compute) @workgroup_size(width, height, depth)
// @compute @workgroup_size(width, height, depth)
// fn main() {}
auto* width = Override("width", ty.i32(), nullptr, {Id(0)});
auto* height = Override("height", ty.i32(), nullptr, {Id(1)});
@ -1054,7 +1054,7 @@ TEST_F(ResolverTest, Function_WorkgroupSize_OverridableConsts_NoInit) {
TEST_F(ResolverTest, Function_WorkgroupSize_Mixed) {
// @id(1) override height = 2i;
// let depth = 3i;
// @stage(compute) @workgroup_size(8, height, depth)
// @compute @workgroup_size(8, height, depth)
// fn main() {}
auto* height = Override("height", ty.i32(), Expr(2_i), {Id(0)});
GlobalConst("depth", ty.i32(), Expr(3_i));

View File

@ -369,7 +369,7 @@ TEST_F(ResolverTypeValidationTest, ArraySize_InvalidExpr) {
}
TEST_F(ResolverTypeValidationTest, RuntimeArrayInFunction_Fail) {
/// @stage(vertex)
/// @vertex
// fn func() { var a : array<i32>; }
auto* var = Var(Source{{12, 34}}, "a", ty.array<i32>(), ast::StorageClass::kNone);
@ -552,7 +552,7 @@ TEST_F(ResolverTypeValidationTest, RuntimeArrayAsLocalVariable) {
TEST_F(ResolverTypeValidationTest, RuntimeArrayAsParameter_Fail) {
// fn func(a : array<u32>) {}
// @stage(vertex) fn main() {}
// @vertex fn main() {}
auto* param = Param(Source{{12, 34}}, "a", ty.array<i32>());

View File

@ -683,7 +683,7 @@ class ComputeBuiltin : public UniformityAnalysisTestBase,
public ::testing::TestWithParam<BuiltinEntry> {};
TEST_P(ComputeBuiltin, AsParam) {
std::string src = R"(
@stage(compute) @workgroup_size(64)
@compute @workgroup_size(64)
fn main(@builtin()" + GetParam().name +
R"() b : )" + GetParam().type + R"() {
if (all(vec3(b) == vec3(0u))) {
@ -719,7 +719,7 @@ struct S {
R"() b : )" + GetParam().type + R"(
}
@stage(compute) @workgroup_size(64)
@compute @workgroup_size(64)
fn main(s : S) {
if (all(vec3(s.b) == vec3(0u))) {
workgroupBarrier();
@ -767,7 +767,7 @@ struct S {
@builtin(local_invocation_index) idx : u32,
}
@stage(compute) @workgroup_size(64)
@compute @workgroup_size(64)
fn main(s : S) {
if (s.num_groups.x == 0u) {
workgroupBarrier();
@ -795,7 +795,7 @@ class FragmentBuiltin : public UniformityAnalysisTestBase,
public ::testing::TestWithParam<BuiltinEntry> {};
TEST_P(FragmentBuiltin, AsParam) {
std::string src = R"(
@stage(fragment)
@fragment
fn main(@builtin()" + GetParam().name +
R"() b : )" + GetParam().type + R"() {
if (u32(vec4(b).x) == 0u) {
@ -830,7 +830,7 @@ struct S {
R"() b : )" + GetParam().type + R"(
}
@stage(fragment)
@fragment
fn main(s : S) {
if (u32(vec4(s.b).x) == 0u) {
dpdx(0.5);
@ -869,7 +869,7 @@ INSTANTIATE_TEST_SUITE_P(UniformityAnalysisTest,
TEST_F(UniformityAnalysisTest, FragmentLocation) {
std::string src = R"(
@stage(fragment)
@fragment
fn main(@location(0) l : f32) {
if (l == 0.0) {
dpdx(0.5);
@ -899,7 +899,7 @@ struct S {
@location(0) l : f32
}
@stage(fragment)
@fragment
fn main(s : S) {
if (s.l == 0.0) {
dpdx(0.5);
@ -5598,7 +5598,7 @@ fn foo() {
}
}
@stage(fragment)
@fragment
fn main() {
foo();
}

View File

@ -80,7 +80,7 @@ TEST_F(ResolverValidationTest, WorkgroupMemoryUsedInFragmentStage) {
// var<workgroup> dst : vec4<f32>;
// fn f2(){ dst = wg; }
// fn f1() { f2(); }
// @stage(fragment)
// @fragment
// fn f0() {
// f1();
//}

View File

@ -31,7 +31,7 @@ TEST_F(AddEmptyEntryPointTest, ShouldRunEmptyModule) {
TEST_F(AddEmptyEntryPointTest, ShouldRunExistingEntryPoint) {
auto* src = R"(
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn existing() {}
)";
@ -42,7 +42,7 @@ TEST_F(AddEmptyEntryPointTest, EmptyModule) {
auto* src = R"()";
auto* expect = R"(
@stage(compute) @workgroup_size(1i)
@compute @workgroup_size(1i)
fn unused_entry_point() {
}
)";
@ -54,7 +54,7 @@ fn unused_entry_point() {
TEST_F(AddEmptyEntryPointTest, ExistingEntryPoint) {
auto* src = R"(
@stage(fragment)
@fragment
fn main() {
}
)";
@ -70,7 +70,7 @@ TEST_F(AddEmptyEntryPointTest, NameClash) {
auto* src = R"(var<private> unused_entry_point : f32;)";
auto* expect = R"(
@stage(compute) @workgroup_size(1i)
@compute @workgroup_size(1i)
fn unused_entry_point_1() {
}

View File

@ -41,7 +41,7 @@ struct S {
var<private> p : S;
@stage(fragment)
@fragment
fn main() {
p.f = 1.0;
}
@ -60,7 +60,7 @@ struct S {
f : f32,
}
@stage(fragment)
@fragment
fn main() -> S {
return S();
}
@ -77,7 +77,7 @@ TEST_F(AddSpirvBlockAttributeTest, BasicScalar) {
@group(0) @binding(0)
var<uniform> u : f32;
@stage(fragment)
@fragment
fn main() {
let f = u;
}
@ -90,7 +90,7 @@ struct u_block {
@group(0) @binding(0) var<uniform> u : u_block;
@stage(fragment)
@fragment
fn main() {
let f = u.inner;
}
@ -106,7 +106,7 @@ TEST_F(AddSpirvBlockAttributeTest, BasicArray) {
@group(0) @binding(0)
var<uniform> u : array<vec4<f32>, 4u>;
@stage(fragment)
@fragment
fn main() {
let a = u;
}
@ -119,7 +119,7 @@ struct u_block {
@group(0) @binding(0) var<uniform> u : u_block;
@stage(fragment)
@fragment
fn main() {
let a = u.inner;
}
@ -137,7 +137,7 @@ type Numbers = array<vec4<f32>, 4u>;
@group(0) @binding(0)
var<uniform> u : Numbers;
@stage(fragment)
@fragment
fn main() {
let a = u;
}
@ -152,7 +152,7 @@ struct u_block {
@group(0) @binding(0) var<uniform> u : u_block;
@stage(fragment)
@fragment
fn main() {
let a = u.inner;
}
@ -172,7 +172,7 @@ struct S {
@group(0) @binding(0)
var<uniform> u : S;
@stage(fragment)
@fragment
fn main() {
let f = u.f;
}
@ -185,7 +185,7 @@ struct S {
@group(0) @binding(0) var<uniform> u : S;
@stage(fragment)
@fragment
fn main() {
let f = u.f;
}
@ -209,7 +209,7 @@ struct Outer {
@group(0) @binding(0)
var<uniform> u : Outer;
@stage(fragment)
@fragment
fn main() {
let f = u.i.f;
}
@ -226,7 +226,7 @@ struct Outer {
@group(0) @binding(0) var<uniform> u : Outer;
@stage(fragment)
@fragment
fn main() {
let f = u.i.f;
}
@ -253,7 +253,7 @@ var<uniform> u0 : Outer;
@group(0) @binding(1)
var<uniform> u1 : Inner;
@stage(fragment)
@fragment
fn main() {
let f0 = u0.i.f;
let f1 = u1.f;
@ -278,7 +278,7 @@ struct u1_block {
@group(0) @binding(1) var<uniform> u1 : u1_block;
@stage(fragment)
@fragment
fn main() {
let f0 = u0.i.f;
let f1 = u1.inner.f;
@ -305,7 +305,7 @@ var<private> p : Outer;
@group(0) @binding(1)
var<uniform> u : Inner;
@stage(fragment)
@fragment
fn main() {
let f0 = p.i.f;
let f1 = u.f;
@ -329,7 +329,7 @@ struct u_block {
@group(0) @binding(1) var<uniform> u : u_block;
@stage(fragment)
@fragment
fn main() {
let f0 = p.i.f;
let f1 = u.inner.f;
@ -360,7 +360,7 @@ var<uniform> u1 : Inner;
@group(0) @binding(2)
var<uniform> u2 : Inner;
@stage(fragment)
@fragment
fn main() {
let f0 = u0.i.f;
let f1 = u1.f;
@ -388,7 +388,7 @@ struct u1_block {
@group(0) @binding(2) var<uniform> u2 : u1_block;
@stage(fragment)
@fragment
fn main() {
let f0 = u0.i.f;
let f1 = u1.inner.f;
@ -410,7 +410,7 @@ struct S {
@group(0) @binding(0)
var<uniform> u : S;
@stage(fragment)
@fragment
fn main() {
let f = u.f;
let a = array<S, 4>();
@ -428,7 +428,7 @@ struct u_block {
@group(0) @binding(0) var<uniform> u : u_block;
@stage(fragment)
@fragment
fn main() {
let f = u.inner.f;
let a = array<S, 4>();
@ -452,7 +452,7 @@ var<uniform> u0 : S;
@group(0) @binding(1)
var<uniform> u1 : S;
@stage(fragment)
@fragment
fn main() {
let f0 = u0.f;
let f1 = u1.f;
@ -473,7 +473,7 @@ struct u0_block {
@group(0) @binding(1) var<uniform> u1 : u0_block;
@stage(fragment)
@fragment
fn main() {
let f0 = u0.inner.f;
let f1 = u1.inner.f;
@ -506,7 +506,7 @@ var<uniform> u0 : MyOuter;
@group(0) @binding(1)
var<uniform> u1 : MyInner;
@stage(fragment)
@fragment
fn main() {
let f0 = u0.i.f;
let f1 = u1.f;
@ -535,7 +535,7 @@ struct u1_block {
@group(0) @binding(1) var<uniform> u1 : u1_block;
@stage(fragment)
@fragment
fn main() {
let f0 = u0.i.f;
let f1 = u1.inner.f;
@ -549,7 +549,7 @@ fn main() {
TEST_F(AddSpirvBlockAttributeTest, Aliases_Nested_OuterBuffer_InnerBuffer_OutOfOrder) {
auto* src = R"(
@stage(fragment)
@fragment
fn main() {
let f0 = u0.i.f;
let f1 = u1.f;
@ -574,7 +574,7 @@ struct Inner {
};
)";
auto* expect = R"(
@stage(fragment)
@fragment
fn main() {
let f0 = u0.i.f;
let f1 = u1.inner.f;

View File

@ -40,7 +40,7 @@ struct SB {
@group(0) @binding(0) var<storage, read> sb : SB;
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
}
)";
@ -57,7 +57,7 @@ struct SB {
@group(0) @binding(0) var<storage, read> sb : SB;
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
var len : u32 = arrayLength(&sb.arr);
}
@ -75,7 +75,7 @@ struct SB {
@group(0) @binding(0) var<storage, read> sb : SB;
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
var len : u32 = arrayLength(&sb.arr);
}
@ -94,7 +94,7 @@ TEST_F(ArrayLengthFromUniformTest, Basic) {
auto* src = R"(
@group(0) @binding(0) var<storage, read> sb : array<i32>;
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
var len : u32 = arrayLength(&sb);
}
@ -109,7 +109,7 @@ struct tint_symbol {
@group(0) @binding(0) var<storage, read> sb : array<i32>;
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
var len : u32 = (tint_symbol_1.buffer_size[0u][0u] / 4u);
}
@ -137,7 +137,7 @@ struct SB {
@group(0) @binding(0) var<storage, read> sb : SB;
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
var len : u32 = arrayLength(&sb.arr);
}
@ -157,7 +157,7 @@ struct SB {
@group(0) @binding(0) var<storage, read> sb : SB;
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
var len : u32 = ((tint_symbol_1.buffer_size[0u][0u] - 4u) / 4u);
}
@ -197,7 +197,7 @@ struct SB4 {
@group(3) @binding(2) var<storage, read> sb4 : SB4;
@group(4) @binding(2) var<storage, read> sb5 : array<vec4<f32>>;
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
var len1 : u32 = arrayLength(&(sb1.arr1));
var len2 : u32 = arrayLength(&(sb2.arr2));
@ -240,7 +240,7 @@ struct SB4 {
@group(4) @binding(2) var<storage, read> sb5 : array<vec4<f32>>;
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
var len1 : u32 = ((tint_symbol_1.buffer_size[0u][0u] - 4u) / 4u);
var len2 : u32 = ((tint_symbol_1.buffer_size[0u][1u] - 16u) / 16u);
@ -289,7 +289,7 @@ struct SB4 {
@group(3) @binding(2) var<storage, read> sb4 : SB4;
@group(4) @binding(2) var<storage, read> sb5 : array<vec4<f32>>;
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
var len1 : u32 = arrayLength(&(sb1.arr1));
var len3 : u32 = arrayLength(&sb3);
@ -329,7 +329,7 @@ struct SB4 {
@group(4) @binding(2) var<storage, read> sb5 : array<vec4<f32>>;
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
var len1 : u32 = ((tint_symbol_1.buffer_size[0u][0u] - 4u) / 4u);
var len3 : u32 = (tint_symbol_1.buffer_size[0u][2u] / 16u);
@ -363,7 +363,7 @@ struct SB {
@group(0) @binding(0) var<storage, read> sb : SB;
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
_ = &(sb.arr);
}
@ -397,7 +397,7 @@ struct SB2 {
@group(1) @binding(2) var<storage, read> sb2 : SB2;
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
var len1 : u32 = arrayLength(&(sb1.arr1));
var len2 : u32 = arrayLength(&(sb2.arr2));
@ -426,7 +426,7 @@ struct SB2 {
@group(1) @binding(2) var<storage, read> sb2 : SB2;
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
var len1 : u32 = ((tint_symbol_1.buffer_size[0u][0u] - 4u) / 4u);
var len2 : u32 = arrayLength(&(sb2.arr2));
@ -449,7 +449,7 @@ fn main() {
TEST_F(ArrayLengthFromUniformTest, OutOfOrder) {
auto* src = R"(
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
var len : u32 = arrayLength(&sb.arr);
}
@ -469,7 +469,7 @@ struct tint_symbol {
@group(0) @binding(30) var<uniform> tint_symbol_1 : tint_symbol;
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
var len : u32 = ((tint_symbol_1.buffer_size[0u][0u] - 4u) / 4u);
}

View File

@ -74,7 +74,7 @@ struct S {
@group(3) @binding(2) var<storage, read> b : S;
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn f() {
}
)";
@ -99,7 +99,7 @@ struct S {
@group(3) @binding(2) var<storage, read> b : S;
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn f() {
}
)";
@ -113,7 +113,7 @@ struct S {
@group(3) @binding(2) var<storage, read> b : S;
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn f() {
}
)";
@ -143,7 +143,7 @@ struct S {
@group(4) @binding(3) var<storage, read> c : S;
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn f() {
}
)";
@ -159,7 +159,7 @@ struct S {
@group(4) @binding(3) var<storage, read> c : S;
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn f() {
}
)";
@ -187,7 +187,7 @@ struct S {
@group(3) @binding(2) var<storage, read> b : S;
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn f() {
}
)";
@ -201,7 +201,7 @@ struct S {
@group(6) @binding(7) var<storage, write> b : S;
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn f() {
}
)";
@ -235,7 +235,7 @@ struct S {
@group(5) @binding(4) var<storage, read> d : S;
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn f() {
let x : i32 = (((a.i + b.i) + c.i) + d.i);
}
@ -254,7 +254,7 @@ struct S {
@internal(disable_validation__binding_point_collision) @group(5) @binding(4) var<storage, read> d : S;
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn f() {
let x : i32 = (((a.i + b.i) + c.i) + d.i);
}
@ -287,12 +287,12 @@ struct S {
@group(5) @binding(4) var<storage, read> d : S;
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn f1() {
let x : i32 = (a.i + c.i);
}
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn f2() {
let x : i32 = (b.i + d.i);
}
@ -311,12 +311,12 @@ struct S {
@group(5) @binding(4) var<storage, read> d : S;
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn f1() {
let x : i32 = (a.i + c.i);
}
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn f2() {
let x : i32 = (b.i + d.i);
}
@ -345,7 +345,7 @@ struct S {
@group(3) @binding(2) var<storage, read> b : S;
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn f() {
}
)";

View File

@ -38,7 +38,7 @@ struct SB {
@group(0) @binding(0) var<storage, read> sb : SB;
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
}
)";
@ -55,7 +55,7 @@ struct SB {
@group(0) @binding(0) var<storage, read> sb : SB;
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
var len : u32 = arrayLength(&sb.arr);
}
@ -68,7 +68,7 @@ TEST_F(CalculateArrayLengthTest, BasicArray) {
auto* src = R"(
@group(0) @binding(0) var<storage, read> sb : array<i32>;
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
var len : u32 = arrayLength(&sb);
}
@ -80,7 +80,7 @@ fn tint_symbol(@internal(disable_validation__ignore_constructible_function_param
@group(0) @binding(0) var<storage, read> sb : array<i32>;
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
var tint_symbol_1 : u32 = 0u;
tint_symbol(sb, &(tint_symbol_1));
@ -103,7 +103,7 @@ struct SB {
@group(0) @binding(0) var<storage, read> sb : SB;
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
var len : u32 = arrayLength(&sb.arr);
}
@ -120,7 +120,7 @@ struct SB {
@group(0) @binding(0) var<storage, read> sb : SB;
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
var tint_symbol_1 : u32 = 0u;
tint_symbol(sb, &(tint_symbol_1));
@ -142,7 +142,7 @@ struct S {
@group(0) @binding(0) var<storage, read> arr : array<S>;
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
let len = arrayLength(&arr);
}
@ -157,7 +157,7 @@ struct S {
@group(0) @binding(0) var<storage, read> arr : array<S>;
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
var tint_symbol_1 : u32 = 0u;
tint_symbol(arr, &(tint_symbol_1));
@ -179,7 +179,7 @@ struct S {
@group(0) @binding(0) var<storage, read> arr : array<array<S, 4>>;
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
let len = arrayLength(&arr);
}
@ -194,7 +194,7 @@ struct S {
@group(0) @binding(0) var<storage, read> arr : array<array<S, 4>>;
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
var tint_symbol_1 : u32 = 0u;
tint_symbol(arr, &(tint_symbol_1));
@ -212,7 +212,7 @@ TEST_F(CalculateArrayLengthTest, InSameBlock) {
auto* src = R"(
@group(0) @binding(0) var<storage, read> sb : array<i32>;;
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
var a : u32 = arrayLength(&sb);
var b : u32 = arrayLength(&sb);
@ -226,7 +226,7 @@ fn tint_symbol(@internal(disable_validation__ignore_constructible_function_param
@group(0) @binding(0) var<storage, read> sb : array<i32>;
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
var tint_symbol_1 : u32 = 0u;
tint_symbol(sb, &(tint_symbol_1));
@ -251,7 +251,7 @@ struct SB {
@group(0) @binding(0) var<storage, read> sb : SB;
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
var a : u32 = arrayLength(&sb.arr);
var b : u32 = arrayLength(&sb.arr);
@ -270,7 +270,7 @@ struct SB {
@group(0) @binding(0) var<storage, read> sb : SB;
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
var tint_symbol_1 : u32 = 0u;
tint_symbol(sb, &(tint_symbol_1));
@ -295,7 +295,7 @@ struct SB {
@group(0) @binding(0) var<storage, read> sb : SB;
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
if (true) {
var len : u32 = arrayLength(&sb.arr);
@ -318,7 +318,7 @@ struct SB {
@group(0) @binding(0) var<storage, read> sb : SB;
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
if (true) {
var tint_symbol_1 : u32 = 0u;
@ -359,7 +359,7 @@ struct SB2 {
@group(0) @binding(2) var<storage, read> sb3 : array<i32>;
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
var len1 : u32 = arrayLength(&(sb1.arr1));
var len2 : u32 = arrayLength(&(sb2.arr2));
@ -394,7 +394,7 @@ struct SB2 {
@group(0) @binding(2) var<storage, read> sb3 : array<i32>;
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
var tint_symbol_1 : u32 = 0u;
tint_symbol(sb1, &(tint_symbol_1));
@ -427,7 +427,7 @@ struct SB {
@group(0) @binding(0) var<storage, read> a : SB;
@group(0) @binding(1) var<storage, read> b : SB;
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
let x = &a;
var a : u32 = arrayLength(&a.arr);
@ -451,7 +451,7 @@ struct SB {
@group(0) @binding(1) var<storage, read> b : SB;
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
var tint_symbol_1 : u32 = 0u;
tint_symbol(a, &(tint_symbol_1));
@ -473,7 +473,7 @@ fn main() {
TEST_F(CalculateArrayLengthTest, OutOfOrder) {
auto* src = R"(
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
var len1 : u32 = arrayLength(&(sb1.arr1));
var len2 : u32 = arrayLength(&(sb2.arr2));
@ -508,7 +508,7 @@ fn tint_symbol_3(@internal(disable_validation__ignore_constructible_function_par
@internal(intrinsic_buffer_size)
fn tint_symbol_6(@internal(disable_validation__ignore_constructible_function_parameter) buffer : array<i32>, result : ptr<function, u32>)
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
var tint_symbol_1 : u32 = 0u;
tint_symbol(sb1, &(tint_symbol_1));

File diff suppressed because it is too large Load Diff

View File

@ -78,7 +78,7 @@ struct SB {
@group(0) @binding(0) var<storage, read_write> sb : SB;
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
var a : i32 = sb.a;
var b : u32 = sb.b;
@ -213,7 +213,7 @@ fn tint_symbol_21(@internal(disable_validation__ignore_constructible_function_pa
return arr;
}
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
var a : i32 = tint_symbol(sb, 0u);
var b : u32 = tint_symbol_1(sb, 4u);
@ -247,7 +247,7 @@ fn main() {
TEST_F(DecomposeMemoryAccessTest, SB_BasicLoad_OutOfOrder) {
auto* src = R"(
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
var a : i32 = sb.a;
var b : u32 = sb.b;
@ -382,7 +382,7 @@ fn tint_symbol_21(@internal(disable_validation__ignore_constructible_function_pa
return arr;
}
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
var a : i32 = tint_symbol(sb, 0u);
var b : u32 = tint_symbol_1(sb, 4u);
@ -470,7 +470,7 @@ struct UB {
@group(0) @binding(0) var<uniform> ub : UB;
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
var a : i32 = ub.a;
var b : u32 = ub.b;
@ -605,7 +605,7 @@ fn tint_symbol_21(@internal(disable_validation__ignore_constructible_function_pa
return arr;
}
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
var a : i32 = tint_symbol(ub, 0u);
var b : u32 = tint_symbol_1(ub, 4u);
@ -639,7 +639,7 @@ fn main() {
TEST_F(DecomposeMemoryAccessTest, UB_BasicLoad_OutOfOrder) {
auto* src = R"(
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
var a : i32 = ub.a;
var b : u32 = ub.b;
@ -774,7 +774,7 @@ fn tint_symbol_21(@internal(disable_validation__ignore_constructible_function_pa
return arr;
}
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
var a : i32 = tint_symbol(ub, 0u);
var b : u32 = tint_symbol_1(ub, 4u);
@ -862,7 +862,7 @@ struct SB {
@group(0) @binding(0) var<storage, read_write> sb : SB;
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
sb.a = i32();
sb.b = u32();
@ -1014,7 +1014,7 @@ fn tint_symbol_21(@internal(disable_validation__ignore_constructible_function_pa
}
}
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
tint_symbol(sb, 0u, i32());
tint_symbol_1(sb, 4u, u32());
@ -1048,7 +1048,7 @@ fn main() {
TEST_F(DecomposeMemoryAccessTest, SB_BasicStore_OutOfOrder) {
auto* src = R"(
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
sb.a = i32();
sb.b = u32();
@ -1200,7 +1200,7 @@ fn tint_symbol_21(@internal(disable_validation__ignore_constructible_function_pa
}
}
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
tint_symbol(sb, 0u, i32());
tint_symbol_1(sb, 4u, u32());
@ -1288,7 +1288,7 @@ struct SB {
@group(0) @binding(0) var<storage, read_write> sb : SB;
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
var x : SB = sb;
}
@ -1406,7 +1406,7 @@ fn tint_symbol(@internal(disable_validation__ignore_constructible_function_param
return SB(tint_symbol_1(buffer, (offset + 0u)), tint_symbol_2(buffer, (offset + 4u)), tint_symbol_3(buffer, (offset + 8u)), tint_symbol_4(buffer, (offset + 16u)), tint_symbol_5(buffer, (offset + 24u)), tint_symbol_6(buffer, (offset + 32u)), tint_symbol_7(buffer, (offset + 48u)), tint_symbol_8(buffer, (offset + 64u)), tint_symbol_9(buffer, (offset + 80u)), tint_symbol_10(buffer, (offset + 96u)), tint_symbol_11(buffer, (offset + 112u)), tint_symbol_12(buffer, (offset + 128u)), tint_symbol_13(buffer, (offset + 144u)), tint_symbol_14(buffer, (offset + 160u)), tint_symbol_15(buffer, (offset + 192u)), tint_symbol_16(buffer, (offset + 224u)), tint_symbol_17(buffer, (offset + 256u)), tint_symbol_18(buffer, (offset + 304u)), tint_symbol_19(buffer, (offset + 352u)), tint_symbol_20(buffer, (offset + 384u)), tint_symbol_21(buffer, (offset + 448u)), tint_symbol_22(buffer, (offset + 512u)));
}
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
var x : SB = tint_symbol(sb, 0u);
}
@ -1419,7 +1419,7 @@ fn main() {
TEST_F(DecomposeMemoryAccessTest, LoadStructure_OutOfOrder) {
auto* src = R"(
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
var x : SB = sb;
}
@ -1537,7 +1537,7 @@ fn tint_symbol(@internal(disable_validation__ignore_constructible_function_param
return SB(tint_symbol_1(buffer, (offset + 0u)), tint_symbol_2(buffer, (offset + 4u)), tint_symbol_3(buffer, (offset + 8u)), tint_symbol_4(buffer, (offset + 16u)), tint_symbol_5(buffer, (offset + 24u)), tint_symbol_6(buffer, (offset + 32u)), tint_symbol_7(buffer, (offset + 48u)), tint_symbol_8(buffer, (offset + 64u)), tint_symbol_9(buffer, (offset + 80u)), tint_symbol_10(buffer, (offset + 96u)), tint_symbol_11(buffer, (offset + 112u)), tint_symbol_12(buffer, (offset + 128u)), tint_symbol_13(buffer, (offset + 144u)), tint_symbol_14(buffer, (offset + 160u)), tint_symbol_15(buffer, (offset + 192u)), tint_symbol_16(buffer, (offset + 224u)), tint_symbol_17(buffer, (offset + 256u)), tint_symbol_18(buffer, (offset + 304u)), tint_symbol_19(buffer, (offset + 352u)), tint_symbol_20(buffer, (offset + 384u)), tint_symbol_21(buffer, (offset + 448u)), tint_symbol_22(buffer, (offset + 512u)));
}
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
var x : SB = tint_symbol(sb, 0u);
}
@ -1604,7 +1604,7 @@ struct SB {
@group(0) @binding(0) var<storage, read_write> sb : SB;
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
sb = SB();
}
@ -1760,7 +1760,7 @@ fn tint_symbol(@internal(disable_validation__ignore_constructible_function_param
tint_symbol_22(buffer, (offset + 512u), value.v);
}
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
tint_symbol(sb, 0u, SB());
}
@ -1773,7 +1773,7 @@ fn main() {
TEST_F(DecomposeMemoryAccessTest, StoreStructure_OutOfOrder) {
auto* src = R"(
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
sb = SB();
}
@ -1929,7 +1929,7 @@ fn tint_symbol(@internal(disable_validation__ignore_constructible_function_param
tint_symbol_22(buffer, (offset + 512u), value.v);
}
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
tint_symbol(sb, 0u, SB());
}
@ -1993,7 +1993,7 @@ struct SB {
@group(0) @binding(0) var<storage, read_write> sb : SB;
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
var x : f32 = sb.b[4].b[1].b.z;
}
@ -2030,7 +2030,7 @@ struct SB {
@internal(intrinsic_load_storage_f32) @internal(disable_validation__function_has_no_body)
fn tint_symbol(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> f32
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
var x : f32 = tint_symbol(sb, 712u);
}
@ -2043,7 +2043,7 @@ fn main() {
TEST_F(DecomposeMemoryAccessTest, ComplexStaticAccessChain_OutOfOrder) {
auto* src = R"(
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
var x : f32 = sb.b[4].b[1].b.z;
}
@ -2080,7 +2080,7 @@ struct S1 {
@internal(intrinsic_load_storage_f32) @internal(disable_validation__function_has_no_body)
fn tint_symbol(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> f32
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
var x : f32 = tint_symbol(sb, 712u);
}
@ -2133,7 +2133,7 @@ struct SB {
@group(0) @binding(0) var<storage, read_write> sb : SB;
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
var i : i32 = 4;
var j : u32 = 1u;
@ -2166,7 +2166,7 @@ struct SB {
@internal(intrinsic_load_storage_f32) @internal(disable_validation__function_has_no_body)
fn tint_symbol(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> f32
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
var i : i32 = 4;
var j : u32 = 1u;
@ -2182,7 +2182,7 @@ fn main() {
TEST_F(DecomposeMemoryAccessTest, ComplexDynamicAccessChain_OutOfOrder) {
auto* src = R"(
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
var i : i32 = 4;
var j : u32 = 1u;
@ -2215,7 +2215,7 @@ struct S1 {
@internal(intrinsic_load_storage_f32) @internal(disable_validation__function_has_no_body)
fn tint_symbol(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> f32
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
var i : i32 = 4;
var j : u32 = 1u;
@ -2279,7 +2279,7 @@ struct SB {
@group(0) @binding(0) var<storage, read_write> sb : SB;
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
var i : i32 = 4;
var j : u32 = 1u;
@ -2320,7 +2320,7 @@ struct SB {
@internal(intrinsic_load_storage_f32) @internal(disable_validation__function_has_no_body)
fn tint_symbol(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> f32
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
var i : i32 = 4;
var j : u32 = 1u;
@ -2336,7 +2336,7 @@ fn main() {
TEST_F(DecomposeMemoryAccessTest, ComplexDynamicAccessChainWithAliases_OutOfOrder) {
auto* src = R"(
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
var i : i32 = 4;
var j : u32 = 1u;
@ -2377,7 +2377,7 @@ struct S1 {
@internal(intrinsic_load_storage_f32) @internal(disable_validation__function_has_no_body)
fn tint_symbol(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> f32
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
var i : i32 = 4;
var j : u32 = 1u;
@ -2429,7 +2429,7 @@ struct SB {
@group(0) @binding(0) var<storage, read_write> sb : SB;
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
atomicStore(&sb.a, 123);
atomicLoad(&sb.a);
@ -2542,7 +2542,7 @@ struct atomic_compare_exchange_weak_ret_type_1 {
@internal(intrinsic_atomic_compare_exchange_weak_storage_u32) @internal(disable_validation__function_has_no_body)
fn tint_atomicCompareExchangeWeak_1(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, param_1 : u32, param_2 : u32) -> atomic_compare_exchange_weak_ret_type_1
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
tint_atomicStore(sb, 16u, 123);
tint_atomicLoad(sb, 16u);
@ -2576,7 +2576,7 @@ fn main() {
TEST_F(DecomposeMemoryAccessTest, StorageBufferAtomics_OutOfOrder) {
auto* src = R"(
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
atomicStore(&sb.a, 123);
atomicLoad(&sb.a);
@ -2689,7 +2689,7 @@ struct atomic_compare_exchange_weak_ret_type_1 {
@internal(intrinsic_atomic_compare_exchange_weak_storage_u32) @internal(disable_validation__function_has_no_body)
fn tint_atomicCompareExchangeWeak_1(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, param_1 : u32, param_2 : u32) -> atomic_compare_exchange_weak_ret_type_1
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
tint_atomicStore(sb, 16u, 123);
tint_atomicLoad(sb, 16u);
@ -2739,7 +2739,7 @@ struct S {
var<workgroup> w : S;
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
atomicStore(&(w.a), 123);
atomicLoad(&(w.a));
@ -2775,7 +2775,7 @@ fn main() {
TEST_F(DecomposeMemoryAccessTest, WorkgroupBufferAtomics_OutOfOrder) {
auto* src = R"(
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
atomicStore(&(w.a), 123);
atomicLoad(&(w.a));

View File

@ -71,7 +71,7 @@ TEST_F(DecomposeStridedArrayTest, Empty) {
TEST_F(DecomposeStridedArrayTest, PrivateDefaultStridedArray) {
// var<private> arr : @stride(4) array<f32, 4u>
//
// @stage(compute) @workgroup_size(1)
// @compute @workgroup_size(1)
// fn f() {
// let a : @stride(4) array<f32, 4u> = a;
// let b : f32 = arr[1];
@ -92,7 +92,7 @@ TEST_F(DecomposeStridedArrayTest, PrivateDefaultStridedArray) {
auto* expect = R"(
var<private> arr : array<f32, 4u>;
@stage(compute) @workgroup_size(1i)
@compute @workgroup_size(1i)
fn f() {
let a : array<f32, 4u> = arr;
let b : f32 = arr[1i];
@ -107,7 +107,7 @@ fn f() {
TEST_F(DecomposeStridedArrayTest, PrivateStridedArray) {
// var<private> arr : @stride(32) array<f32, 4u>
//
// @stage(compute) @workgroup_size(1)
// @compute @workgroup_size(1)
// fn f() {
// let a : @stride(32) array<f32, 4u> = a;
// let b : f32 = arr[1];
@ -133,7 +133,7 @@ struct strided_arr {
var<private> arr : array<strided_arr, 4u>;
@stage(compute) @workgroup_size(1i)
@compute @workgroup_size(1i)
fn f() {
let a : array<strided_arr, 4u> = arr;
let b : f32 = arr[1i].el;
@ -151,7 +151,7 @@ TEST_F(DecomposeStridedArrayTest, ReadUniformStridedArray) {
// };
// @group(0) @binding(0) var<uniform> s : S;
//
// @stage(compute) @workgroup_size(1)
// @compute @workgroup_size(1)
// fn f() {
// let a : @stride(32) array<f32, 4u> = s.a;
// let b : f32 = s.a[1];
@ -181,7 +181,7 @@ struct S {
@group(0) @binding(0) var<uniform> s : S;
@stage(compute) @workgroup_size(1i)
@compute @workgroup_size(1i)
fn f() {
let a : array<strided_arr, 4u> = s.a;
let b : f32 = s.a[1i].el;
@ -199,7 +199,7 @@ TEST_F(DecomposeStridedArrayTest, ReadUniformDefaultStridedArray) {
// };
// @group(0) @binding(0) var<uniform> s : S;
//
// @stage(compute) @workgroup_size(1)
// @compute @workgroup_size(1)
// fn f() {
// let a : @stride(16) array<vec4<f32>, 4u> = s.a;
// let b : f32 = s.a[1][2];
@ -227,7 +227,7 @@ struct S {
@group(0) @binding(0) var<uniform> s : S;
@stage(compute) @workgroup_size(1i)
@compute @workgroup_size(1i)
fn f() {
let a : array<vec4<f32>, 4u> = s.a;
let b : f32 = s.a[1i][2i];
@ -245,7 +245,7 @@ TEST_F(DecomposeStridedArrayTest, ReadStorageStridedArray) {
// };
// @group(0) @binding(0) var<storage> s : S;
//
// @stage(compute) @workgroup_size(1)
// @compute @workgroup_size(1)
// fn f() {
// let a : @stride(32) array<f32, 4u> = s.a;
// let b : f32 = s.a[1];
@ -275,7 +275,7 @@ struct S {
@group(0) @binding(0) var<storage> s : S;
@stage(compute) @workgroup_size(1i)
@compute @workgroup_size(1i)
fn f() {
let a : array<strided_arr, 4u> = s.a;
let b : f32 = s.a[1i].el;
@ -293,7 +293,7 @@ TEST_F(DecomposeStridedArrayTest, ReadStorageDefaultStridedArray) {
// };
// @group(0) @binding(0) var<storage> s : S;
//
// @stage(compute) @workgroup_size(1)
// @compute @workgroup_size(1)
// fn f() {
// let a : @stride(4) array<f32, 4u> = s.a;
// let b : f32 = s.a[1];
@ -318,7 +318,7 @@ struct S {
@group(0) @binding(0) var<storage> s : S;
@stage(compute) @workgroup_size(1i)
@compute @workgroup_size(1i)
fn f() {
let a : array<f32, 4u> = s.a;
let b : f32 = s.a[1i];
@ -336,7 +336,7 @@ TEST_F(DecomposeStridedArrayTest, WriteStorageStridedArray) {
// };
// @group(0) @binding(0) var<storage, read_write> s : S;
//
// @stage(compute) @workgroup_size(1)
// @compute @workgroup_size(1)
// fn f() {
// s.a = @stride(32) array<f32, 4u>();
// s.a = @stride(32) array<f32, 4u>(1.0, 2.0, 3.0, 4.0);
@ -371,7 +371,7 @@ struct S {
@group(0) @binding(0) var<storage, read_write> s : S;
@stage(compute) @workgroup_size(1i)
@compute @workgroup_size(1i)
fn f() {
s.a = array<strided_arr, 4u>();
s.a = array<strided_arr, 4u>(strided_arr(1.0f), strided_arr(2.0f), strided_arr(3.0f), strided_arr(4.0f));
@ -390,7 +390,7 @@ TEST_F(DecomposeStridedArrayTest, WriteStorageDefaultStridedArray) {
// };
// @group(0) @binding(0) var<storage, read_write> s : S;
//
// @stage(compute) @workgroup_size(1)
// @compute @workgroup_size(1)
// fn f() {
// s.a = @stride(4) array<f32, 4u>();
// s.a = @stride(4) array<f32, 4u>(1.0, 2.0, 3.0, 4.0);
@ -420,7 +420,7 @@ struct S {
@group(0) @binding(0) var<storage, read_write> s : S;
@stage(compute) @workgroup_size(1i)
@compute @workgroup_size(1i)
fn f() {
s.a = array<f32, 4u>();
s.a = array<f32, 4u>(1.0f, 2.0f, 3.0f, 4.0f);
@ -439,7 +439,7 @@ TEST_F(DecomposeStridedArrayTest, ReadWriteViaPointerLets) {
// };
// @group(0) @binding(0) var<storage, read_write> s : S;
//
// @stage(compute) @workgroup_size(1)
// @compute @workgroup_size(1)
// fn f() {
// let a = &s.a;
// let b = &*&*(a);
@ -479,7 +479,7 @@ struct S {
@group(0) @binding(0) var<storage, read_write> s : S;
@stage(compute) @workgroup_size(1i)
@compute @workgroup_size(1i)
fn f() {
let c = s.a;
let d = s.a[1i].el;
@ -500,7 +500,7 @@ TEST_F(DecomposeStridedArrayTest, PrivateAliasedStridedArray) {
// };
// @group(0) @binding(0) var<storage, read_write> s : S;
//
// @stage(compute) @workgroup_size(1)
// @compute @workgroup_size(1)
// fn f() {
// let a : ARR = s.a;
// let b : f32 = s.a[1];
@ -541,7 +541,7 @@ struct S {
@group(0) @binding(0) var<storage, read_write> s : S;
@stage(compute) @workgroup_size(1i)
@compute @workgroup_size(1i)
fn f() {
let a : ARR = s.a;
let b : f32 = s.a[1i].el;
@ -564,7 +564,7 @@ TEST_F(DecomposeStridedArrayTest, PrivateNestedStridedArray) {
// };
// @group(0) @binding(0) var<storage, read_write> s : S;
//
// @stage(compute) @workgroup_size(1)
// @compute @workgroup_size(1)
// fn f() {
// let a : ARR_B = s.a;
// let b : array<@stride(8) array<f32, 2u>, 3u> = s.a[3];
@ -641,7 +641,7 @@ struct S {
@group(0) @binding(0) var<storage, read_write> s : S;
@stage(compute) @workgroup_size(1i)
@compute @workgroup_size(1i)
fn f() {
let a : ARR_B = s.a;
let b : array<ARR_A, 3u> = s.a[3i].el;

View File

@ -62,7 +62,7 @@ TEST_F(DecomposeStridedMatrixTest, ReadUniformMatrix) {
// };
// @group(0) @binding(0) var<uniform> s : S;
//
// @stage(compute) @workgroup_size(1)
// @compute @workgroup_size(1)
// fn f() {
// let x : mat2x2<f32> = s.m;
// }
@ -99,7 +99,7 @@ fn arr_to_mat2x2_stride_32(arr : @stride(32) array<vec2<f32>, 2u>) -> mat2x2<f32
return mat2x2<f32>(arr[0u], arr[1u]);
}
@stage(compute) @workgroup_size(1i)
@compute @workgroup_size(1i)
fn f() {
let x : mat2x2<f32> = arr_to_mat2x2_stride_32(s.m);
}
@ -118,7 +118,7 @@ TEST_F(DecomposeStridedMatrixTest, ReadUniformColumn) {
// };
// @group(0) @binding(0) var<uniform> s : S;
//
// @stage(compute) @workgroup_size(1)
// @compute @workgroup_size(1)
// fn f() {
// let x : vec2<f32> = s.m[1];
// }
@ -152,7 +152,7 @@ struct S {
@group(0) @binding(0) var<uniform> s : S;
@stage(compute) @workgroup_size(1i)
@compute @workgroup_size(1i)
fn f() {
let x : vec2<f32> = s.m[1i];
}
@ -171,7 +171,7 @@ TEST_F(DecomposeStridedMatrixTest, ReadUniformMatrix_DefaultStride) {
// };
// @group(0) @binding(0) var<uniform> s : S;
//
// @stage(compute) @workgroup_size(1)
// @compute @workgroup_size(1)
// fn f() {
// let x : mat2x2<f32> = s.m;
// }
@ -205,7 +205,7 @@ struct S {
@group(0) @binding(0) var<uniform> s : S;
@stage(compute) @workgroup_size(1i)
@compute @workgroup_size(1i)
fn f() {
let x : mat2x2<f32> = s.m;
}
@ -224,7 +224,7 @@ TEST_F(DecomposeStridedMatrixTest, ReadStorageMatrix) {
// };
// @group(0) @binding(0) var<storage, read_write> s : S;
//
// @stage(compute) @workgroup_size(1)
// @compute @workgroup_size(1)
// fn f() {
// let x : mat2x2<f32> = s.m;
// }
@ -262,7 +262,7 @@ fn arr_to_mat2x2_stride_32(arr : @stride(32) array<vec2<f32>, 2u>) -> mat2x2<f32
return mat2x2<f32>(arr[0u], arr[1u]);
}
@stage(compute) @workgroup_size(1i)
@compute @workgroup_size(1i)
fn f() {
let x : mat2x2<f32> = arr_to_mat2x2_stride_32(s.m);
}
@ -281,7 +281,7 @@ TEST_F(DecomposeStridedMatrixTest, ReadStorageColumn) {
// };
// @group(0) @binding(0) var<storage, read_write> s : S;
//
// @stage(compute) @workgroup_size(1)
// @compute @workgroup_size(1)
// fn f() {
// let x : vec2<f32> = s.m[1];
// }
@ -316,7 +316,7 @@ struct S {
@group(0) @binding(0) var<storage, read_write> s : S;
@stage(compute) @workgroup_size(1i)
@compute @workgroup_size(1i)
fn f() {
let x : vec2<f32> = s.m[1i];
}
@ -335,7 +335,7 @@ TEST_F(DecomposeStridedMatrixTest, WriteStorageMatrix) {
// };
// @group(0) @binding(0) var<storage, read_write> s : S;
//
// @stage(compute) @workgroup_size(1)
// @compute @workgroup_size(1)
// fn f() {
// s.m = mat2x2<f32>(vec2<f32>(1.0, 2.0), vec2<f32>(3.0, 4.0));
// }
@ -374,7 +374,7 @@ fn mat2x2_stride_32_to_arr(m : mat2x2<f32>) -> @stride(32) array<vec2<f32>, 2u>
return @stride(32) array<vec2<f32>, 2u>(m[0u], m[1u]);
}
@stage(compute) @workgroup_size(1i)
@compute @workgroup_size(1i)
fn f() {
s.m = mat2x2_stride_32_to_arr(mat2x2<f32>(vec2<f32>(1.0f, 2.0f), vec2<f32>(3.0f, 4.0f)));
}
@ -393,7 +393,7 @@ TEST_F(DecomposeStridedMatrixTest, WriteStorageColumn) {
// };
// @group(0) @binding(0) var<storage, read_write> s : S;
//
// @stage(compute) @workgroup_size(1)
// @compute @workgroup_size(1)
// fn f() {
// s.m[1] = vec2<f32>(1.0, 2.0);
// }
@ -427,7 +427,7 @@ struct S {
@group(0) @binding(0) var<storage, read_write> s : S;
@stage(compute) @workgroup_size(1i)
@compute @workgroup_size(1i)
fn f() {
s.m[1i] = vec2<f32>(1.0f, 2.0f);
}
@ -446,7 +446,7 @@ TEST_F(DecomposeStridedMatrixTest, ReadWriteViaPointerLets) {
// };
// @group(0) @binding(0) var<storage, read_write> s : S;
//
// @stage(compute) @workgroup_size(1)
// @compute @workgroup_size(1)
// fn f() {
// let a = &s.m;
// let b = &*&*(a);
@ -500,7 +500,7 @@ fn mat2x2_stride_32_to_arr(m : mat2x2<f32>) -> @stride(32) array<vec2<f32>, 2u>
return @stride(32) array<vec2<f32>, 2u>(m[0u], m[1u]);
}
@stage(compute) @workgroup_size(1i)
@compute @workgroup_size(1i)
fn f() {
let x = arr_to_mat2x2_stride_32(s.m);
let y = s.m[1i];
@ -523,7 +523,7 @@ TEST_F(DecomposeStridedMatrixTest, ReadPrivateMatrix) {
// };
// var<private> s : S;
//
// @stage(compute) @workgroup_size(1)
// @compute @workgroup_size(1)
// fn f() {
// let x : mat2x2<f32> = s.m;
// }
@ -557,7 +557,7 @@ struct S {
var<private> s : S;
@stage(compute) @workgroup_size(1i)
@compute @workgroup_size(1i)
fn f() {
let x : mat2x2<f32> = s.m;
}
@ -576,7 +576,7 @@ TEST_F(DecomposeStridedMatrixTest, WritePrivateMatrix) {
// };
// var<private> s : S;
//
// @stage(compute) @workgroup_size(1)
// @compute @workgroup_size(1)
// fn f() {
// s.m = mat2x2<f32>(vec2<f32>(1.0, 2.0), vec2<f32>(3.0, 4.0));
// }
@ -611,7 +611,7 @@ struct S {
var<private> s : S;
@stage(compute) @workgroup_size(1i)
@compute @workgroup_size(1i)
fn f() {
s.m = mat2x2<f32>(vec2<f32>(1.0f, 2.0f), vec2<f32>(3.0f, 4.0f));
}

View File

@ -54,7 +54,7 @@ TEST_F(DisableUniformityAnalysisTest, NonEmptyModule) {
auto* src = R"(
@group(0) @binding(0) var<storage, read> global : i32;
@stage(compute) @workgroup_size(64)
@compute @workgroup_size(64)
fn main() {
if ((global == 42)) {
workgroupBarrier();

View File

@ -33,7 +33,7 @@ TEST_F(FirstIndexOffsetTest, ShouldRunEmptyModule) {
TEST_F(FirstIndexOffsetTest, ShouldRunFragmentStage) {
auto* src = R"(
@stage(fragment)
@fragment
fn entry() {
return;
}
@ -44,7 +44,7 @@ fn entry() {
TEST_F(FirstIndexOffsetTest, ShouldRunVertexStage) {
auto* src = R"(
@stage(vertex)
@vertex
fn entry() -> @builtin(position) vec4<f32> {
return vec4<f32>();
}
@ -70,7 +70,7 @@ TEST_F(FirstIndexOffsetTest, EmptyModule) {
TEST_F(FirstIndexOffsetTest, BasicVertexShader) {
auto* src = R"(
@stage(vertex)
@vertex
fn entry() -> @builtin(position) vec4<f32> {
return vec4<f32>();
}
@ -95,7 +95,7 @@ fn test(vert_idx : u32) -> u32 {
return vert_idx;
}
@stage(vertex)
@vertex
fn entry(@builtin(vertex_index) vert_idx : u32) -> @builtin(position) vec4<f32> {
test(vert_idx);
return vec4<f32>();
@ -114,7 +114,7 @@ fn test(vert_idx : u32) -> u32 {
return vert_idx;
}
@stage(vertex)
@vertex
fn entry(@builtin(vertex_index) vert_idx : u32) -> @builtin(position) vec4<f32> {
test((vert_idx + tint_symbol_1.first_vertex_index));
return vec4<f32>();
@ -135,7 +135,7 @@ fn entry(@builtin(vertex_index) vert_idx : u32) -> @builtin(position) vec4<f32>
TEST_F(FirstIndexOffsetTest, BasicModuleVertexIndex_OutOfOrder) {
auto* src = R"(
@stage(vertex)
@vertex
fn entry(@builtin(vertex_index) vert_idx : u32) -> @builtin(position) vec4<f32> {
test(vert_idx);
return vec4<f32>();
@ -154,7 +154,7 @@ struct tint_symbol {
@binding(1) @group(2) var<uniform> tint_symbol_1 : tint_symbol;
@stage(vertex)
@vertex
fn entry(@builtin(vertex_index) vert_idx : u32) -> @builtin(position) vec4<f32> {
test((vert_idx + tint_symbol_1.first_vertex_index));
return vec4<f32>();
@ -183,7 +183,7 @@ fn test(inst_idx : u32) -> u32 {
return inst_idx;
}
@stage(vertex)
@vertex
fn entry(@builtin(instance_index) inst_idx : u32) -> @builtin(position) vec4<f32> {
test(inst_idx);
return vec4<f32>();
@ -202,7 +202,7 @@ fn test(inst_idx : u32) -> u32 {
return inst_idx;
}
@stage(vertex)
@vertex
fn entry(@builtin(instance_index) inst_idx : u32) -> @builtin(position) vec4<f32> {
test((inst_idx + tint_symbol_1.first_instance_index));
return vec4<f32>();
@ -223,7 +223,7 @@ fn entry(@builtin(instance_index) inst_idx : u32) -> @builtin(position) vec4<f32
TEST_F(FirstIndexOffsetTest, BasicModuleInstanceIndex_OutOfOrder) {
auto* src = R"(
@stage(vertex)
@vertex
fn entry(@builtin(instance_index) inst_idx : u32) -> @builtin(position) vec4<f32> {
test(inst_idx);
return vec4<f32>();
@ -242,7 +242,7 @@ struct tint_symbol {
@binding(1) @group(7) var<uniform> tint_symbol_1 : tint_symbol;
@stage(vertex)
@vertex
fn entry(@builtin(instance_index) inst_idx : u32) -> @builtin(position) vec4<f32> {
test((inst_idx + tint_symbol_1.first_instance_index));
return vec4<f32>();
@ -276,7 +276,7 @@ struct Inputs {
@builtin(vertex_index) vert_idx : u32,
};
@stage(vertex)
@vertex
fn entry(inputs : Inputs) -> @builtin(position) vec4<f32> {
test(inputs.instance_idx, inputs.vert_idx);
return vec4<f32>();
@ -302,7 +302,7 @@ struct Inputs {
vert_idx : u32,
}
@stage(vertex)
@vertex
fn entry(inputs : Inputs) -> @builtin(position) vec4<f32> {
test((inputs.instance_idx + tint_symbol_1.first_instance_index), (inputs.vert_idx + tint_symbol_1.first_vertex_index));
return vec4<f32>();
@ -323,7 +323,7 @@ fn entry(inputs : Inputs) -> @builtin(position) vec4<f32> {
TEST_F(FirstIndexOffsetTest, BasicModuleBothIndex_OutOfOrder) {
auto* src = R"(
@stage(vertex)
@vertex
fn entry(inputs : Inputs) -> @builtin(position) vec4<f32> {
test(inputs.instance_idx, inputs.vert_idx);
return vec4<f32>();
@ -347,7 +347,7 @@ struct tint_symbol {
@binding(1) @group(2) var<uniform> tint_symbol_1 : tint_symbol;
@stage(vertex)
@vertex
fn entry(inputs : Inputs) -> @builtin(position) vec4<f32> {
test((inputs.instance_idx + tint_symbol_1.first_instance_index), (inputs.vert_idx + tint_symbol_1.first_vertex_index));
return vec4<f32>();
@ -387,7 +387,7 @@ fn func2(vert_idx : u32) -> u32 {
return func1(vert_idx);
}
@stage(vertex)
@vertex
fn entry(@builtin(vertex_index) vert_idx : u32) -> @builtin(position) vec4<f32> {
func2(vert_idx);
return vec4<f32>();
@ -410,7 +410,7 @@ fn func2(vert_idx : u32) -> u32 {
return func1(vert_idx);
}
@stage(vertex)
@vertex
fn entry(@builtin(vertex_index) vert_idx : u32) -> @builtin(position) vec4<f32> {
func2((vert_idx + tint_symbol_1.first_vertex_index));
return vec4<f32>();
@ -431,7 +431,7 @@ fn entry(@builtin(vertex_index) vert_idx : u32) -> @builtin(position) vec4<f32>
TEST_F(FirstIndexOffsetTest, NestedCalls_OutOfOrder) {
auto* src = R"(
@stage(vertex)
@vertex
fn entry(@builtin(vertex_index) vert_idx : u32) -> @builtin(position) vec4<f32> {
func2(vert_idx);
return vec4<f32>();
@ -454,7 +454,7 @@ struct tint_symbol {
@binding(1) @group(2) var<uniform> tint_symbol_1 : tint_symbol;
@stage(vertex)
@vertex
fn entry(@builtin(vertex_index) vert_idx : u32) -> @builtin(position) vec4<f32> {
func2((vert_idx + tint_symbol_1.first_vertex_index));
return vec4<f32>();
@ -487,19 +487,19 @@ fn func(i : u32) -> u32 {
return i;
}
@stage(vertex)
@vertex
fn entry_a(@builtin(vertex_index) vert_idx : u32) -> @builtin(position) vec4<f32> {
func(vert_idx);
return vec4<f32>();
}
@stage(vertex)
@vertex
fn entry_b(@builtin(vertex_index) vert_idx : u32, @builtin(instance_index) inst_idx : u32) -> @builtin(position) vec4<f32> {
func(vert_idx + inst_idx);
return vec4<f32>();
}
@stage(vertex)
@vertex
fn entry_c(@builtin(instance_index) inst_idx : u32) -> @builtin(position) vec4<f32> {
func(inst_idx);
return vec4<f32>();
@ -518,19 +518,19 @@ fn func(i : u32) -> u32 {
return i;
}
@stage(vertex)
@vertex
fn entry_a(@builtin(vertex_index) vert_idx : u32) -> @builtin(position) vec4<f32> {
func((vert_idx + tint_symbol_1.first_vertex_index));
return vec4<f32>();
}
@stage(vertex)
@vertex
fn entry_b(@builtin(vertex_index) vert_idx : u32, @builtin(instance_index) inst_idx : u32) -> @builtin(position) vec4<f32> {
func(((vert_idx + tint_symbol_1.first_vertex_index) + (inst_idx + tint_symbol_1.first_instance_index)));
return vec4<f32>();
}
@stage(vertex)
@vertex
fn entry_c(@builtin(instance_index) inst_idx : u32) -> @builtin(position) vec4<f32> {
func((inst_idx + tint_symbol_1.first_instance_index));
return vec4<f32>();
@ -551,19 +551,19 @@ fn entry_c(@builtin(instance_index) inst_idx : u32) -> @builtin(position) vec4<f
TEST_F(FirstIndexOffsetTest, MultipleEntryPoints_OutOfOrder) {
auto* src = R"(
@stage(vertex)
@vertex
fn entry_a(@builtin(vertex_index) vert_idx : u32) -> @builtin(position) vec4<f32> {
func(vert_idx);
return vec4<f32>();
}
@stage(vertex)
@vertex
fn entry_b(@builtin(vertex_index) vert_idx : u32, @builtin(instance_index) inst_idx : u32) -> @builtin(position) vec4<f32> {
func(vert_idx + inst_idx);
return vec4<f32>();
}
@stage(vertex)
@vertex
fn entry_c(@builtin(instance_index) inst_idx : u32) -> @builtin(position) vec4<f32> {
func(inst_idx);
return vec4<f32>();
@ -582,19 +582,19 @@ struct tint_symbol {
@binding(1) @group(2) var<uniform> tint_symbol_1 : tint_symbol;
@stage(vertex)
@vertex
fn entry_a(@builtin(vertex_index) vert_idx : u32) -> @builtin(position) vec4<f32> {
func((vert_idx + tint_symbol_1.first_vertex_index));
return vec4<f32>();
}
@stage(vertex)
@vertex
fn entry_b(@builtin(vertex_index) vert_idx : u32, @builtin(instance_index) inst_idx : u32) -> @builtin(position) vec4<f32> {
func(((vert_idx + tint_symbol_1.first_vertex_index) + (inst_idx + tint_symbol_1.first_instance_index)));
return vec4<f32>();
}
@stage(vertex)
@vertex
fn entry_c(@builtin(instance_index) inst_idx : u32) -> @builtin(position) vec4<f32> {
func((inst_idx + tint_symbol_1.first_instance_index));
return vec4<f32>();

View File

@ -46,7 +46,7 @@ struct OuterS {
@group(1) @binding(4) var<uniform> uniforms : Uniforms;
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
var v : InnerS;
var s1 : OuterS;
@ -69,7 +69,7 @@ struct OuterS {
@group(1) @binding(4) var<uniform> uniforms : Uniforms;
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
var v : InnerS;
var s1 : OuterS;
@ -88,7 +88,7 @@ fn main() {
TEST_F(LocalizeStructArrayAssignmentTest, StructArray_OutOfOrder) {
auto* src = R"(
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
var v : InnerS;
var s1 : OuterS;
@ -111,7 +111,7 @@ struct Uniforms {
)";
auto* expect = R"(
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
var v : InnerS;
var s1 : OuterS;
@ -162,7 +162,7 @@ struct OuterS {
@group(1) @binding(4) var<uniform> uniforms : Uniforms;
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
var v : InnerS;
var s1 : OuterS;
@ -189,7 +189,7 @@ struct OuterS {
@group(1) @binding(4) var<uniform> uniforms : Uniforms;
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
var v : InnerS;
var s1 : OuterS;
@ -208,7 +208,7 @@ fn main() {
TEST_F(LocalizeStructArrayAssignmentTest, StructStructArray_OutOfOrder) {
auto* src = R"(
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
var v : InnerS;
var s1 : OuterS;
@ -235,7 +235,7 @@ struct Uniforms {
)";
auto* expect = R"(
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
var v : InnerS;
var s1 : OuterS;
@ -287,7 +287,7 @@ struct OuterS {
@group(1) @binding(4) var<uniform> uniforms : Uniforms;
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
var v : InnerS;
var s1 : OuterS;
@ -311,7 +311,7 @@ struct OuterS {
@group(1) @binding(4) var<uniform> uniforms : Uniforms;
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
var v : InnerS;
var s1 : OuterS;
@ -348,7 +348,7 @@ struct OuterS {
@group(1) @binding(4) var<uniform> uniforms : Uniforms;
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
var v : InnerS;
var s1 : OuterS;
@ -375,7 +375,7 @@ struct OuterS {
@group(1) @binding(4) var<uniform> uniforms : Uniforms;
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
var v : InnerS;
var s1 : OuterS;
@ -413,7 +413,7 @@ struct OuterS {
@group(1) @binding(4) var<uniform> uniforms : Uniforms;
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
var v : InnerS;
var s : OuterS;
@ -441,7 +441,7 @@ struct OuterS {
@group(1) @binding(4) var<uniform> uniforms : Uniforms;
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
var v : InnerS;
var s : OuterS;
@ -488,7 +488,7 @@ fn getNextIndex() -> u32 {
@group(1) @binding(4) var<uniform> uniforms : Uniforms;
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
var v : InnerS;
var s : OuterS;
@ -523,7 +523,7 @@ fn getNextIndex() -> u32 {
@group(1) @binding(4) var<uniform> uniforms : Uniforms;
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
var v : InnerS;
var s : OuterS;
@ -545,7 +545,7 @@ fn main() {
TEST_F(LocalizeStructArrayAssignmentTest, IndexingWithSideEffectFunc_OutOfOrder) {
auto* src = R"(
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
var v : InnerS;
var s : OuterS;
@ -579,7 +579,7 @@ struct InnerS {
)";
auto* expect = R"(
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
var v : InnerS;
var s : OuterS;
@ -643,7 +643,7 @@ fn f(p : ptr<function, OuterS>) {
(*p).a1[uniforms.i] = v;
}
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
var s1 : OuterS;
f(&s1);
@ -675,7 +675,7 @@ fn f(p : ptr<function, OuterS>) {
}
}
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
var s1 : OuterS;
f(&(s1));
@ -688,7 +688,7 @@ fn main() {
TEST_F(LocalizeStructArrayAssignmentTest, ViaPointerArg_OutOfOrder) {
auto* src = R"(
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
var s1 : OuterS;
f(&s1);
@ -714,7 +714,7 @@ struct Uniforms {
)";
auto* expect = R"(
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
var s1 : OuterS;
f(&(s1));
@ -769,7 +769,7 @@ fn f(p : ptr<function, InnerS>, v : InnerS) {
*(p) = v;
}
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
var v : InnerS;
var s1 : OuterS;
@ -797,7 +797,7 @@ fn f(p : ptr<function, InnerS>, v : InnerS) {
*(p) = v;
}
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
var v : InnerS;
var s1 : OuterS;
@ -831,7 +831,7 @@ fn f(i : u32) -> u32 {
return (i + 1u);
}
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
var s1 : OuterS;
var v : vec3<f32>;

View File

@ -42,14 +42,14 @@ TEST_F(ModuleScopeVarToEntryPointParamTest, Basic) {
var<private> p : f32;
var<workgroup> w : f32;
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
w = p;
}
)";
auto* expect = R"(
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
@internal(disable_validation__ignore_storage_class) var<workgroup> tint_symbol : f32;
@internal(disable_validation__ignore_storage_class) var<private> tint_symbol_1 : f32;
@ -64,7 +64,7 @@ fn main() {
TEST_F(ModuleScopeVarToEntryPointParamTest, Basic_OutOfOrder) {
auto* src = R"(
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
w = p;
}
@ -74,7 +74,7 @@ var<private> p : f32;
)";
auto* expect = R"(
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
@internal(disable_validation__ignore_storage_class) var<workgroup> tint_symbol : f32;
@internal(disable_validation__ignore_storage_class) var<private> tint_symbol_1 : f32;
@ -106,7 +106,7 @@ fn foo(a : f32) {
no_uses();
}
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
foo(1.0);
}
@ -127,7 +127,7 @@ fn foo(a : f32, @internal(disable_validation__ignore_storage_class) @internal(di
no_uses();
}
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
@internal(disable_validation__ignore_storage_class) var<private> tint_symbol_4 : f32;
@internal(disable_validation__ignore_storage_class) var<workgroup> tint_symbol_5 : f32;
@ -142,7 +142,7 @@ fn main() {
TEST_F(ModuleScopeVarToEntryPointParamTest, FunctionCalls_OutOfOrder) {
auto* src = R"(
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
foo(1.0);
}
@ -166,7 +166,7 @@ var<workgroup> w : f32;
)";
auto* expect = R"(
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
@internal(disable_validation__ignore_storage_class) var<private> tint_symbol : f32;
@internal(disable_validation__ignore_storage_class) var<workgroup> tint_symbol_1 : f32;
@ -198,14 +198,14 @@ TEST_F(ModuleScopeVarToEntryPointParamTest, Constructors) {
var<private> a : f32 = 1.0;
var<private> b : f32 = f32();
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
let x : f32 = a + b;
}
)";
auto* expect = R"(
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
@internal(disable_validation__ignore_storage_class) var<private> tint_symbol : f32 = 1.0;
@internal(disable_validation__ignore_storage_class) var<private> tint_symbol_1 : f32 = f32();
@ -220,7 +220,7 @@ fn main() {
TEST_F(ModuleScopeVarToEntryPointParamTest, Constructors_OutOfOrder) {
auto* src = R"(
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
let x : f32 = a + b;
}
@ -230,7 +230,7 @@ var<private> a : f32 = 1.0;
)";
auto* expect = R"(
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
@internal(disable_validation__ignore_storage_class) var<private> tint_symbol : f32 = 1.0;
@internal(disable_validation__ignore_storage_class) var<private> tint_symbol_1 : f32 = f32();
@ -248,7 +248,7 @@ TEST_F(ModuleScopeVarToEntryPointParamTest, Pointers) {
var<private> p : f32;
var<workgroup> w : f32;
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
let p_ptr : ptr<private, f32> = &p;
let w_ptr : ptr<workgroup, f32> = &w;
@ -258,7 +258,7 @@ fn main() {
)";
auto* expect = R"(
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
@internal(disable_validation__ignore_storage_class) var<private> tint_symbol : f32;
@internal(disable_validation__ignore_storage_class) var<workgroup> tint_symbol_1 : f32;
@ -276,7 +276,7 @@ fn main() {
TEST_F(ModuleScopeVarToEntryPointParamTest, Pointers_OutOfOrder) {
auto* src = R"(
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
let p_ptr : ptr<private, f32> = &p;
let w_ptr : ptr<workgroup, f32> = &w;
@ -289,7 +289,7 @@ var<private> p : f32;
)";
auto* expect = R"(
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
@internal(disable_validation__ignore_storage_class) var<private> tint_symbol : f32;
@internal(disable_validation__ignore_storage_class) var<workgroup> tint_symbol_1 : f32;
@ -317,7 +317,7 @@ fn foo() {
bar(&v);
}
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
foo();
}
@ -332,7 +332,7 @@ fn foo(@internal(disable_validation__ignore_storage_class) @internal(disable_val
bar(tint_symbol);
}
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
@internal(disable_validation__ignore_storage_class) var<private> tint_symbol_1 : f32;
foo(&(tint_symbol_1));
@ -346,7 +346,7 @@ fn main() {
TEST_F(ModuleScopeVarToEntryPointParamTest, FoldAddressOfDeref_OutOfOrder) {
auto* src = R"(
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
foo();
}
@ -363,7 +363,7 @@ var<private> v : f32;
)";
auto* expect = R"(
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
@internal(disable_validation__ignore_storage_class) var<private> tint_symbol : f32;
foo(&(tint_symbol));
@ -394,7 +394,7 @@ var<uniform> u : S;
@group(0) @binding(1)
var<storage> s : S;
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
_ = u;
_ = s;
@ -406,7 +406,7 @@ struct S {
a : f32,
}
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main(@group(0) @binding(0) @internal(disable_validation__entry_point_parameter) @internal(disable_validation__ignore_storage_class) tint_symbol : ptr<uniform, S>, @group(0) @binding(1) @internal(disable_validation__entry_point_parameter) @internal(disable_validation__ignore_storage_class) tint_symbol_1 : ptr<storage, S>) {
_ = *(tint_symbol);
_ = *(tint_symbol_1);
@ -420,7 +420,7 @@ fn main(@group(0) @binding(0) @internal(disable_validation__entry_point_paramete
TEST_F(ModuleScopeVarToEntryPointParamTest, Buffers_Basic_OutOfOrder) {
auto* src = R"(
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
_ = u;
_ = s;
@ -436,7 +436,7 @@ struct S {
)";
auto* expect = R"(
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main(@group(0) @binding(0) @internal(disable_validation__entry_point_parameter) @internal(disable_validation__ignore_storage_class) tint_symbol : ptr<uniform, S>, @group(0) @binding(1) @internal(disable_validation__entry_point_parameter) @internal(disable_validation__ignore_storage_class) tint_symbol_1 : ptr<storage, S>) {
_ = *(tint_symbol);
_ = *(tint_symbol_1);
@ -457,7 +457,7 @@ TEST_F(ModuleScopeVarToEntryPointParamTest, Buffer_RuntimeArray) {
@group(0) @binding(0)
var<storage> buffer : array<f32>;
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
_ = buffer[0];
}
@ -468,7 +468,7 @@ struct tint_symbol_1 {
arr : array<f32>,
}
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main(@group(0) @binding(0) @internal(disable_validation__entry_point_parameter) @internal(disable_validation__ignore_storage_class) tint_symbol : ptr<storage, tint_symbol_1>) {
_ = (*(tint_symbol)).arr[0];
}
@ -481,7 +481,7 @@ fn main(@group(0) @binding(0) @internal(disable_validation__entry_point_paramete
TEST_F(ModuleScopeVarToEntryPointParamTest, Buffer_RuntimeArray_OutOfOrder) {
auto* src = R"(
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
_ = buffer[0];
}
@ -495,7 +495,7 @@ struct tint_symbol_1 {
arr : array<f32>,
}
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main(@group(0) @binding(0) @internal(disable_validation__entry_point_parameter) @internal(disable_validation__ignore_storage_class) tint_symbol : ptr<storage, tint_symbol_1>) {
_ = (*(tint_symbol)).arr[0];
}
@ -515,7 +515,7 @@ fn foo() {
_ = buffer[0];
}
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
foo();
}
@ -530,7 +530,7 @@ fn foo(@internal(disable_validation__ignore_storage_class) @internal(disable_val
_ = (*(tint_symbol))[0];
}
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main(@group(0) @binding(0) @internal(disable_validation__entry_point_parameter) @internal(disable_validation__ignore_storage_class) tint_symbol_1 : ptr<storage, tint_symbol_2>) {
foo(&((*(tint_symbol_1)).arr));
}
@ -543,7 +543,7 @@ fn main(@group(0) @binding(0) @internal(disable_validation__entry_point_paramete
TEST_F(ModuleScopeVarToEntryPointParamTest, Buffer_RuntimeArrayInsideFunction_OutOfOrder) {
auto* src = R"(
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
foo();
}
@ -560,7 +560,7 @@ struct tint_symbol_1 {
arr : array<f32>,
}
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main(@group(0) @binding(0) @internal(disable_validation__entry_point_parameter) @internal(disable_validation__ignore_storage_class) tint_symbol : ptr<storage, tint_symbol_1>) {
foo(&((*(tint_symbol)).arr));
}
@ -582,7 +582,7 @@ type myarray = array<f32>;
@group(0) @binding(0)
var<storage> buffer : myarray;
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
_ = buffer[0];
}
@ -595,7 +595,7 @@ struct tint_symbol_1 {
type myarray = array<f32>;
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main(@group(0) @binding(0) @internal(disable_validation__entry_point_parameter) @internal(disable_validation__ignore_storage_class) tint_symbol : ptr<storage, tint_symbol_1>) {
_ = (*(tint_symbol)).arr[0];
}
@ -608,7 +608,7 @@ fn main(@group(0) @binding(0) @internal(disable_validation__entry_point_paramete
TEST_F(ModuleScopeVarToEntryPointParamTest, Buffer_RuntimeArray_Alias_OutOfOrder) {
auto* src = R"(
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
_ = buffer[0];
}
@ -623,7 +623,7 @@ struct tint_symbol_1 {
arr : array<f32>,
}
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main(@group(0) @binding(0) @internal(disable_validation__entry_point_parameter) @internal(disable_validation__ignore_storage_class) tint_symbol : ptr<storage, tint_symbol_1>) {
_ = (*(tint_symbol)).arr[0];
}
@ -645,7 +645,7 @@ struct S {
@group(0) @binding(0)
var<storage> buffer : array<S>;
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
_ = buffer[0];
}
@ -660,7 +660,7 @@ struct tint_symbol_1 {
arr : array<S>,
}
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main(@group(0) @binding(0) @internal(disable_validation__entry_point_parameter) @internal(disable_validation__ignore_storage_class) tint_symbol : ptr<storage, tint_symbol_1>) {
_ = (*(tint_symbol)).arr[0];
}
@ -673,7 +673,7 @@ fn main(@group(0) @binding(0) @internal(disable_validation__entry_point_paramete
TEST_F(ModuleScopeVarToEntryPointParamTest, Buffer_ArrayOfStruct_OutOfOrder) {
auto* src = R"(
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
_ = buffer[0];
}
@ -694,7 +694,7 @@ struct tint_symbol_1 {
arr : array<S>,
}
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main(@group(0) @binding(0) @internal(disable_validation__entry_point_parameter) @internal(disable_validation__ignore_storage_class) tint_symbol : ptr<storage, tint_symbol_1>) {
_ = (*(tint_symbol)).arr[0];
}
@ -731,7 +731,7 @@ fn foo(a : f32) {
no_uses();
}
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
foo(1.0);
}
@ -757,7 +757,7 @@ fn foo(a : f32, @internal(disable_validation__ignore_storage_class) @internal(di
no_uses();
}
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main(@group(0) @binding(0) @internal(disable_validation__entry_point_parameter) @internal(disable_validation__ignore_storage_class) tint_symbol_4 : ptr<uniform, S>, @group(0) @binding(1) @internal(disable_validation__entry_point_parameter) @internal(disable_validation__ignore_storage_class) tint_symbol_5 : ptr<storage, S>) {
foo(1.0, tint_symbol_4, tint_symbol_5);
}
@ -770,7 +770,7 @@ fn main(@group(0) @binding(0) @internal(disable_validation__entry_point_paramete
TEST_F(ModuleScopeVarToEntryPointParamTest, Buffers_FunctionCalls_OutOfOrder) {
auto* src = R"(
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
foo(1.0);
}
@ -801,7 +801,7 @@ var<storage> s : S;
)";
auto* expect = R"(
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main(@group(0) @binding(0) @internal(disable_validation__entry_point_parameter) @internal(disable_validation__ignore_storage_class) tint_symbol : ptr<uniform, S>, @group(0) @binding(1) @internal(disable_validation__entry_point_parameter) @internal(disable_validation__ignore_storage_class) tint_symbol_1 : ptr<storage, S>) {
foo(1.0, tint_symbol, tint_symbol_1);
}
@ -836,7 +836,7 @@ TEST_F(ModuleScopeVarToEntryPointParamTest, HandleTypes_Basic) {
@group(0) @binding(0) var t : texture_2d<f32>;
@group(0) @binding(1) var s : sampler;
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
_ = t;
_ = s;
@ -844,7 +844,7 @@ fn main() {
)";
auto* expect = R"(
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main(@group(0) @binding(0) @internal(disable_validation__entry_point_parameter) tint_symbol : texture_2d<f32>, @group(0) @binding(1) @internal(disable_validation__entry_point_parameter) tint_symbol_1 : sampler) {
_ = tint_symbol;
_ = tint_symbol_1;
@ -876,7 +876,7 @@ fn foo(a : f32) {
no_uses();
}
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
foo(1.0);
}
@ -898,7 +898,7 @@ fn foo(a : f32, tint_symbol_2 : texture_2d<f32>, tint_symbol_3 : sampler) {
no_uses();
}
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main(@group(0) @binding(0) @internal(disable_validation__entry_point_parameter) tint_symbol_4 : texture_2d<f32>, @group(0) @binding(1) @internal(disable_validation__entry_point_parameter) tint_symbol_5 : sampler) {
foo(1.0, tint_symbol_4, tint_symbol_5);
}
@ -911,7 +911,7 @@ fn main(@group(0) @binding(0) @internal(disable_validation__entry_point_paramete
TEST_F(ModuleScopeVarToEntryPointParamTest, HandleTypes_FunctionCalls_OutOfOrder) {
auto* src = R"(
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
foo(1.0);
}
@ -936,7 +936,7 @@ fn bar(a : f32, b : f32) {
)";
auto* expect = R"(
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main(@group(0) @binding(0) @internal(disable_validation__entry_point_parameter) tint_symbol : texture_2d<f32>, @group(0) @binding(1) @internal(disable_validation__entry_point_parameter) tint_symbol_1 : sampler) {
foo(1.0, tint_symbol, tint_symbol_1);
}
@ -966,7 +966,7 @@ TEST_F(ModuleScopeVarToEntryPointParamTest, Matrix) {
auto* src = R"(
var<workgroup> m : mat2x2<f32>;
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
let x = m;
}
@ -977,7 +977,7 @@ struct tint_symbol_2 {
m : mat2x2<f32>,
}
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main(@internal(disable_validation__entry_point_parameter) tint_symbol_1 : ptr<workgroup, tint_symbol_2>) {
let tint_symbol : ptr<workgroup, mat2x2<f32>> = &((*(tint_symbol_1)).m);
let x = *(tint_symbol);
@ -999,7 +999,7 @@ struct S2 {
};
var<workgroup> m : array<S2, 4>;
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
let x = m;
}
@ -1018,7 +1018,7 @@ struct tint_symbol_2 {
m : array<S2, 4u>,
}
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main(@internal(disable_validation__entry_point_parameter) tint_symbol_1 : ptr<workgroup, tint_symbol_2>) {
let tint_symbol : ptr<workgroup, array<S2, 4u>> = &((*(tint_symbol_1)).m);
let x = *(tint_symbol);
@ -1042,7 +1042,7 @@ var<workgroup> a : S;
var<workgroup> b : S;
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
let x = a;
let y = b;
@ -1059,7 +1059,7 @@ struct tint_symbol_3 {
b : S,
}
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main(@internal(disable_validation__entry_point_parameter) tint_symbol_1 : ptr<workgroup, tint_symbol_3>) {
let tint_symbol : ptr<workgroup, S> = &((*(tint_symbol_1)).a);
let tint_symbol_2 : ptr<workgroup, S> = &((*(tint_symbol_1)).b);
@ -1077,7 +1077,7 @@ fn main(@internal(disable_validation__entry_point_parameter) tint_symbol_1 : ptr
// variables that are promoted to threadgroup memory arguments.
TEST_F(ModuleScopeVarToEntryPointParamTest, DuplicateThreadgroupArgumentTypes_OutOfOrder) {
auto* src = R"(
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
let x = a;
let y = b;
@ -1101,7 +1101,7 @@ struct tint_symbol_3 {
b : S,
}
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main(@internal(disable_validation__entry_point_parameter) tint_symbol_1 : ptr<workgroup, tint_symbol_3>) {
let tint_symbol : ptr<workgroup, S> = &((*(tint_symbol_1)).a);
let tint_symbol_2 : ptr<workgroup, S> = &((*(tint_symbol_1)).b);
@ -1132,7 +1132,7 @@ var<storage> sb : S;
@group(0) @binding(2) var t : texture_2d<f32>;
@group(0) @binding(3) var s : sampler;
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
}
)";
@ -1142,7 +1142,7 @@ struct S {
a : f32,
}
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
}
)";

View File

@ -56,7 +56,7 @@ TEST_F(MultiplanarExternalTextureTest, ErrorNoPassedData) {
@group(0) @binding(0) var s : sampler;
@group(0) @binding(1) var ext_tex : texture_external;
@stage(fragment)
@fragment
fn main(@builtin(position) coord : vec4<f32>) -> @location(0) vec4<f32> {
return textureSampleLevel(ext_tex, s, coord.xy);
}
@ -74,7 +74,7 @@ TEST_F(MultiplanarExternalTextureTest, ErrorIncorrectBindingPont) {
@group(0) @binding(0) var s : sampler;
@group(0) @binding(1) var ext_tex : texture_external;
@stage(fragment)
@fragment
fn main(@builtin(position) coord : vec4<f32>) -> @location(0) vec4<f32> {
return textureSampleLevel(ext_tex, s, coord.xy);
}
@ -96,7 +96,7 @@ TEST_F(MultiplanarExternalTextureTest, Dimensions) {
auto* src = R"(
@group(0) @binding(0) var ext_tex : texture_external;
@stage(fragment)
@fragment
fn main(@builtin(position) coord : vec4<f32>) -> @location(0) vec4<f32> {
var dim : vec2<i32>;
dim = textureDimensions(ext_tex);
@ -130,7 +130,7 @@ struct ExternalTextureParams {
@group(0) @binding(0) var ext_tex : texture_2d<f32>;
@stage(fragment)
@fragment
fn main(@builtin(position) coord : vec4<f32>) -> @location(0) vec4<f32> {
var dim : vec2<i32>;
dim = textureDimensions(ext_tex);
@ -148,7 +148,7 @@ fn main(@builtin(position) coord : vec4<f32>) -> @location(0) vec4<f32> {
// Tests that the transform works with a textureDimensions call.
TEST_F(MultiplanarExternalTextureTest, Dimensions_OutOfOrder) {
auto* src = R"(
@stage(fragment)
@fragment
fn main(@builtin(position) coord : vec4<f32>) -> @location(0) vec4<f32> {
var dim : vec2<i32>;
dim = textureDimensions(ext_tex);
@ -182,7 +182,7 @@ struct ExternalTextureParams {
@group(0) @binding(2) var<uniform> ext_tex_params : ExternalTextureParams;
@stage(fragment)
@fragment
fn main(@builtin(position) coord : vec4<f32>) -> @location(0) vec4<f32> {
var dim : vec2<i32>;
dim = textureDimensions(ext_tex);
@ -205,7 +205,7 @@ TEST_F(MultiplanarExternalTextureTest, BasicTextureSampleLevel) {
@group(0) @binding(0) var s : sampler;
@group(0) @binding(1) var ext_tex : texture_external;
@stage(fragment)
@fragment
fn main(@builtin(position) coord : vec4<f32>) -> @location(0) vec4<f32> {
return textureSampleLevel(ext_tex, s, coord.xy);
}
@ -259,7 +259,7 @@ fn textureSampleExternal(plane0 : texture_2d<f32>, plane1 : texture_2d<f32>, smp
return vec4<f32>(color, 1.0f);
}
@stage(fragment)
@fragment
fn main(@builtin(position) coord : vec4<f32>) -> @location(0) vec4<f32> {
return textureSampleExternal(ext_tex, ext_tex_plane_1, s, coord.xy, ext_tex_params);
}
@ -275,7 +275,7 @@ fn main(@builtin(position) coord : vec4<f32>) -> @location(0) vec4<f32> {
// Test that the transform works with a textureSampleLevel call.
TEST_F(MultiplanarExternalTextureTest, BasicTextureSampleLevel_OutOfOrder) {
auto* src = R"(
@stage(fragment)
@fragment
fn main(@builtin(position) coord : vec4<f32>) -> @location(0) vec4<f32> {
return textureSampleLevel(ext_tex, s, coord.xy);
}
@ -328,7 +328,7 @@ fn textureSampleExternal(plane0 : texture_2d<f32>, plane1 : texture_2d<f32>, smp
return vec4<f32>(color, 1.0f);
}
@stage(fragment)
@fragment
fn main(@builtin(position) coord : vec4<f32>) -> @location(0) vec4<f32> {
return textureSampleExternal(ext_tex, ext_tex_plane_1, s, coord.xy, ext_tex_params);
}
@ -350,7 +350,7 @@ TEST_F(MultiplanarExternalTextureTest, BasicTextureLoad) {
auto* src = R"(
@group(0) @binding(0) var ext_tex : texture_external;
@stage(fragment)
@fragment
fn main(@builtin(position) coord : vec4<f32>) -> @location(0) vec4<f32> {
return textureLoad(ext_tex, vec2<i32>(1, 1));
}
@ -402,7 +402,7 @@ fn textureLoadExternal(plane0 : texture_2d<f32>, plane1 : texture_2d<f32>, coord
return vec4<f32>(color, 1.0f);
}
@stage(fragment)
@fragment
fn main(@builtin(position) coord : vec4<f32>) -> @location(0) vec4<f32> {
return textureLoadExternal(ext_tex, ext_tex_plane_1, vec2<i32>(1, 1), ext_tex_params);
}
@ -418,7 +418,7 @@ fn main(@builtin(position) coord : vec4<f32>) -> @location(0) vec4<f32> {
// Tests that the transform works with a textureLoad call.
TEST_F(MultiplanarExternalTextureTest, BasicTextureLoad_OutOfOrder) {
auto* src = R"(
@stage(fragment)
@fragment
fn main(@builtin(position) coord : vec4<f32>) -> @location(0) vec4<f32> {
return textureLoad(ext_tex, vec2<i32>(1, 1));
}
@ -470,7 +470,7 @@ fn textureLoadExternal(plane0 : texture_2d<f32>, plane1 : texture_2d<f32>, coord
return vec4<f32>(color, 1.0f);
}
@stage(fragment)
@fragment
fn main(@builtin(position) coord : vec4<f32>) -> @location(0) vec4<f32> {
return textureLoadExternal(ext_tex, ext_tex_plane_1, vec2<i32>(1, 1), ext_tex_params);
}
@ -492,7 +492,7 @@ TEST_F(MultiplanarExternalTextureTest, TextureSampleAndTextureLoad) {
@group(0) @binding(0) var s : sampler;
@group(0) @binding(1) var ext_tex : texture_external;
@stage(fragment)
@fragment
fn main(@builtin(position) coord : vec4<f32>) -> @location(0) vec4<f32> {
return textureSampleLevel(ext_tex, s, coord.xy) + textureLoad(ext_tex, vec2<i32>(1, 1));
}
@ -559,7 +559,7 @@ fn textureLoadExternal(plane0 : texture_2d<f32>, plane1 : texture_2d<f32>, coord
return vec4<f32>(color, 1.0f);
}
@stage(fragment)
@fragment
fn main(@builtin(position) coord : vec4<f32>) -> @location(0) vec4<f32> {
return (textureSampleExternal(ext_tex, ext_tex_plane_1, s, coord.xy, ext_tex_params) + textureLoadExternal(ext_tex, ext_tex_plane_1, vec2<i32>(1, 1), ext_tex_params));
}
@ -576,7 +576,7 @@ fn main(@builtin(position) coord : vec4<f32>) -> @location(0) vec4<f32> {
// call.
TEST_F(MultiplanarExternalTextureTest, TextureSampleAndTextureLoad_OutOfOrder) {
auto* src = R"(
@stage(fragment)
@fragment
fn main(@builtin(position) coord : vec4<f32>) -> @location(0) vec4<f32> {
return textureSampleLevel(ext_tex, s, coord.xy) + textureLoad(ext_tex, vec2<i32>(1, 1));
}
@ -642,7 +642,7 @@ fn textureLoadExternal(plane0 : texture_2d<f32>, plane1 : texture_2d<f32>, coord
return vec4<f32>(color, 1.0f);
}
@stage(fragment)
@fragment
fn main(@builtin(position) coord : vec4<f32>) -> @location(0) vec4<f32> {
return (textureSampleExternal(ext_tex, ext_tex_plane_1, s, coord.xy, ext_tex_params) + textureLoadExternal(ext_tex, ext_tex_plane_1, vec2<i32>(1, 1), ext_tex_params));
}
@ -668,7 +668,7 @@ TEST_F(MultiplanarExternalTextureTest, ManyTextureSampleLevel) {
@group(0) @binding(3) var ext_tex_2 : texture_external;
@group(1) @binding(0) var ext_tex_3 : texture_external;
@stage(fragment)
@fragment
fn main(@builtin(position) coord : vec4<f32>) -> @location(0) vec4<f32> {
return textureSampleLevel(ext_tex, s, coord.xy) + textureSampleLevel(ext_tex_1, s, coord.xy) + textureSampleLevel(ext_tex_2, s, coord.xy) + textureSampleLevel(ext_tex_3, s, coord.xy);
}
@ -740,7 +740,7 @@ fn textureSampleExternal(plane0 : texture_2d<f32>, plane1 : texture_2d<f32>, smp
return vec4<f32>(color, 1.0f);
}
@stage(fragment)
@fragment
fn main(@builtin(position) coord : vec4<f32>) -> @location(0) vec4<f32> {
return (((textureSampleExternal(ext_tex, ext_tex_plane_1, s, coord.xy, ext_tex_params) + textureSampleExternal(ext_tex_1, ext_tex_plane_1_1, s, coord.xy, ext_tex_params_1)) + textureSampleExternal(ext_tex_2, ext_tex_plane_1_2, s, coord.xy, ext_tex_params_2)) + textureSampleExternal(ext_tex_3, ext_tex_plane_1_3, s, coord.xy, ext_tex_params_3));
}
@ -768,7 +768,7 @@ fn f(t : texture_external, s : sampler) {
@group(0) @binding(0) var ext_tex : texture_external;
@group(0) @binding(1) var smp : sampler;
@stage(fragment)
@fragment
fn main() {
f(ext_tex, smp);
}
@ -826,7 +826,7 @@ fn f(t : texture_2d<f32>, ext_tex_plane_1_1 : texture_2d<f32>, ext_tex_params_1
@group(0) @binding(1) var smp : sampler;
@stage(fragment)
@fragment
fn main() {
f(ext_tex, ext_tex_plane_1, ext_tex_params, smp);
}
@ -843,7 +843,7 @@ fn main() {
// correct output.
TEST_F(MultiplanarExternalTextureTest, ExternalTexturePassedAsParam_OutOfOrder) {
auto* src = R"(
@stage(fragment)
@fragment
fn main() {
f(ext_tex, smp);
}
@ -880,7 +880,7 @@ struct ExternalTextureParams {
@group(0) @binding(3) var<uniform> ext_tex_params : ExternalTextureParams;
@stage(fragment)
@fragment
fn main() {
f(ext_tex, ext_tex_plane_1, ext_tex_params, smp);
}
@ -932,7 +932,7 @@ fn f(s : sampler, t : texture_external) {
@group(0) @binding(0) var ext_tex : texture_external;
@group(0) @binding(1) var smp : sampler;
@stage(fragment)
@fragment
fn main() {
f(smp, ext_tex);
}
@ -990,7 +990,7 @@ fn f(s : sampler, t : texture_2d<f32>, ext_tex_plane_1_1 : texture_2d<f32>, ext_
@group(0) @binding(1) var smp : sampler;
@stage(fragment)
@fragment
fn main() {
f(smp, ext_tex, ext_tex_plane_1, ext_tex_params);
}
@ -1016,7 +1016,7 @@ fn f(t : texture_external, s : sampler, t2 : texture_external) {
@group(0) @binding(1) var smp : sampler;
@group(0) @binding(2) var ext_tex2 : texture_external;
@stage(fragment)
@fragment
fn main() {
f(ext_tex, smp, ext_tex2);
}
@ -1081,7 +1081,7 @@ fn f(t : texture_2d<f32>, ext_tex_plane_1_2 : texture_2d<f32>, ext_tex_params_2
@group(0) @binding(2) var ext_tex2 : texture_2d<f32>;
@stage(fragment)
@fragment
fn main() {
f(ext_tex, ext_tex_plane_1, ext_tex_params, smp, ext_tex2, ext_tex_plane_1_1, ext_tex_params_1);
}
@ -1099,7 +1099,7 @@ fn main() {
// correct output.
TEST_F(MultiplanarExternalTextureTest, ExternalTexturePassedAsParamMultiple_OutOfOrder) {
auto* src = R"(
@stage(fragment)
@fragment
fn main() {
f(ext_tex, smp, ext_tex2);
}
@ -1143,7 +1143,7 @@ struct ExternalTextureParams {
@group(0) @binding(6) var<uniform> ext_tex_params_1 : ExternalTextureParams;
@stage(fragment)
@fragment
fn main() {
f(ext_tex, ext_tex_plane_1, ext_tex_params, smp, ext_tex2, ext_tex_plane_1_1, ext_tex_params_1);
}
@ -1203,7 +1203,7 @@ fn f(t : texture_external, s : sampler) {
@group(0) @binding(0) var ext_tex : texture_external;
@group(0) @binding(1) var smp : sampler;
@stage(fragment)
@fragment
fn main() {
f(ext_tex, smp);
}
@ -1265,7 +1265,7 @@ fn f(t : texture_2d<f32>, ext_tex_plane_1_2 : texture_2d<f32>, ext_tex_params_2
@group(0) @binding(1) var smp : sampler;
@stage(fragment)
@fragment
fn main() {
f(ext_tex, ext_tex_plane_1, ext_tex_params, smp);
}
@ -1293,7 +1293,7 @@ fn f(t : texture_external, s : sampler) {
@group(0) @binding(0) var ext_tex : texture_external;
@group(0) @binding(1) var smp : sampler;
@stage(fragment)
@fragment
fn main() {
f(ext_tex, smp);
}
@ -1355,7 +1355,7 @@ fn f(t : texture_2d<f32>, ext_tex_plane_1_2 : texture_2d<f32>, ext_tex_params_2
@group(0) @binding(1) var smp : sampler;
@stage(fragment)
@fragment
fn main() {
f(ext_tex, ext_tex_plane_1, ext_tex_params, smp);
}
@ -1421,7 +1421,7 @@ fn f(t : ET, s : sampler) {
@group(0) @binding(0) var ext_tex : ET;
@group(0) @binding(1) var smp : sampler;
@stage(fragment)
@fragment
fn main() {
f(ext_tex, smp);
}
@ -1481,7 +1481,7 @@ fn f(t : texture_2d<f32>, ext_tex_plane_1_1 : texture_2d<f32>, ext_tex_params_1
@group(0) @binding(1) var smp : sampler;
@stage(fragment)
@fragment
fn main() {
f(ext_tex, ext_tex_plane_1, ext_tex_params, smp);
}
@ -1497,7 +1497,7 @@ fn main() {
// Tests that the the transform handles aliases to external textures
TEST_F(MultiplanarExternalTextureTest, ExternalTextureAlias_OutOfOrder) {
auto* src = R"(
@stage(fragment)
@fragment
fn main() {
f(ext_tex, smp);
}
@ -1536,7 +1536,7 @@ struct ExternalTextureParams {
@group(0) @binding(3) var<uniform> ext_tex_params : ExternalTextureParams;
@stage(fragment)
@fragment
fn main() {
f(ext_tex, ext_tex_plane_1, ext_tex_params, smp);
}

View File

@ -33,7 +33,7 @@ TEST_F(NumWorkgroupsFromUniformTest, ShouldRunEmptyModule) {
TEST_F(NumWorkgroupsFromUniformTest, ShouldRunHasNumWorkgroups) {
auto* src = R"(
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main(@builtin(num_workgroups) num_wgs : vec3<u32>) {
}
)";
@ -43,7 +43,7 @@ fn main(@builtin(num_workgroups) num_wgs : vec3<u32>) {
TEST_F(NumWorkgroupsFromUniformTest, Error_MissingTransformData) {
auto* src = R"(
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main(@builtin(num_workgroups) num_wgs : vec3<u32>) {
}
)";
@ -61,7 +61,7 @@ fn main(@builtin(num_workgroups) num_wgs : vec3<u32>) {
TEST_F(NumWorkgroupsFromUniformTest, Basic) {
auto* src = R"(
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main(@builtin(num_workgroups) num_wgs : vec3<u32>) {
let groups_x = num_wgs.x;
let groups_y = num_wgs.y;
@ -82,7 +82,7 @@ fn main_inner(num_wgs : vec3<u32>) {
let groups_z = num_wgs.z;
}
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
main_inner(tint_symbol_3.num_workgroups);
}
@ -101,7 +101,7 @@ struct Builtins {
@builtin(num_workgroups) num_wgs : vec3<u32>,
};
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main(in : Builtins) {
let groups_x = in.num_wgs.x;
let groups_y = in.num_wgs.y;
@ -126,7 +126,7 @@ fn main_inner(in : Builtins) {
let groups_z = in.num_wgs.z;
}
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
main_inner(Builtins(tint_symbol_3.num_workgroups));
}
@ -141,7 +141,7 @@ fn main() {
TEST_F(NumWorkgroupsFromUniformTest, StructOnlyMember_OutOfOrder) {
auto* src = R"(
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main(in : Builtins) {
let groups_x = in.num_wgs.x;
let groups_y = in.num_wgs.y;
@ -166,7 +166,7 @@ fn main_inner(in : Builtins) {
let groups_z = in.num_wgs.z;
}
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
main_inner(Builtins(tint_symbol_3.num_workgroups));
}
@ -191,7 +191,7 @@ struct Builtins {
@builtin(workgroup_id) wgid : vec3<u32>,
};
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main(in : Builtins) {
let groups_x = in.num_wgs.x;
let groups_y = in.num_wgs.y;
@ -225,7 +225,7 @@ fn main_inner(in : Builtins) {
let groups_z = in.num_wgs.z;
}
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main(tint_symbol : tint_symbol_1) {
main_inner(Builtins(tint_symbol.gid, tint_symbol_3.num_workgroups, tint_symbol.wgid));
}
@ -240,7 +240,7 @@ fn main(tint_symbol : tint_symbol_1) {
TEST_F(NumWorkgroupsFromUniformTest, StructMultipleMembers_OutOfOrder) {
auto* src = R"(
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main(in : Builtins) {
let groups_x = in.num_wgs.x;
let groups_y = in.num_wgs.y;
@ -275,7 +275,7 @@ fn main_inner(in : Builtins) {
let groups_z = in.num_wgs.z;
}
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main(tint_symbol : tint_symbol_1) {
main_inner(Builtins(tint_symbol.gid, tint_symbol_3.num_workgroups, tint_symbol.wgid));
}
@ -306,21 +306,21 @@ struct Builtins2 {
@builtin(workgroup_id) wgid : vec3<u32>,
};
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main1(in : Builtins1) {
let groups_x = in.num_wgs.x;
let groups_y = in.num_wgs.y;
let groups_z = in.num_wgs.z;
}
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main2(in : Builtins2) {
let groups_x = in.num_wgs.x;
let groups_y = in.num_wgs.y;
let groups_z = in.num_wgs.z;
}
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main3(@builtin(num_workgroups) num_wgs : vec3<u32>) {
let groups_x = num_wgs.x;
let groups_y = num_wgs.y;
@ -351,7 +351,7 @@ fn main1_inner(in : Builtins1) {
let groups_z = in.num_wgs.z;
}
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main1() {
main1_inner(Builtins1(tint_symbol_7.num_workgroups));
}
@ -369,7 +369,7 @@ fn main2_inner(in : Builtins2) {
let groups_z = in.num_wgs.z;
}
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main2(tint_symbol_2 : tint_symbol_3) {
main2_inner(Builtins2(tint_symbol_2.gid, tint_symbol_7.num_workgroups, tint_symbol_2.wgid));
}
@ -380,7 +380,7 @@ fn main3_inner(num_wgs : vec3<u32>) {
let groups_z = num_wgs.z;
}
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main3() {
main3_inner(tint_symbol_7.num_workgroups);
}
@ -400,7 +400,7 @@ struct Builtins {
@builtin(workgroup_id) wgid : vec3<u32>,
};
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main(in : Builtins) {
}
)";
@ -421,7 +421,7 @@ struct tint_symbol_1 {
fn main_inner(in : Builtins) {
}
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main(tint_symbol : tint_symbol_1) {
main_inner(Builtins(tint_symbol.gid, tint_symbol.wgid));
}
@ -448,21 +448,21 @@ struct Builtins2 {
@builtin(workgroup_id) wgid : vec3<u32>,
};
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main1(in : Builtins1) {
let groups_x = in.num_wgs.x;
let groups_y = in.num_wgs.y;
let groups_z = in.num_wgs.z;
}
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main2(in : Builtins2) {
let groups_x = in.num_wgs.x;
let groups_y = in.num_wgs.y;
let groups_z = in.num_wgs.z;
}
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main3(@builtin(num_workgroups) num_wgs : vec3<u32>) {
let groups_x = num_wgs.x;
let groups_y = num_wgs.y;
@ -493,7 +493,7 @@ fn main1_inner(in : Builtins1) {
let groups_z = in.num_wgs.z;
}
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main1() {
main1_inner(Builtins1(tint_symbol_7.num_workgroups));
}
@ -511,7 +511,7 @@ fn main2_inner(in : Builtins2) {
let groups_z = in.num_wgs.z;
}
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main2(tint_symbol_2 : tint_symbol_3) {
main2_inner(Builtins2(tint_symbol_2.gid, tint_symbol_7.num_workgroups, tint_symbol_2.wgid));
}
@ -522,7 +522,7 @@ fn main3_inner(num_wgs : vec3<u32>) {
let groups_z = num_wgs.z;
}
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main3() {
main3_inner(tint_symbol_7.num_workgroups);
}
@ -572,7 +572,7 @@ struct S1 {
@group(1) @binding(3) var<storage, read> g9 : S0;
@group(3) @binding(2) var<storage, read_write> g10 : S0;
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main1(in : Builtins1) {
let groups_x = in.num_wgs.x;
let groups_y = in.num_wgs.y;
@ -580,14 +580,14 @@ fn main1(in : Builtins1) {
g8.m0 = 1u;
}
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main2(in : Builtins2) {
let groups_x = in.num_wgs.x;
let groups_y = in.num_wgs.y;
let groups_z = in.num_wgs.z;
}
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main3(@builtin(num_workgroups) num_wgs : vec3<u32>) {
let groups_x = num_wgs.x;
let groups_y = num_wgs.y;
@ -647,7 +647,7 @@ fn main1_inner(in : Builtins1) {
g8.m0 = 1u;
}
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main1() {
main1_inner(Builtins1(tint_symbol_7.num_workgroups));
}
@ -665,7 +665,7 @@ fn main2_inner(in : Builtins2) {
let groups_z = in.num_wgs.z;
}
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main2(tint_symbol_2 : tint_symbol_3) {
main2_inner(Builtins2(tint_symbol_2.gid, tint_symbol_7.num_workgroups, tint_symbol_2.wgid));
}
@ -676,7 +676,7 @@ fn main3_inner(num_wgs : vec3<u32>) {
let groups_z = num_wgs.z;
}
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main3() {
main3_inner(tint_symbol_7.num_workgroups);
}

View File

@ -50,7 +50,7 @@ fn test(vert_idx : u32) -> u32 {
return vert_idx;
}
@stage(vertex)
@vertex
fn entry(@builtin(vertex_index) vert_idx : u32
) -> @builtin(position) vec4<f32> {
_ = test(vert_idx);
@ -63,7 +63,7 @@ fn tint_symbol(tint_symbol_1 : u32) -> u32 {
return tint_symbol_1;
}
@stage(vertex)
@vertex
fn tint_symbol_2(@builtin(vertex_index) tint_symbol_1 : u32) -> @builtin(position) vec4<f32> {
_ = tint_symbol(tint_symbol_1);
return vec4<f32>();
@ -87,7 +87,7 @@ fn tint_symbol_2(@builtin(vertex_index) tint_symbol_1 : u32) -> @builtin(positio
TEST_F(RenamerTest, PreserveSwizzles) {
auto* src = R"(
@stage(vertex)
@vertex
fn entry() -> @builtin(position) vec4<f32> {
var v : vec4<f32>;
var rgba : f32;
@ -97,7 +97,7 @@ fn entry() -> @builtin(position) vec4<f32> {
)";
auto* expect = R"(
@stage(vertex)
@vertex
fn tint_symbol() -> @builtin(position) vec4<f32> {
var tint_symbol_1 : vec4<f32>;
var tint_symbol_2 : f32;
@ -124,7 +124,7 @@ fn tint_symbol() -> @builtin(position) vec4<f32> {
TEST_F(RenamerTest, PreserveBuiltins) {
auto* src = R"(
@stage(vertex)
@vertex
fn entry() -> @builtin(position) vec4<f32> {
var blah : vec4<f32>;
return abs(blah);
@ -132,7 +132,7 @@ fn entry() -> @builtin(position) vec4<f32> {
)";
auto* expect = R"(
@stage(vertex)
@vertex
fn tint_symbol() -> @builtin(position) vec4<f32> {
var tint_symbol_1 : vec4<f32>;
return abs(tint_symbol_1);
@ -155,7 +155,7 @@ fn tint_symbol() -> @builtin(position) vec4<f32> {
TEST_F(RenamerTest, PreserveBuiltinTypes) {
auto* src = R"(
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn entry() {
var a = modf(1.0).whole;
var b = modf(1.0).fract;
@ -165,7 +165,7 @@ fn entry() {
)";
auto* expect = R"(
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn tint_symbol() {
var tint_symbol_1 = modf(1.0).whole;
var tint_symbol_2 = modf(1.0).fract;
@ -190,7 +190,7 @@ fn tint_symbol() {
TEST_F(RenamerTest, PreserveUnicode) {
auto src = R"(
@stage(fragment)
@fragment
fn frag_main() {
var )" + std::string(kUnicodeIdentifier) +
R"( : i32;
@ -209,7 +209,7 @@ fn frag_main() {
TEST_F(RenamerTest, AttemptSymbolCollision) {
auto* src = R"(
@stage(vertex)
@vertex
fn entry() -> @builtin(position) vec4<f32> {
var tint_symbol : vec4<f32>;
var tint_symbol_2 : vec4<f32>;
@ -219,7 +219,7 @@ fn entry() -> @builtin(position) vec4<f32> {
)";
auto* expect = R"(
@stage(vertex)
@vertex
fn tint_symbol() -> @builtin(position) vec4<f32> {
var tint_symbol_1 : vec4<f32>;
var tint_symbol_2 : vec4<f32>;
@ -252,7 +252,7 @@ TEST_P(RenamerTestGlsl, Keywords) {
auto keyword = GetParam();
auto src = R"(
@stage(fragment)
@fragment
fn frag_main() {
var )" + keyword +
R"( : i32;
@ -260,7 +260,7 @@ fn frag_main() {
)";
auto* expect = R"(
@stage(fragment)
@fragment
fn frag_main() {
var tint_symbol : i32;
}
@ -278,7 +278,7 @@ TEST_P(RenamerTestHlsl, Keywords) {
auto keyword = GetParam();
auto src = R"(
@stage(fragment)
@fragment
fn frag_main() {
var )" + keyword +
R"( : i32;
@ -286,7 +286,7 @@ fn frag_main() {
)";
auto* expect = R"(
@stage(fragment)
@fragment
fn frag_main() {
var tint_symbol : i32;
}
@ -304,7 +304,7 @@ TEST_P(RenamerTestMsl, Keywords) {
auto keyword = GetParam();
auto src = R"(
@stage(fragment)
@fragment
fn frag_main() {
var )" + keyword +
R"( : i32;
@ -312,7 +312,7 @@ fn frag_main() {
)";
auto* expect = R"(
@stage(fragment)
@fragment
fn frag_main() {
var tint_symbol : i32;
}

View File

@ -236,7 +236,7 @@ fn foo() -> i32 {
return 1;
}
@stage(fragment)
@fragment
fn main() {
var arr = array<f32, 4>();
for (let a = &arr[foo()]; ;) {
@ -251,7 +251,7 @@ fn foo() -> i32 {
return 1;
}
@stage(fragment)
@fragment
fn main() {
var arr = array<f32, 4>();
let a_save = foo();
@ -337,7 +337,7 @@ TEST_F(SimplifyPointersTest, ShadowPointer) {
auto* src = R"(
var<private> a : array<i32, 2>;
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
let x = &a;
var a : i32 = (*x)[0];
@ -350,7 +350,7 @@ fn main() {
auto* expect = R"(
var<private> a : array<i32, 2>;
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
var a_1 : i32 = a[0];
{

View File

@ -47,7 +47,7 @@ TEST_F(SingleEntryPointTest, Error_NoEntryPoints) {
TEST_F(SingleEntryPointTest, Error_InvalidEntryPoint) {
auto* src = R"(
@stage(vertex)
@vertex
fn main() -> @builtin(position) vec4<f32> {
return vec4<f32>();
}
@ -68,7 +68,7 @@ TEST_F(SingleEntryPointTest, Error_NotAnEntryPoint) {
auto* src = R"(
fn foo() {}
@stage(fragment)
@fragment
fn main() {}
)";
@ -85,7 +85,7 @@ fn main() {}
TEST_F(SingleEntryPointTest, SingleEntryPoint) {
auto* src = R"(
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
}
)";
@ -101,26 +101,26 @@ fn main() {
TEST_F(SingleEntryPointTest, MultipleEntryPoints) {
auto* src = R"(
@stage(vertex)
@vertex
fn vert_main() -> @builtin(position) vec4<f32> {
return vec4<f32>();
}
@stage(fragment)
@fragment
fn frag_main() {
}
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn comp_main1() {
}
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn comp_main2() {
}
)";
auto* expect = R"(
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn comp_main1() {
}
)";
@ -144,23 +144,23 @@ var<private> c : f32;
var<private> d : f32;
@stage(vertex)
@vertex
fn vert_main() -> @builtin(position) vec4<f32> {
a = 0.0;
return vec4<f32>();
}
@stage(fragment)
@fragment
fn frag_main() {
b = 0.0;
}
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn comp_main1() {
c = 0.0;
}
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn comp_main2() {
d = 0.0;
}
@ -169,7 +169,7 @@ fn comp_main2() {
auto* expect = R"(
var<private> c : f32;
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn comp_main1() {
c = 0.0;
}
@ -194,23 +194,23 @@ let c : f32 = 1.0;
let d : f32 = 1.0;
@stage(vertex)
@vertex
fn vert_main() -> @builtin(position) vec4<f32> {
let local_a : f32 = a;
return vec4<f32>();
}
@stage(fragment)
@fragment
fn frag_main() {
let local_b : f32 = b;
}
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn comp_main1() {
let local_c : f32 = c;
}
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn comp_main2() {
let local_d : f32 = d;
}
@ -219,7 +219,7 @@ fn comp_main2() {
auto* expect = R"(
let c : f32 = 1.0;
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn comp_main1() {
let local_c : f32 = c;
}
@ -238,7 +238,7 @@ TEST_F(SingleEntryPointTest, WorkgroupSizeLetPreserved) {
auto* src = R"(
let size : i32 = 1;
@stage(compute) @workgroup_size(size)
@compute @workgroup_size(size)
fn main() {
}
)";
@ -261,27 +261,27 @@ TEST_F(SingleEntryPointTest, OverridableConstants) {
@id(0) override c3 : u32 = 1u;
@id(9999) override c4 : u32 = 1u;
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn comp_main1() {
let local_d = c1;
}
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn comp_main2() {
let local_d = c2;
}
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn comp_main3() {
let local_d = c3;
}
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn comp_main4() {
let local_d = c4;
}
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn comp_main5() {
let local_d = 1u;
}
@ -292,7 +292,7 @@ fn comp_main5() {
auto* expect = R"(
@id(1001) override c1 : u32 = 1u;
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn comp_main1() {
let local_d = c1;
}
@ -310,7 +310,7 @@ fn comp_main1() {
auto* expect = R"(
@id(1) override c2 : u32 = 1u;
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn comp_main2() {
let local_d = c2;
}
@ -326,7 +326,7 @@ fn comp_main2() {
auto* expect = R"(
@id(0) override c3 : u32 = 1u;
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn comp_main3() {
let local_d = c3;
}
@ -342,7 +342,7 @@ fn comp_main3() {
auto* expect = R"(
@id(9999) override c4 : u32 = 1u;
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn comp_main4() {
let local_d = c4;
}
@ -356,7 +356,7 @@ fn comp_main4() {
{
SingleEntryPoint::Config cfg("comp_main5");
auto* expect = R"(
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn comp_main5() {
let local_d = 1u;
}
@ -389,12 +389,12 @@ fn outer2() {
inner_shared();
}
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn comp_main1() {
outer1();
}
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn comp_main2() {
outer2();
}
@ -412,7 +412,7 @@ fn outer1() {
inner_shared();
}
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn comp_main1() {
outer1();
}
@ -463,12 +463,12 @@ fn outer2() {
outer2_var = 0.0;
}
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn comp_main1() {
outer1();
}
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn comp_main2() {
outer2();
}
@ -495,7 +495,7 @@ fn outer1() {
outer1_var = 0.0;
}
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn comp_main1() {
outer1();
}

View File

@ -102,7 +102,7 @@ fn f() {
let marker1 = 0;
}
@stage(fragment)
@fragment
fn main(@builtin(position) coord_in: vec4<f32>) -> @location(0) vec4<f32> {
f();
let marker1 = 0;
@ -122,7 +122,7 @@ fn tint_discard_func() {
discard;
}
@stage(fragment)
@fragment
fn main(@builtin(position) coord_in : vec4<f32>) -> @location(0) vec4<f32> {
f();
if (tint_discard) {
@ -156,7 +156,7 @@ fn f() -> S {
return s;
}
@stage(fragment)
@fragment
fn main(@builtin(position) coord_in: vec4<f32>) -> @location(0) vec4<f32> {
let marker1 = 0;
f();
@ -186,7 +186,7 @@ fn tint_discard_func() {
discard;
}
@stage(fragment)
@fragment
fn main(@builtin(position) coord_in : vec4<f32>) -> @location(0) vec4<f32> {
let marker1 = 0;
f();
@ -230,7 +230,7 @@ fn h() -> i32{
return 0;
}
@stage(fragment)
@fragment
fn main(@builtin(position) coord_in: vec4<f32>) -> @location(0) vec4<f32> {
let marker1 = 0;
h();
@ -275,7 +275,7 @@ fn tint_discard_func() {
discard;
}
@stage(fragment)
@fragment
fn main(@builtin(position) coord_in : vec4<f32>) -> @location(0) vec4<f32> {
let marker1 = 0;
h();
@ -311,7 +311,7 @@ fn h() {
let marker1 = 0;
}
@stage(fragment)
@fragment
fn main(@builtin(position) coord_in: vec4<f32>) -> @location(0) vec4<f32> {
let marker1 = 0;
f();
@ -348,7 +348,7 @@ fn tint_discard_func() {
discard;
}
@stage(fragment)
@fragment
fn main(@builtin(position) coord_in : vec4<f32>) -> @location(0) vec4<f32> {
let marker1 = 0;
f();
@ -381,7 +381,7 @@ fn main(@builtin(position) coord_in : vec4<f32>) -> @location(0) vec4<f32> {
TEST_F(UnwindDiscardFunctionsTest, Call_DiscardFuncDeclaredBelow) {
auto* src = R"(
@stage(fragment)
@fragment
fn main(@builtin(position) coord_in: vec4<f32>) -> @location(0) vec4<f32> {
f();
let marker1 = 0;
@ -400,7 +400,7 @@ fn tint_discard_func() {
var<private> tint_discard : bool = false;
@stage(fragment)
@fragment
fn main(@builtin(position) coord_in : vec4<f32>) -> @location(0) vec4<f32> {
f();
if (tint_discard) {
@ -433,7 +433,7 @@ fn f() -> i32 {
return 42;
}
@stage(fragment)
@fragment
fn main(@builtin(position) coord_in: vec4<f32>) -> @location(0) vec4<f32> {
if (f() == 42) {
let marker1 = 0;
@ -456,7 +456,7 @@ fn tint_discard_func() {
discard;
}
@stage(fragment)
@fragment
fn main(@builtin(position) coord_in : vec4<f32>) -> @location(0) vec4<f32> {
let tint_symbol = f();
if (tint_discard) {
@ -485,7 +485,7 @@ fn f() -> i32 {
return 42;
}
@stage(fragment)
@fragment
fn main(@builtin(position) coord_in: vec4<f32>) -> @location(0) vec4<f32> {
if (true) {
let marker1 = 0;
@ -512,7 +512,7 @@ fn tint_discard_func() {
discard;
}
@stage(fragment)
@fragment
fn main(@builtin(position) coord_in : vec4<f32>) -> @location(0) vec4<f32> {
if (true) {
let marker1 = 0;
@ -547,7 +547,7 @@ fn f() -> i32 {
return 42;
}
@stage(fragment)
@fragment
fn main(@builtin(position) coord_in: vec4<f32>) -> @location(0) vec4<f32> {
let marker1 = 0;
var a = 0;
@ -573,7 +573,7 @@ fn tint_discard_func() {
discard;
}
@stage(fragment)
@fragment
fn main(@builtin(position) coord_in : vec4<f32>) -> @location(0) vec4<f32> {
let marker1 = 0;
var a = 0;
@ -605,7 +605,7 @@ fn f() -> i32 {
return 42;
}
@stage(fragment)
@fragment
fn main(@builtin(position) coord_in: vec4<f32>) -> @location(0) vec4<f32> {
let marker1 = 0;
for (f(); ; ) {
@ -630,7 +630,7 @@ fn tint_discard_func() {
discard;
}
@stage(fragment)
@fragment
fn main(@builtin(position) coord_in : vec4<f32>) -> @location(0) vec4<f32> {
let marker1 = 0;
var tint_symbol = f();
@ -661,7 +661,7 @@ fn f() -> i32 {
return 42;
}
@stage(fragment)
@fragment
fn main(@builtin(position) coord_in: vec4<f32>) -> @location(0) vec4<f32> {
let marker1 = 0;
for (let i = f(); ; ) {
@ -686,7 +686,7 @@ fn tint_discard_func() {
discard;
}
@stage(fragment)
@fragment
fn main(@builtin(position) coord_in : vec4<f32>) -> @location(0) vec4<f32> {
let marker1 = 0;
var tint_symbol = f();
@ -717,7 +717,7 @@ fn f() -> i32 {
return 42;
}
@stage(fragment)
@fragment
fn main(@builtin(position) coord_in: vec4<f32>) -> @location(0) vec4<f32> {
let marker1 = 0;
for (; f() == 42; ) {
@ -742,7 +742,7 @@ fn tint_discard_func() {
discard;
}
@stage(fragment)
@fragment
fn main(@builtin(position) coord_in : vec4<f32>) -> @location(0) vec4<f32> {
let marker1 = 0;
loop {
@ -778,7 +778,7 @@ fn f() -> i32 {
return 42;
}
@stage(fragment)
@fragment
fn main(@builtin(position) coord_in: vec4<f32>) -> @location(0) vec4<f32> {
let marker1 = 0;
for (; ; f()) {
@ -809,7 +809,7 @@ fn f() -> i32 {
return 42;
}
@stage(fragment)
@fragment
fn main(@builtin(position) coord_in: vec4<f32>) -> @location(0) vec4<f32> {
switch (f()) {
case 0: {
@ -843,7 +843,7 @@ fn tint_discard_func() {
discard;
}
@stage(fragment)
@fragment
fn main(@builtin(position) coord_in : vec4<f32>) -> @location(0) vec4<f32> {
var tint_symbol = f();
if (tint_discard) {
@ -893,7 +893,7 @@ fn g() -> S {
return f();
}
@stage(fragment)
@fragment
fn main(@builtin(position) coord_in: vec4<f32>) -> @location(0) vec4<f32> {
let marker1 = 0;
g();
@ -929,7 +929,7 @@ fn tint_discard_func() {
discard;
}
@stage(fragment)
@fragment
fn main(@builtin(position) coord_in : vec4<f32>) -> @location(0) vec4<f32> {
let marker1 = 0;
g();
@ -956,7 +956,7 @@ fn f() -> i32 {
return 42;
}
@stage(fragment)
@fragment
fn main(@builtin(position) coord_in: vec4<f32>) -> @location(0) vec4<f32> {
var a = f();
let marker1 = 0;
@ -978,7 +978,7 @@ fn tint_discard_func() {
discard;
}
@stage(fragment)
@fragment
fn main(@builtin(position) coord_in : vec4<f32>) -> @location(0) vec4<f32> {
var a = f();
if (tint_discard) {
@ -1005,7 +1005,7 @@ fn f() -> i32 {
return 42;
}
@stage(fragment)
@fragment
fn main(@builtin(position) coord_in: vec4<f32>) -> @location(0) vec4<f32> {
var a : i32;
a = f();
@ -1028,7 +1028,7 @@ fn tint_discard_func() {
discard;
}
@stage(fragment)
@fragment
fn main(@builtin(position) coord_in : vec4<f32>) -> @location(0) vec4<f32> {
var a : i32;
a = f();
@ -1056,7 +1056,7 @@ fn f() -> i32 {
return 0;
}
@stage(fragment)
@fragment
fn main(@builtin(position) coord_in: vec4<f32>) -> @location(0) vec4<f32> {
var b = array<i32, 10>();
b[f()] = 10;
@ -1079,7 +1079,7 @@ fn tint_discard_func() {
discard;
}
@stage(fragment)
@fragment
fn main(@builtin(position) coord_in : vec4<f32>) -> @location(0) vec4<f32> {
var b = array<i32, 10>();
let tint_symbol = f();
@ -1115,7 +1115,7 @@ fn g() -> i32 {
return 0;
}
@stage(fragment)
@fragment
fn main(@builtin(position) coord_in: vec4<f32>) -> @location(0) vec4<f32> {
var b = array<i32, 10>();
b[f()] = g();
@ -1146,7 +1146,7 @@ fn tint_discard_func() {
discard;
}
@stage(fragment)
@fragment
fn main(@builtin(position) coord_in : vec4<f32>) -> @location(0) vec4<f32> {
var b = array<i32, 10>();
let tint_symbol = g();
@ -1194,7 +1194,7 @@ fn h() -> i32{
return 0;
}
@stage(fragment)
@fragment
fn main(@builtin(position) coord_in: vec4<f32>) -> @location(0) vec4<f32> {
if ((f() + g() + h()) == 0) {
let marker1 = 0;
@ -1233,7 +1233,7 @@ fn tint_discard_func() {
discard;
}
@stage(fragment)
@fragment
fn main(@builtin(position) coord_in : vec4<f32>) -> @location(0) vec4<f32> {
let tint_symbol = f();
if (tint_discard) {
@ -1286,7 +1286,7 @@ fn h() -> i32{
return 0;
}
@stage(fragment)
@fragment
fn main(@builtin(position) coord_in: vec4<f32>) -> @location(0) vec4<f32> {
if (f() == 1 && g() == 2 && h() == 3) {
let marker1 = 0;
@ -1325,7 +1325,7 @@ fn tint_discard_func() {
discard;
}
@stage(fragment)
@fragment
fn main(@builtin(position) coord_in : vec4<f32>) -> @location(0) vec4<f32> {
let tint_symbol_2 = f();
if (tint_discard) {
@ -1373,7 +1373,7 @@ fn f() {
let marker1 = 0;
}
@stage(fragment)
@fragment
fn main(@builtin(position) coord_in: vec4<f32>) -> @location(0) vec4<f32> {
f();
let marker1 = 0;
@ -1397,7 +1397,7 @@ fn tint_discard_func_1() {
discard;
}
@stage(fragment)
@fragment
fn main(@builtin(position) coord_in : vec4<f32>) -> @location(0) vec4<f32> {
f();
if (tint_discard_1) {

View File

@ -53,7 +53,7 @@ TEST_P(VectorizeScalarMatrixConstructorsTest, SingleScalars) {
}
std::string src = R"(
@stage(fragment)
@fragment
fn main() {
let m = ${matrix}(42.0);
}
@ -64,7 +64,7 @@ fn build_${matrix_no_type}(value : f32) -> ${matrix} {
return ${matrix}(${values});
}
@stage(fragment)
@fragment
fn main() {
let m = build_${matrix_no_type}(42.0);
}
@ -107,7 +107,7 @@ TEST_P(VectorizeScalarMatrixConstructorsTest, MultipleScalars) {
}
std::string tmpl = R"(
@stage(fragment)
@fragment
fn main() {
let m = ${matrix}(${values});
}
@ -137,7 +137,7 @@ TEST_P(VectorizeScalarMatrixConstructorsTest, NonScalarConstructors) {
}
std::string tmpl = R"(
@stage(fragment)
@fragment
fn main() {
let m = ${matrix}(${columns});
}

View File

@ -37,7 +37,7 @@ TEST_F(VertexPullingTest, Error_NoEntryPoint) {
TEST_F(VertexPullingTest, Error_InvalidEntryPoint) {
auto* src = R"(
@stage(vertex)
@vertex
fn main() -> @builtin(position) vec4<f32> {
return vec4<f32>();
}
@ -57,7 +57,7 @@ fn main() -> @builtin(position) vec4<f32> {
TEST_F(VertexPullingTest, Error_EntryPointWrongStage) {
auto* src = R"(
@stage(fragment)
@fragment
fn main() {}
)";
@ -75,7 +75,7 @@ fn main() {}
TEST_F(VertexPullingTest, Error_BadStride) {
auto* src = R"(
@stage(vertex)
@vertex
fn main(@location(0) var_a : f32) -> @builtin(position) vec4<f32> {
return vec4<f32>(var_a, 0.0, 0.0, 1.0);
}
@ -98,7 +98,7 @@ fn main(@location(0) var_a : f32) -> @builtin(position) vec4<f32> {
TEST_F(VertexPullingTest, BasicModule) {
auto* src = R"(
@stage(vertex)
@vertex
fn main() -> @builtin(position) vec4<f32> {
return vec4<f32>();
}
@ -109,7 +109,7 @@ struct TintVertexData {
tint_vertex_data : array<u32>,
}
@stage(vertex)
@vertex
fn main() -> @builtin(position) vec4<f32> {
return vec4<f32>();
}
@ -127,7 +127,7 @@ fn main() -> @builtin(position) vec4<f32> {
TEST_F(VertexPullingTest, OneAttribute) {
auto* src = R"(
@stage(vertex)
@vertex
fn main(@location(0) var_a : f32) -> @builtin(position) vec4<f32> {
return vec4<f32>(var_a, 0.0, 0.0, 1.0);
}
@ -140,7 +140,7 @@ struct TintVertexData {
@binding(0) @group(4) var<storage, read> tint_pulling_vertex_buffer_0 : TintVertexData;
@stage(vertex)
@vertex
fn main(@builtin(vertex_index) tint_pulling_vertex_index : u32) -> @builtin(position) vec4<f32> {
var var_a : f32;
{
@ -164,7 +164,7 @@ fn main(@builtin(vertex_index) tint_pulling_vertex_index : u32) -> @builtin(posi
TEST_F(VertexPullingTest, OneInstancedAttribute) {
auto* src = R"(
@stage(vertex)
@vertex
fn main(@location(0) var_a : f32) -> @builtin(position) vec4<f32> {
return vec4<f32>(var_a, 0.0, 0.0, 1.0);
}
@ -177,7 +177,7 @@ struct TintVertexData {
@binding(0) @group(4) var<storage, read> tint_pulling_vertex_buffer_0 : TintVertexData;
@stage(vertex)
@vertex
fn main(@builtin(instance_index) tint_pulling_instance_index : u32) -> @builtin(position) vec4<f32> {
var var_a : f32;
{
@ -201,7 +201,7 @@ fn main(@builtin(instance_index) tint_pulling_instance_index : u32) -> @builtin(
TEST_F(VertexPullingTest, OneAttributeDifferentOutputSet) {
auto* src = R"(
@stage(vertex)
@vertex
fn main(@location(0) var_a : f32) -> @builtin(position) vec4<f32> {
return vec4<f32>(var_a, 0.0, 0.0, 1.0);
}
@ -214,7 +214,7 @@ struct TintVertexData {
@binding(0) @group(5) var<storage, read> tint_pulling_vertex_buffer_0 : TintVertexData;
@stage(vertex)
@vertex
fn main(@builtin(vertex_index) tint_pulling_vertex_index : u32) -> @builtin(position) vec4<f32> {
var var_a : f32;
{
@ -243,7 +243,7 @@ struct Inputs {
@location(0) var_a : f32,
};
@stage(vertex)
@vertex
fn main(inputs : Inputs) -> @builtin(position) vec4<f32> {
return vec4<f32>(inputs.var_a, 0.0, 0.0, 1.0);
}
@ -261,7 +261,7 @@ struct Inputs {
var_a : f32,
}
@stage(vertex)
@vertex
fn main(@builtin(vertex_index) tint_pulling_vertex_index : u32) -> @builtin(position) vec4<f32> {
var inputs : Inputs;
{
@ -286,7 +286,7 @@ fn main(@builtin(vertex_index) tint_pulling_vertex_index : u32) -> @builtin(posi
// We expect the transform to use an existing builtin variables if it finds them
TEST_F(VertexPullingTest, ExistingVertexIndexAndInstanceIndex) {
auto* src = R"(
@stage(vertex)
@vertex
fn main(@location(0) var_a : f32,
@location(1) var_b : f32,
@builtin(vertex_index) custom_vertex_index : u32,
@ -305,7 +305,7 @@ struct TintVertexData {
@binding(1) @group(4) var<storage, read> tint_pulling_vertex_buffer_1 : TintVertexData;
@stage(vertex)
@vertex
fn main(@builtin(vertex_index) custom_vertex_index : u32, @builtin(instance_index) custom_instance_index : u32) -> @builtin(position) vec4<f32> {
var var_a : f32;
var var_b : f32;
@ -350,7 +350,7 @@ struct Inputs {
@builtin(instance_index) custom_instance_index : u32,
};
@stage(vertex)
@vertex
fn main(inputs : Inputs) -> @builtin(position) vec4<f32> {
return vec4<f32>(inputs.var_a, inputs.var_b, 0.0, 1.0);
}
@ -383,7 +383,7 @@ struct Inputs {
custom_instance_index : u32,
}
@stage(vertex)
@vertex
fn main(tint_symbol_1 : tint_symbol) -> @builtin(position) vec4<f32> {
var inputs : Inputs;
inputs.custom_vertex_index = tint_symbol_1.custom_vertex_index;
@ -422,7 +422,7 @@ fn main(tint_symbol_1 : tint_symbol) -> @builtin(position) vec4<f32> {
TEST_F(VertexPullingTest, ExistingVertexIndexAndInstanceIndex_Struct_OutOfOrder) {
auto* src = R"(
@stage(vertex)
@vertex
fn main(inputs : Inputs) -> @builtin(position) vec4<f32> {
return vec4<f32>(inputs.var_a, inputs.var_b, 0.0, 1.0);
}
@ -451,7 +451,7 @@ struct tint_symbol {
custom_instance_index : u32,
}
@stage(vertex)
@vertex
fn main(tint_symbol_1 : tint_symbol) -> @builtin(position) vec4<f32> {
var inputs : Inputs;
inputs.custom_vertex_index = tint_symbol_1.custom_vertex_index;
@ -511,7 +511,7 @@ struct Indices {
@builtin(instance_index) custom_instance_index : u32,
};
@stage(vertex)
@vertex
fn main(inputs : Inputs, indices : Indices) -> @builtin(position) vec4<f32> {
return vec4<f32>(inputs.var_a, inputs.var_b, 0.0, 1.0);
}
@ -540,7 +540,7 @@ struct Indices {
custom_instance_index : u32,
}
@stage(vertex)
@vertex
fn main(indices : Indices) -> @builtin(position) vec4<f32> {
var inputs : Inputs;
{
@ -577,7 +577,7 @@ fn main(indices : Indices) -> @builtin(position) vec4<f32> {
TEST_F(VertexPullingTest, ExistingVertexIndexAndInstanceIndex_SeparateStruct_OutOfOrder) {
auto* src = R"(
@stage(vertex)
@vertex
fn main(inputs : Inputs, indices : Indices) -> @builtin(position) vec4<f32> {
return vec4<f32>(inputs.var_a, inputs.var_b, 0.0, 1.0);
}
@ -602,7 +602,7 @@ struct TintVertexData {
@binding(1) @group(4) var<storage, read> tint_pulling_vertex_buffer_1 : TintVertexData;
@stage(vertex)
@vertex
fn main(indices : Indices) -> @builtin(position) vec4<f32> {
var inputs : Inputs;
{
@ -653,7 +653,7 @@ struct Indices {
TEST_F(VertexPullingTest, TwoAttributesSameBuffer) {
auto* src = R"(
@stage(vertex)
@vertex
fn main(@location(0) var_a : f32,
@location(1) var_b : vec4<f32>) -> @builtin(position) vec4<f32> {
return vec4<f32>();
@ -667,7 +667,7 @@ struct TintVertexData {
@binding(0) @group(4) var<storage, read> tint_pulling_vertex_buffer_0 : TintVertexData;
@stage(vertex)
@vertex
fn main(@builtin(vertex_index) tint_pulling_vertex_index : u32) -> @builtin(position) vec4<f32> {
var var_a : f32;
var var_b : vec4<f32>;
@ -695,7 +695,7 @@ fn main(@builtin(vertex_index) tint_pulling_vertex_index : u32) -> @builtin(posi
TEST_F(VertexPullingTest, FloatVectorAttributes) {
auto* src = R"(
@stage(vertex)
@vertex
fn main(@location(0) var_a : vec2<f32>,
@location(1) var_b : vec3<f32>,
@location(2) var_c : vec4<f32>
@ -715,7 +715,7 @@ struct TintVertexData {
@binding(2) @group(4) var<storage, read> tint_pulling_vertex_buffer_2 : TintVertexData;
@stage(vertex)
@vertex
fn main(@builtin(vertex_index) tint_pulling_vertex_index : u32) -> @builtin(position) vec4<f32> {
var var_a : vec2<f32>;
var var_b : vec3<f32>;
@ -749,7 +749,7 @@ fn main(@builtin(vertex_index) tint_pulling_vertex_index : u32) -> @builtin(posi
TEST_F(VertexPullingTest, AttemptSymbolCollision) {
auto* src = R"(
@stage(vertex)
@vertex
fn main(@location(0) var_a : f32,
@location(1) var_b : vec4<f32>) -> @builtin(position) vec4<f32> {
var tint_pulling_vertex_index : i32;
@ -767,7 +767,7 @@ struct TintVertexData {
@binding(0) @group(4) var<storage, read> tint_pulling_vertex_buffer_0_1 : TintVertexData;
@stage(vertex)
@vertex
fn main(@builtin(vertex_index) tint_pulling_vertex_index_1 : u32) -> @builtin(position) vec4<f32> {
var var_a : f32;
var var_b : vec4<f32>;
@ -799,7 +799,7 @@ fn main(@builtin(vertex_index) tint_pulling_vertex_index_1 : u32) -> @builtin(po
TEST_F(VertexPullingTest, FormatsAligned) {
auto* src = R"(
@stage(vertex)
@vertex
fn main(
@location(0) uint8x2 : vec2<u32>,
@location(1) uint8x4 : vec4<u32>,
@ -843,7 +843,7 @@ struct TintVertexData {
@binding(0) @group(4) var<storage, read> tint_pulling_vertex_buffer_0 : TintVertexData;
@stage(vertex)
@vertex
fn main(@builtin(vertex_index) tint_pulling_vertex_index : u32) -> @builtin(position) vec4<f32> {
var uint8x2 : vec2<u32>;
var uint8x4 : vec4<u32>;
@ -944,7 +944,7 @@ fn main(@builtin(vertex_index) tint_pulling_vertex_index : u32) -> @builtin(posi
TEST_F(VertexPullingTest, FormatsStrideUnaligned) {
auto* src = R"(
@stage(vertex)
@vertex
fn main(
@location(0) uint8x2 : vec2<u32>,
@location(1) uint8x4 : vec4<u32>,
@ -989,7 +989,7 @@ struct TintVertexData {
@binding(0) @group(4) var<storage, read> tint_pulling_vertex_buffer_0 : TintVertexData;
@stage(vertex)
@vertex
fn main(@builtin(vertex_index) tint_pulling_vertex_index : u32) -> @builtin(position) vec4<f32> {
var uint8x2 : vec2<u32>;
var uint8x4 : vec4<u32>;
@ -1090,7 +1090,7 @@ fn main(@builtin(vertex_index) tint_pulling_vertex_index : u32) -> @builtin(posi
TEST_F(VertexPullingTest, FormatsWithVectorsResized) {
auto* src = R"(
@stage(vertex)
@vertex
fn main(
@location(0) uint8x2 : vec3<u32>,
@location(1) uint8x4 : vec2<u32>,
@ -1134,7 +1134,7 @@ struct TintVertexData {
@binding(0) @group(4) var<storage, read> tint_pulling_vertex_buffer_0 : TintVertexData;
@stage(vertex)
@vertex
fn main(@builtin(vertex_index) tint_pulling_vertex_index : u32) -> @builtin(position) vec4<f32> {
var uint8x2 : vec3<u32>;
var uint8x4 : vec2<u32>;

View File

@ -81,7 +81,7 @@ fn unreferenced() {
b = c;
}
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn f() {
}
)";
@ -94,7 +94,7 @@ fn f() {
TEST_F(ZeroInitWorkgroupMemoryTest, UnreferencedWorkgroupVars_OutOfOrder) {
auto* src = R"(
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn f() {
}
@ -119,7 +119,7 @@ TEST_F(ZeroInitWorkgroupMemoryTest, SingleWorkgroupVar_ExistingLocalIndex) {
auto* src = R"(
var<workgroup> v : i32;
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn f(@builtin(local_invocation_index) local_idx : u32) {
_ = v; // Initialization should be inserted above this statement
}
@ -127,7 +127,7 @@ fn f(@builtin(local_invocation_index) local_idx : u32) {
auto* expect = R"(
var<workgroup> v : i32;
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn f(@builtin(local_invocation_index) local_idx : u32) {
{
v = i32();
@ -144,7 +144,7 @@ fn f(@builtin(local_invocation_index) local_idx : u32) {
TEST_F(ZeroInitWorkgroupMemoryTest, SingleWorkgroupVar_ExistingLocalIndex_OutOfOrder) {
auto* src = R"(
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn f(@builtin(local_invocation_index) local_idx : u32) {
_ = v; // Initialization should be inserted above this statement
}
@ -152,7 +152,7 @@ fn f(@builtin(local_invocation_index) local_idx : u32) {
var<workgroup> v : i32;
)";
auto* expect = R"(
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn f(@builtin(local_invocation_index) local_idx : u32) {
{
v = i32();
@ -177,7 +177,7 @@ struct Params {
@builtin(local_invocation_index) local_idx : u32,
};
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn f(params : Params) {
_ = v; // Initialization should be inserted above this statement
}
@ -190,7 +190,7 @@ struct Params {
local_idx : u32,
}
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn f(params : Params) {
{
v = i32();
@ -207,7 +207,7 @@ fn f(params : Params) {
TEST_F(ZeroInitWorkgroupMemoryTest, SingleWorkgroupVar_ExistingLocalIndexInStruct_OutOfOrder) {
auto* src = R"(
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn f(params : Params) {
_ = v; // Initialization should be inserted above this statement
}
@ -219,7 +219,7 @@ struct Params {
var<workgroup> v : i32;
)";
auto* expect = R"(
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn f(params : Params) {
{
v = i32();
@ -245,7 +245,7 @@ TEST_F(ZeroInitWorkgroupMemoryTest, SingleWorkgroupVar_InjectedLocalIndex) {
auto* src = R"(
var<workgroup> v : i32;
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn f() {
_ = v; // Initialization should be inserted above this statement
}
@ -253,7 +253,7 @@ fn f() {
auto* expect = R"(
var<workgroup> v : i32;
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn f(@builtin(local_invocation_index) local_invocation_index : u32) {
{
v = i32();
@ -270,7 +270,7 @@ fn f(@builtin(local_invocation_index) local_invocation_index : u32) {
TEST_F(ZeroInitWorkgroupMemoryTest, SingleWorkgroupVar_InjectedLocalIndex_OutOfOrder) {
auto* src = R"(
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn f() {
_ = v; // Initialization should be inserted above this statement
}
@ -278,7 +278,7 @@ fn f() {
var<workgroup> v : i32;
)";
auto* expect = R"(
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn f(@builtin(local_invocation_index) local_invocation_index : u32) {
{
v = i32();
@ -308,7 +308,7 @@ var<workgroup> b : S;
var<workgroup> c : array<S, 32>;
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn f(@builtin(local_invocation_index) local_idx : u32) {
_ = a; // Initialization should be inserted above this statement
_ = b;
@ -327,7 +327,7 @@ var<workgroup> b : S;
var<workgroup> c : array<S, 32>;
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn f(@builtin(local_invocation_index) local_idx : u32) {
{
a = i32();
@ -360,7 +360,7 @@ fn f(@builtin(local_invocation_index) local_idx : u32) {
TEST_F(ZeroInitWorkgroupMemoryTest, MultipleWorkgroupVar_ExistingLocalIndex_Size1_OutOfOrder) {
auto* src = R"(
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn f(@builtin(local_invocation_index) local_idx : u32) {
_ = a; // Initialization should be inserted above this statement
_ = b;
@ -379,7 +379,7 @@ struct S {
};
)";
auto* expect = R"(
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn f(@builtin(local_invocation_index) local_idx : u32) {
{
a = i32();
@ -434,7 +434,7 @@ var<workgroup> b : S;
var<workgroup> c : array<S, 32>;
@stage(compute) @workgroup_size(2, 3)
@compute @workgroup_size(2, 3)
fn f(@builtin(local_invocation_index) local_idx : u32) {
_ = a; // Initialization should be inserted above this statement
_ = b;
@ -453,7 +453,7 @@ var<workgroup> b : S;
var<workgroup> c : array<S, 32>;
@stage(compute) @workgroup_size(2, 3)
@compute @workgroup_size(2, 3)
fn f(@builtin(local_invocation_index) local_idx : u32) {
if ((local_idx < 1u)) {
a = i32();
@ -499,7 +499,7 @@ var<workgroup> c : array<S, 32>;
@id(1) override X : i32;
@stage(compute) @workgroup_size(2, 3, X)
@compute @workgroup_size(2, 3, X)
fn f(@builtin(local_invocation_index) local_idx : u32) {
_ = a; // Initialization should be inserted above this statement
_ = b;
@ -521,7 +521,7 @@ var<workgroup> c : array<S, 32>;
@id(1) override X : i32;
@stage(compute) @workgroup_size(2, 3, X)
@compute @workgroup_size(2, 3, X)
fn f(@builtin(local_invocation_index) local_idx : u32) {
for(var idx : u32 = local_idx; (idx < 1u); idx = (idx + (u32(X) * 6u))) {
a = i32();
@ -568,7 +568,7 @@ var<workgroup> c : array<S, 32>;
@id(1) override X : u32;
@stage(compute) @workgroup_size(5u, X, 10u)
@compute @workgroup_size(5u, X, 10u)
fn f(@builtin(local_invocation_index) local_idx : u32) {
_ = a; // Initialization should be inserted above this statement
_ = b;
@ -591,7 +591,7 @@ var<workgroup> c : array<S, 32>;
@id(1) override X : u32;
@stage(compute) @workgroup_size(5u, X, 10u)
@compute @workgroup_size(5u, X, 10u)
fn f(@builtin(local_invocation_index) local_idx : u32) {
for(var idx : u32 = local_idx; (idx < 1u); idx = (idx + (X * 50u))) {
a = i32();
@ -654,7 +654,7 @@ var<workgroup> b : S;
var<workgroup> c : array<S, 32>;
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn f(@builtin(local_invocation_id) local_invocation_id : vec3<u32>) {
_ = a; // Initialization should be inserted above this statement
_ = b;
@ -673,7 +673,7 @@ var<workgroup> b : S;
var<workgroup> c : array<S, 32>;
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn f(@builtin(local_invocation_id) local_invocation_id : vec3<u32>, @builtin(local_invocation_index) local_invocation_index : u32) {
{
a = i32();
@ -706,7 +706,7 @@ fn f(@builtin(local_invocation_id) local_invocation_id : vec3<u32>, @builtin(loc
TEST_F(ZeroInitWorkgroupMemoryTest, MultipleWorkgroupVar_InjectedLocalIndex_OutOfOrder) {
auto* src = R"(
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn f(@builtin(local_invocation_id) local_invocation_id : vec3<u32>) {
_ = a; // Initialization should be inserted above this statement
_ = b;
@ -725,7 +725,7 @@ struct S {
};
)";
auto* expect = R"(
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn f(@builtin(local_invocation_id) local_invocation_id : vec3<u32>, @builtin(local_invocation_index) local_invocation_index : u32) {
{
a = i32();
@ -780,18 +780,18 @@ var<workgroup> b : S;
var<workgroup> c : array<S, 32>;
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn f1() {
_ = a; // Initialization should be inserted above this statement
_ = c;
}
@stage(compute) @workgroup_size(1, 2, 3)
@compute @workgroup_size(1, 2, 3)
fn f2(@builtin(local_invocation_id) local_invocation_id : vec3<u32>) {
_ = b; // Initialization should be inserted above this statement
}
@stage(compute) @workgroup_size(4, 5, 6)
@compute @workgroup_size(4, 5, 6)
fn f3() {
_ = c; // Initialization should be inserted above this statement
_ = a;
@ -809,7 +809,7 @@ var<workgroup> b : S;
var<workgroup> c : array<S, 32>;
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn f1(@builtin(local_invocation_index) local_invocation_index : u32) {
{
a = i32();
@ -828,7 +828,7 @@ fn f1(@builtin(local_invocation_index) local_invocation_index : u32) {
_ = c;
}
@stage(compute) @workgroup_size(1, 2, 3)
@compute @workgroup_size(1, 2, 3)
fn f2(@builtin(local_invocation_id) local_invocation_id : vec3<u32>, @builtin(local_invocation_index) local_invocation_index_1 : u32) {
if ((local_invocation_index_1 < 1u)) {
b.x = i32();
@ -841,7 +841,7 @@ fn f2(@builtin(local_invocation_id) local_invocation_id : vec3<u32>, @builtin(lo
_ = b;
}
@stage(compute) @workgroup_size(4, 5, 6)
@compute @workgroup_size(4, 5, 6)
fn f3(@builtin(local_invocation_index) local_invocation_index_2 : u32) {
if ((local_invocation_index_2 < 1u)) {
a = i32();
@ -868,18 +868,18 @@ fn f3(@builtin(local_invocation_index) local_invocation_index_2 : u32) {
TEST_F(ZeroInitWorkgroupMemoryTest, MultipleWorkgroupVar_MultipleEntryPoints_OutOfOrder) {
auto* src = R"(
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn f1() {
_ = a; // Initialization should be inserted above this statement
_ = c;
}
@stage(compute) @workgroup_size(1, 2, 3)
@compute @workgroup_size(1, 2, 3)
fn f2(@builtin(local_invocation_id) local_invocation_id : vec3<u32>) {
_ = b; // Initialization should be inserted above this statement
}
@stage(compute) @workgroup_size(4, 5, 6)
@compute @workgroup_size(4, 5, 6)
fn f3() {
_ = c; // Initialization should be inserted above this statement
_ = a;
@ -897,7 +897,7 @@ struct S {
};
)";
auto* expect = R"(
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn f1(@builtin(local_invocation_index) local_invocation_index : u32) {
{
a = i32();
@ -916,7 +916,7 @@ fn f1(@builtin(local_invocation_index) local_invocation_index : u32) {
_ = c;
}
@stage(compute) @workgroup_size(1, 2, 3)
@compute @workgroup_size(1, 2, 3)
fn f2(@builtin(local_invocation_id) local_invocation_id : vec3<u32>, @builtin(local_invocation_index) local_invocation_index_1 : u32) {
if ((local_invocation_index_1 < 1u)) {
b.x = i32();
@ -929,7 +929,7 @@ fn f2(@builtin(local_invocation_id) local_invocation_id : vec3<u32>, @builtin(lo
_ = b;
}
@stage(compute) @workgroup_size(4, 5, 6)
@compute @workgroup_size(4, 5, 6)
fn f3(@builtin(local_invocation_index) local_invocation_index_2 : u32) {
if ((local_invocation_index_2 < 1u)) {
a = i32();
@ -977,7 +977,7 @@ fn call_use_v() {
use_v();
}
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn f(@builtin(local_invocation_index) local_idx : u32) {
call_use_v(); // Initialization should be inserted above this statement
}
@ -993,7 +993,7 @@ fn call_use_v() {
use_v();
}
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn f(@builtin(local_invocation_index) local_idx : u32) {
{
v = i32();
@ -1010,7 +1010,7 @@ fn f(@builtin(local_invocation_index) local_idx : u32) {
TEST_F(ZeroInitWorkgroupMemoryTest, TransitiveUsage_OutOfOrder) {
auto* src = R"(
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn f(@builtin(local_invocation_index) local_idx : u32) {
call_use_v(); // Initialization should be inserted above this statement
}
@ -1026,7 +1026,7 @@ fn use_v() {
var<workgroup> v : i32;
)";
auto* expect = R"(
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn f(@builtin(local_invocation_index) local_idx : u32) {
{
v = i32();
@ -1056,7 +1056,7 @@ TEST_F(ZeroInitWorkgroupMemoryTest, WorkgroupAtomics) {
var<workgroup> i : atomic<i32>;
var<workgroup> u : atomic<u32>;
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn f() {
atomicLoad(&(i)); // Initialization should be inserted above this statement
atomicLoad(&(u));
@ -1067,7 +1067,7 @@ var<workgroup> i : atomic<i32>;
var<workgroup> u : atomic<u32>;
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn f(@builtin(local_invocation_index) local_invocation_index : u32) {
{
atomicStore(&(i), i32());
@ -1086,7 +1086,7 @@ fn f(@builtin(local_invocation_index) local_invocation_index : u32) {
TEST_F(ZeroInitWorkgroupMemoryTest, WorkgroupAtomics_OutOfOrder) {
auto* src = R"(
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn f() {
atomicLoad(&(i)); // Initialization should be inserted above this statement
atomicLoad(&(u));
@ -1096,7 +1096,7 @@ var<workgroup> i : atomic<i32>;
var<workgroup> u : atomic<u32>;
)";
auto* expect = R"(
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn f(@builtin(local_invocation_index) local_invocation_index : u32) {
{
atomicStore(&(i), i32());
@ -1129,7 +1129,7 @@ struct S {
var<workgroup> w : S;
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn f() {
_ = w.a; // Initialization should be inserted above this statement
}
@ -1145,7 +1145,7 @@ struct S {
var<workgroup> w : S;
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn f(@builtin(local_invocation_index) local_invocation_index : u32) {
{
w.a = i32();
@ -1166,7 +1166,7 @@ fn f(@builtin(local_invocation_index) local_invocation_index : u32) {
TEST_F(ZeroInitWorkgroupMemoryTest, WorkgroupStructOfAtomics_OutOfOrder) {
auto* src = R"(
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn f() {
_ = w.a; // Initialization should be inserted above this statement
}
@ -1182,7 +1182,7 @@ struct S {
};
)";
auto* expect = R"(
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn f(@builtin(local_invocation_index) local_invocation_index : u32) {
{
w.a = i32();
@ -1215,7 +1215,7 @@ TEST_F(ZeroInitWorkgroupMemoryTest, WorkgroupArrayOfAtomics) {
auto* src = R"(
var<workgroup> w : array<atomic<u32>, 4>;
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn f() {
atomicLoad(&w[0]); // Initialization should be inserted above this statement
}
@ -1223,7 +1223,7 @@ fn f() {
auto* expect = R"(
var<workgroup> w : array<atomic<u32>, 4>;
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn f(@builtin(local_invocation_index) local_invocation_index : u32) {
for(var idx : u32 = local_invocation_index; (idx < 4u); idx = (idx + 1u)) {
let i : u32 = idx;
@ -1241,7 +1241,7 @@ fn f(@builtin(local_invocation_index) local_invocation_index : u32) {
TEST_F(ZeroInitWorkgroupMemoryTest, WorkgroupArrayOfAtomics_OutOfOrder) {
auto* src = R"(
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn f() {
atomicLoad(&w[0]); // Initialization should be inserted above this statement
}
@ -1249,7 +1249,7 @@ fn f() {
var<workgroup> w : array<atomic<u32>, 4>;
)";
auto* expect = R"(
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn f(@builtin(local_invocation_index) local_invocation_index : u32) {
for(var idx : u32 = local_invocation_index; (idx < 4u); idx = (idx + 1u)) {
let i : u32 = idx;
@ -1279,7 +1279,7 @@ struct S {
var<workgroup> w : array<S, 4>;
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn f() {
_ = w[0].a; // Initialization should be inserted above this statement
}
@ -1295,7 +1295,7 @@ struct S {
var<workgroup> w : array<S, 4>;
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn f(@builtin(local_invocation_index) local_invocation_index : u32) {
for(var idx : u32 = local_invocation_index; (idx < 4u); idx = (idx + 1u)) {
let i_1 : u32 = idx;
@ -1317,7 +1317,7 @@ fn f(@builtin(local_invocation_index) local_invocation_index : u32) {
TEST_F(ZeroInitWorkgroupMemoryTest, WorkgroupArrayOfStructOfAtomics_OutOfOrder) {
auto* src = R"(
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn f() {
_ = w[0].a; // Initialization should be inserted above this statement
}
@ -1333,7 +1333,7 @@ struct S {
};
)";
auto* expect = R"(
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn f(@builtin(local_invocation_index) local_invocation_index : u32) {
for(var idx : u32 = local_invocation_index; (idx < 4u); idx = (idx + 1u)) {
let i_1 : u32 = idx;

View File

@ -877,13 +877,13 @@ TEST_F(GlslGeneratorImplTest_Function, Emit_Multiple_EntryPoint_With_Same_Module
// };
// @binding(0) @group(0) var<storage> data : Data;
//
// @stage(compute) @workgroup_size(1)
// @compute @workgroup_size(1)
// fn a() {
// var v = data.d;
// return;
// }
//
// @stage(compute) @workgroup_size(1)
// @compute @workgroup_size(1)
// fn b() {
// var v = data.d;
// return;

View File

@ -816,13 +816,13 @@ TEST_F(HlslGeneratorImplTest_Function, Emit_Multiple_EntryPoint_With_Same_Module
// };
// @binding(0) @group(0) var<storage> data : Data;
//
// @stage(compute) @workgroup_size(1)
// @compute @workgroup_size(1)
// fn a() {
// var v = data.d;
// return;
// }
//
// @stage(compute) @workgroup_size(1)
// @compute @workgroup_size(1)
// fn b() {
// var v = data.d;
// return;

View File

@ -615,12 +615,12 @@ TEST_F(MslGeneratorImplTest, Emit_Function_Multiple_EntryPoint_With_Same_ModuleV
// };
// @binding(0) @group(0) var<storage> data : Data;
//
// @stage(compute) @workgroup_size(1)
// @compute @workgroup_size(1)
// fn a() {
// return;
// }
//
// @stage(compute) @workgroup_size(1)
// @compute @workgroup_size(1)
// fn b() {
// return;
// }

View File

@ -37,7 +37,7 @@ namespace {
using BuilderTest = TestHelper;
TEST_F(BuilderTest, EntryPoint_Parameters) {
// @stage(fragment)
// @fragment
// fn frag_main(@builtin(position) coord : vec4<f32>,
// @location(1) loc1 : f32) {
// var col : f32 = (coord.x * loc1);
@ -105,7 +105,7 @@ OpFunctionEnd
}
TEST_F(BuilderTest, EntryPoint_ReturnValue) {
// @stage(fragment)
// @fragment
// fn frag_main(@location(0) @interpolate(flat) loc_in : u32)
// -> @location(0) f32 {
// if (loc_in > 10) {
@ -187,12 +187,12 @@ TEST_F(BuilderTest, EntryPoint_SharedStruct) {
// @builtin(position) pos : vec4<f32>;
// };
//
// @stage(vertex)
// @vertex
// fn vert_main() -> Interface {
// return Interface(42.0, vec4<f32>());
// }
//
// @stage(fragment)
// @fragment
// fn frag_main(inputs : Interface) -> @builtin(frag_depth) f32 {
// return inputs.value;
// }

View File

@ -186,12 +186,12 @@ TEST_F(BuilderTest, Emit_Multiple_EntryPoint_With_Same_ModuleVar) {
// };
// @binding(0) @group(0) var<storage> data : Data;
//
// @stage(compute) @workgroup_size(1)
// @compute @workgroup_size(1)
// fn a() {
// return;
// }
//
// @stage(compute) @workgroup_size(1)
// @compute @workgroup_size(1)
// fn b() {
// return;
// }

View File

@ -710,7 +710,7 @@ bool GeneratorImpl::EmitAttributes(std::ostream& out, const ast::AttributeList&
return true;
},
[&](const ast::StageAttribute* stage) {
out << "stage(" << stage->stage << ")";
out << stage->stage;
return true;
},
[&](const ast::BindingAttribute* binding) {

View File

@ -73,7 +73,7 @@ TEST_F(WgslGeneratorImplTest, Emit_Function_WithAttribute_WorkgroupSize) {
gen.increment_indent();
ASSERT_TRUE(gen.EmitFunction(func));
EXPECT_EQ(gen.result(), R"( @stage(compute) @workgroup_size(2i, 4i, 6i)
EXPECT_EQ(gen.result(), R"( @compute @workgroup_size(2i, 4i, 6i)
fn my_func() {
return;
}
@ -93,7 +93,7 @@ TEST_F(WgslGeneratorImplTest, Emit_Function_WithAttribute_WorkgroupSize_WithIden
gen.increment_indent();
ASSERT_TRUE(gen.EmitFunction(func));
EXPECT_EQ(gen.result(), R"( @stage(compute) @workgroup_size(2i, height)
EXPECT_EQ(gen.result(), R"( @compute @workgroup_size(2i, height)
fn my_func() {
return;
}
@ -114,7 +114,7 @@ TEST_F(WgslGeneratorImplTest, Emit_Function_EntryPoint_Parameters) {
gen.increment_indent();
ASSERT_TRUE(gen.EmitFunction(func));
EXPECT_EQ(gen.result(), R"( @stage(fragment)
EXPECT_EQ(gen.result(), R"( @fragment
fn frag_main(@builtin(position) coord : vec4<f32>, @location(1) loc1 : f32) {
}
)");
@ -137,7 +137,7 @@ TEST_F(WgslGeneratorImplTest, Emit_Function_EntryPoint_ReturnValue) {
gen.increment_indent();
ASSERT_TRUE(gen.EmitFunction(func));
EXPECT_EQ(gen.result(), R"( @stage(fragment)
EXPECT_EQ(gen.result(), R"( @fragment
fn frag_main() -> @location(1) f32 {
return 1.0f;
}
@ -151,12 +151,12 @@ TEST_F(WgslGeneratorImplTest, Emit_Function_Multiple_EntryPoint_With_Same_Module
// };
// @binding(0) @group(0) var<storage> data : Data;
//
// @stage(compute) @workgroup_size(1)
// @compute @workgroup_size(1)
// fn a() {
// return;
// }
//
// @stage(compute) @workgroup_size(1)
// @compute @workgroup_size(1)
// fn b() {
// return;
// }
@ -206,13 +206,13 @@ TEST_F(WgslGeneratorImplTest, Emit_Function_Multiple_EntryPoint_With_Same_Module
@binding(0) @group(0) var<storage, read_write> data : Data;
@stage(compute) @workgroup_size(1i)
@compute @workgroup_size(1i)
fn a() {
var v : f32 = data.d;
return;
}
@stage(compute) @workgroup_size(1i)
@compute @workgroup_size(1i)
fn b() {
var v : f32 = data.d;
return;

View File

@ -35,7 +35,7 @@ TEST_F(WgslGeneratorImplTest, Emit_GlobalDeclAfterFunction) {
gen.increment_indent();
ASSERT_TRUE(gen.Generate()) << gen.error();
EXPECT_EQ(gen.result(), R"( @stage(compute) @workgroup_size(1i, 1i, 1i)
EXPECT_EQ(gen.result(), R"( @compute @workgroup_size(1i, 1i, 1i)
fn test_function() {
var a : f32;
}
@ -91,7 +91,7 @@ TEST_F(WgslGeneratorImplTest, Emit_GlobalsInterleaved) {
a : i32,
}
@stage(compute) @workgroup_size(1i)
@compute @workgroup_size(1i)
fn main() {
var s0 : S0;
var s1 : S1;

View File

@ -3,7 +3,7 @@ fn main_1() {
return;
}
@stage(compute) @workgroup_size(1i, 1i, 1i)
@compute @workgroup_size(1i, 1i, 1i)
fn main() {
main_1();
}

View File

@ -1,4 +1,4 @@
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
let m : mat3x3<f32> = mat3x3<f32>(vec3<f32>(1., 2., 3.), vec3<f32>(4., 5., 6.), vec3<f32>(7., 8., 9.));
let v : vec3<f32> = m[1];

View File

@ -1,4 +1,4 @@
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
let m : mat3x3<f32> = mat3x3<f32>(vec3<f32>(1.0, 2.0, 3.0), vec3<f32>(4.0, 5.0, 6.0), vec3<f32>(7.0, 8.0, 9.0));
let v : vec3<f32> = m[1];

View File

@ -5,7 +5,7 @@ fn main_1() {
return;
}
@stage(compute) @workgroup_size(1i, 1i, 1i)
@compute @workgroup_size(1i, 1i, 1i)
fn main() {
main_1();
}

View File

@ -1,4 +1,4 @@
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
let v : vec3<f32> = vec3<f32>(1., 2., 3.);
let scalar : f32 = v.y;

View File

@ -1,4 +1,4 @@
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
let v : vec3<f32> = vec3<f32>(1.0, 2.0, 3.0);
let scalar : f32 = v.y;

View File

@ -5,7 +5,7 @@ fn main_1() {
return;
}
@stage(compute) @workgroup_size(1i, 1i, 1i)
@compute @workgroup_size(1i, 1i, 1i)
fn main() {
main_1();
}

View File

@ -1,4 +1,4 @@
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
var m : mat3x3<f32>;
let v : vec3<f32> = m[1];

View File

@ -1,4 +1,4 @@
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
var m : mat3x3<f32>;
let v : vec3<f32> = m[1];

View File

@ -8,7 +8,7 @@ fn main_1() {
return;
}
@stage(compute) @workgroup_size(1i, 1i, 1i)
@compute @workgroup_size(1i, 1i, 1i)
fn main() {
main_1();
}

View File

@ -1,4 +1,4 @@
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
var v : vec3<f32>;
let scalar : f32 = v.y;

View File

@ -1,4 +1,4 @@
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
var v : vec3<f32>;
let scalar : f32 = v.y;

View File

@ -10,7 +10,7 @@ fn f3(a : array<array<array<f32, 4>, 3>, 2>) -> f32 {
return a[1][2][3];
}
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
let a1 : array<f32, 4> = array<f32, 4>();
let a2 : array<array<f32, 4>, 3> = array<array<f32, 4>, 3>();

View File

@ -10,7 +10,7 @@ fn f3(a : array<array<array<f32, 4>, 3>, 2>) -> f32 {
return a[1][2][3];
}
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
let a1 : array<f32, 4> = array<f32, 4>();
let a2 : array<array<f32, 4>, 3> = array<array<f32, 4>, 3>();

View File

@ -10,7 +10,7 @@ fn f3() -> array<array<array<f32, 4>, 3>, 2> {
return array<array<array<f32, 4>, 3>, 2>(f2(), f2());
}
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
let a1 : array<f32, 4> = f1();
let a2 : array<array<f32, 4>, 3> = f2();

View File

@ -10,7 +10,7 @@ fn f3() -> array<array<array<f32, 4>, 3>, 2> {
return array<array<array<f32, 4>, 3>, 2>(f2(), f2());
}
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
let a1 : array<f32, 4> = f1();
let a2 : array<array<f32, 4>, 3> = f2();

View File

@ -1,7 +1,7 @@
let slen = 4;
let ulen = 4u;
@stage(fragment)
@fragment
fn main() {
var signed_literal : array<f32, 4>;
var unsigned_literal : array<f32, 4u>;

View File

@ -2,7 +2,7 @@ let slen = 4;
let ulen = 4u;
@stage(fragment)
@fragment
fn main() {
var signed_literal : array<f32, 4>;
var unsigned_literal : array<f32, 4u>;

View File

@ -5,7 +5,7 @@
; };
; @group(0) @binding(0) var<storage, read_write> s : S;
;
; @stage(compute) @workgroup_size(1)
; @compute @workgroup_size(1)
; fn f() {
; let a : ARR_B = s.a;
; let b : array<@stride(8) array<f32, 2>, 3> = s.a[3];

View File

@ -30,7 +30,7 @@ fn f_1() {
return;
}
@stage(compute) @workgroup_size(1i, 1i, 1i)
@compute @workgroup_size(1i, 1i, 1i)
fn f() {
f_1();
}

View File

@ -1,4 +1,4 @@
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
let x : i32 = 42;

View File

@ -1,4 +1,4 @@
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
let x : i32 = 42;
let empty : array<i32, 4> = array<i32, 4>();

View File

@ -21,7 +21,7 @@ struct VertexOutput {
v_color : vec4<f32>,
}
@stage(vertex)
@vertex
fn vert_main(@location(0) position : vec4<f32>, @location(1) color : vec4<f32>) -> VertexOutput {
var fade : f32 = ((uniforms.scalarOffset + ((time.value * uniforms.scalar) / 10.0)) % 1.0);
if ((fade < 0.5)) {
@ -42,7 +42,7 @@ fn vert_main(@location(0) position : vec4<f32>, @location(1) color : vec4<f32>)
return output;
}
@stage(fragment)
@fragment
fn frag_main(@location(0) v_color : vec4<f32>) -> @location(0) vec4<f32> {
return v_color;
}

View File

@ -34,7 +34,7 @@ fn getGaussianBlur(texCoord : vec2<f32>) -> vec4<f32> {
@group(0) @binding(3) var prevTexture : texture_2d<f32>;
@stage(fragment)
@fragment
fn fragmentMain(input : FragmentInput) -> @location(0) vec4<f32> {
let blurColor = getGaussianBlur(input.texCoord);
let dimColor = (textureSample(prevTexture, bloomSampler, input.texCoord) * bloom.dim);

View File

@ -85,7 +85,7 @@ fn sqDistPointAABB(point : vec3<f32>, minAABB : vec3<f32>, maxAABB : vec3<f32>)
return sqDist;
}
@stage(compute) @workgroup_size(4, 2, 4)
@compute @workgroup_size(4, 2, 4)
fn computeMain(@builtin(global_invocation_id) global_id : vec3<u32>) {
let tileIndex = ((global_id.x + (global_id.y * tileCount.x)) + ((global_id.z * tileCount.x) * tileCount.y));
var clusterLightCount = 0u;

View File

@ -102,7 +102,7 @@ fn interpZ(index : u32, i : vec3<u32>, va : f32, vb : f32) {
cubeVerts = (cubeVerts + 1u);
}
@stage(compute) @workgroup_size(4, 4, 4)
@compute @workgroup_size(4, 4, 4)
fn computeMain(@builtin(global_invocation_id) global_id : vec3<u32>) {
let i0 = global_id;
let i1 = (global_id + vec3<u32>(1u, 0u, 0u));

View File

@ -31,7 +31,7 @@ struct VertexOutput {
@location(1) quad_pos : vec2<f32>, // -1..+1
};
@stage(vertex)
@vertex
fn vs_main(in : VertexInput) -> VertexOutput {
var quad_pos = mat2x3<f32>(render_params.right, render_params.up) * in.quad_pos;
var position = in.position + quad_pos * 0.01;
@ -45,7 +45,7 @@ fn vs_main(in : VertexInput) -> VertexOutput {
////////////////////////////////////////////////////////////////////////////////
// Fragment shader
////////////////////////////////////////////////////////////////////////////////
@stage(fragment)
@fragment
fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
var color = in.color;
// Apply a circular particle alpha mask
@ -76,7 +76,7 @@ struct Particles {
@binding(1) @group(0) var<storage, read_write> data : Particles;
@binding(2) @group(0) var texture : texture_2d<f32>;
@stage(compute) @workgroup_size(64)
@compute @workgroup_size(64)
fn simulate(@builtin(global_invocation_id) GlobalInvocationID : vec3<u32>) {
rand_seed = (sim_params.seed.xy + vec2<f32>(GlobalInvocationID.xy)) * sim_params.seed.zw;
@ -148,7 +148,7 @@ struct Buffer {
// Loads the alpha channel from a texel of the source image, and writes it to
// the buf_out.weights.
////////////////////////////////////////////////////////////////////////////////
@stage(compute) @workgroup_size(64)
@compute @workgroup_size(64)
fn import_level(@builtin(global_invocation_id) coord : vec3<u32>) {
_ = &buf_in;
let offset = coord.x + coord.y * ubo.width;
@ -163,7 +163,7 @@ fn import_level(@builtin(global_invocation_id) coord : vec3<u32>) {
// mip level of tex_out. See simulate() in particle.wgsl to understand the
// probability logic.
////////////////////////////////////////////////////////////////////////////////
@stage(compute) @workgroup_size(64)
@compute @workgroup_size(64)
fn export_level(@builtin(global_invocation_id) coord : vec3<u32>) {
if (all(coord.xy < vec2<u32>(textureDimensions(tex_out)))) {
let dst_offset = coord.x + coord.y * ubo.width;

View File

@ -25,7 +25,7 @@ let albedo : vec3<f32> = vec3<f32>(0.899999976, 0.899999976, 0.899999976);
let ambientFactor : f32 = 0.200000003;
@stage(fragment)
@fragment
fn main(input : FragmentInput) -> @location(0) vec4<f32> {
var visibility : f32 = 0.0;
let oneOverShadowDepthTextureSize = (1.0 / shadowDepthTextureSize);

View File

@ -4,7 +4,7 @@ struct SB {
@group(0) @binding(0) var<storage, read_write> buffer : SB;
@stage(compute) @workgroup_size(1, 2, 3)
@compute @workgroup_size(1, 2, 3)
fn main(@builtin(global_invocation_id) id : vec3<u32>) {
buffer.data[id.x] = buffer.data[id.x] + 1;
}

View File

@ -6,7 +6,7 @@ struct Output {
@location(0) color: vec4<f32>,
};
@stage(fragment)
@fragment
fn main(in : Input) -> Output {
return Output(in.color);
}

View File

@ -6,7 +6,7 @@ struct Output {
@builtin(position) position : vec4<f32>,
};
@stage(vertex)
@vertex
fn main(in : Input) -> Output {
return Output(in.position);
}

View File

@ -330,7 +330,7 @@ struct FragmentOutput {
emissive : vec4<f32>,
}
@stage(fragment)
@fragment
fn fragmentMain(input : VertexOutput) -> FragmentOutput {
let surface = GetSurfaceInfo(input);
var Lo = vec3(0.0, 0.0, 0.0);

View File

@ -80,7 +80,7 @@ fn getSkinMatrix(input : VertexInput) -> mat4x4<f32> {
return skinMatrix;
}
@stage(vertex)
@vertex
fn vertexMain(input : VertexInput) -> VertexOutput {
var output : VertexOutput;
let modelMatrix = getSkinMatrix(input);

View File

@ -16,7 +16,7 @@ struct S {
@binding(0) @group(0) var<storage, read> s : S;
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main(@builtin(local_invocation_index) idx : u32) {
let a = s.arr[idx].a;
let b = s.arr[idx].b;

View File

@ -16,7 +16,7 @@ struct S {
@binding(0) @group(0) var<storage, read> s : S;
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main(@builtin(local_invocation_index) idx : u32) {
let a = s.arr[idx].a;
let b = s.arr[idx].b;

View File

@ -16,7 +16,7 @@ struct S {
@binding(0) @group(0) var<storage, read_write> s : S;
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main(@builtin(local_invocation_index) idx : u32) {
s.arr[idx].a = vec3<i32>();
s.arr[idx].b = i32();

View File

@ -16,7 +16,7 @@ struct S {
@binding(0) @group(0) var<storage, read_write> s : S;
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main(@builtin(local_invocation_index) idx : u32) {
s.arr[idx].a = vec3<i32>();
s.arr[idx].b = i32();

View File

@ -17,7 +17,7 @@ struct S {
@binding(0) @group(0) var<storage, read> s : S;
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
let a = s.a;
let b = s.b;

View File

@ -17,7 +17,7 @@ struct S {
@binding(0) @group(0) var<storage, read> s : S;
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
let a = s.a;
let b = s.b;

View File

@ -17,7 +17,7 @@ struct S {
@binding(0) @group(0) var<storage, write> s : S;
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
s.a = vec3<i32>();
s.b = i32();

View File

@ -17,7 +17,7 @@ struct S {
@binding(0) @group(0) var<storage, write> s : S;
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
s.a = vec3<i32>();
s.b = i32();

View File

@ -4,7 +4,7 @@ var<storage, read> in : array<f32, 4>;
@group(0) @binding(1)
var<storage, read_write> out : array<f32, 4>;
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
out = in;
}

View File

@ -2,7 +2,7 @@
@group(0) @binding(1) var<storage, read_write> out : array<f32, 4>;
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
out = in;
}

View File

@ -4,7 +4,7 @@ var<storage, read> in : f32;
@group(0) @binding(1)
var<storage, read_write> out : f32;
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
out = in;
}

View File

@ -2,7 +2,7 @@
@group(0) @binding(1) var<storage, read_write> out : f32;
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
out = in;
}

View File

@ -4,7 +4,7 @@ var<storage, read> in : i32;
@group(0) @binding(1)
var<storage, read_write> out : i32;
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
out = in;
}

View File

@ -2,7 +2,7 @@
@group(0) @binding(1) var<storage, read_write> out : i32;
@stage(compute) @workgroup_size(1)
@compute @workgroup_size(1)
fn main() {
out = in;
}

Some files were not shown because too many files have changed in this diff Show More