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; return 1.0;
} }
@stage(fragment) @fragment
fn main() { fn main() {
f1(1.0, 2); f1(1.0, 2);
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -460,7 +460,7 @@ struct main_out {
gl_Position : vec4<f32>, gl_Position : vec4<f32>,
} }
@stage(vertex) @vertex
fn main() -> main_out { fn main() -> main_out {
main_1(); main_1();
return main_out(gl_Position); return main_out(gl_Position);
@ -519,7 +519,7 @@ struct main_out {
gl_Position : vec4<f32>, gl_Position : vec4<f32>,
} }
@stage(vertex) @vertex
fn main() -> main_out { fn main() -> main_out {
main_1(); main_1();
return main_out(gl_Position); return main_out(gl_Position);
@ -575,7 +575,7 @@ struct main_out {
gl_Position : vec4<f32>, gl_Position : vec4<f32>,
} }
@stage(vertex) @vertex
fn main() -> main_out { fn main() -> main_out {
main_1(); main_1();
return main_out(gl_Position); return main_out(gl_Position);
@ -634,7 +634,7 @@ struct main_out {
x_2_1 : vec4<f32>, x_2_1 : vec4<f32>,
} }
@stage(vertex) @vertex
fn main() -> main_out { fn main() -> main_out {
main_1(); main_1();
return main_out(x_2); return main_out(x_2);
@ -690,7 +690,7 @@ struct main_out {
x_2_1 : vec4<f32>, x_2_1 : vec4<f32>,
} }
@stage(vertex) @vertex
fn main() -> main_out { fn main() -> main_out {
main_1(); main_1();
return main_out(x_2); return main_out(x_2);
@ -746,7 +746,7 @@ struct main_out {
x_2_1 : vec4<f32>, x_2_1 : vec4<f32>,
} }
@stage(vertex) @vertex
fn main() -> main_out { fn main() -> main_out {
main_1(); main_1();
return main_out(x_2); return main_out(x_2);
@ -782,7 +782,7 @@ struct main_out {
x_2_1 : vec4<f32>, x_2_1 : vec4<f32>,
} }
@stage(vertex) @vertex
fn main() -> main_out { fn main() -> main_out {
main_1(); main_1();
return main_out(x_2); return main_out(x_2);
@ -1650,7 +1650,7 @@ fn main_1() {
return; return;
} }
@stage(fragment) @fragment
fn main(@builtin(sample_index) x_1_param : u32) { fn main(@builtin(sample_index) x_1_param : u32) {
x_1 = bitcast<i32>(x_1_param); x_1 = bitcast<i32>(x_1_param);
main_1(); main_1();
@ -1763,7 +1763,7 @@ fn main_1() {
return; return;
} }
@stage(fragment) @fragment
fn main(@builtin(sample_index) x_1_param : u32) { fn main(@builtin(sample_index) x_1_param : u32) {
x_1 = bitcast<i32>(x_1_param); x_1 = bitcast<i32>(x_1_param);
main_1(); main_1();
@ -1816,7 +1816,7 @@ fn main_1() {
return; return;
} }
@stage(fragment) @fragment
fn main(@builtin(sample_index) x_1_param : u32) { fn main(@builtin(sample_index) x_1_param : u32) {
x_1 = x_1_param; x_1 = x_1_param;
main_1(); main_1();
@ -1846,7 +1846,7 @@ fn main_1() {
return; return;
} }
@stage(fragment) @fragment
fn main(@builtin(sample_index) x_1_param : u32) { fn main(@builtin(sample_index) x_1_param : u32) {
x_1 = x_1_param; x_1 = x_1_param;
main_1(); main_1();
@ -1875,7 +1875,7 @@ fn main_1() {
return; return;
} }
@stage(fragment) @fragment
fn main(@builtin(sample_index) x_1_param : u32) { fn main(@builtin(sample_index) x_1_param : u32) {
x_1 = x_1_param; x_1 = x_1_param;
main_1(); main_1();
@ -1989,7 +1989,7 @@ fn main_1() {
return; return;
} }
@stage(fragment) @fragment
fn main(@builtin(sample_mask) x_1_param : u32) { fn main(@builtin(sample_mask) x_1_param : u32) {
x_1[0i] = x_1_param; x_1[0i] = x_1_param;
main_1(); main_1();
@ -2021,7 +2021,7 @@ fn main_1() {
return; return;
} }
@stage(fragment) @fragment
fn main(@builtin(sample_mask) x_1_param : u32) { fn main(@builtin(sample_mask) x_1_param : u32) {
x_1[0i] = x_1_param; x_1[0i] = x_1_param;
main_1(); main_1();
@ -2053,7 +2053,7 @@ fn main_1() {
return; return;
} }
@stage(fragment) @fragment
fn main(@builtin(sample_mask) x_1_param : u32) { fn main(@builtin(sample_mask) x_1_param : u32) {
x_1[0i] = x_1_param; x_1[0i] = x_1_param;
main_1(); main_1();
@ -2084,7 +2084,7 @@ fn main_1() {
return; return;
} }
@stage(fragment) @fragment
fn main(@builtin(sample_mask) x_1_param : u32) { fn main(@builtin(sample_mask) x_1_param : u32) {
x_1[0i] = bitcast<i32>(x_1_param); x_1[0i] = bitcast<i32>(x_1_param);
main_1(); main_1();
@ -2116,7 +2116,7 @@ fn main_1() {
return; return;
} }
@stage(fragment) @fragment
fn main(@builtin(sample_mask) x_1_param : u32) { fn main(@builtin(sample_mask) x_1_param : u32) {
x_1[0i] = bitcast<i32>(x_1_param); x_1[0i] = bitcast<i32>(x_1_param);
main_1(); main_1();
@ -2148,7 +2148,7 @@ fn main_1() {
return; return;
} }
@stage(fragment) @fragment
fn main(@builtin(sample_mask) x_1_param : u32) { fn main(@builtin(sample_mask) x_1_param : u32) {
x_1[0i] = bitcast<i32>(x_1_param); x_1[0i] = bitcast<i32>(x_1_param);
main_1(); main_1();
@ -2202,7 +2202,7 @@ struct main_out {
x_1_1 : u32, x_1_1 : u32,
} }
@stage(fragment) @fragment
fn main() -> main_out { fn main() -> main_out {
main_1(); main_1();
return main_out(x_1[0i]); return main_out(x_1[0i]);
@ -2239,7 +2239,7 @@ struct main_out {
x_1_1 : u32, x_1_1 : u32,
} }
@stage(fragment) @fragment
fn main() -> main_out { fn main() -> main_out {
main_1(); main_1();
return main_out(x_1[0i]); return main_out(x_1[0i]);
@ -2276,7 +2276,7 @@ struct main_out {
x_1_1 : u32, x_1_1 : u32,
} }
@stage(fragment) @fragment
fn main() -> main_out { fn main() -> main_out {
main_1(); main_1();
return main_out(x_1[0i]); return main_out(x_1[0i]);
@ -2312,7 +2312,7 @@ struct main_out {
x_1_1 : u32, x_1_1 : u32,
} }
@stage(fragment) @fragment
fn main() -> main_out { fn main() -> main_out {
main_1(); main_1();
return main_out(bitcast<u32>(x_1[0i])); return main_out(bitcast<u32>(x_1[0i]));
@ -2349,7 +2349,7 @@ struct main_out {
x_1_1 : u32, x_1_1 : u32,
} }
@stage(fragment) @fragment
fn main() -> main_out { fn main() -> main_out {
main_1(); main_1();
return main_out(bitcast<u32>(x_1[0i])); return main_out(bitcast<u32>(x_1[0i]));
@ -2386,7 +2386,7 @@ struct main_out {
x_1_1 : u32, x_1_1 : u32,
} }
@stage(fragment) @fragment
fn main() -> main_out { fn main() -> main_out {
main_1(); main_1();
return main_out(bitcast<u32>(x_1[0i])); return main_out(bitcast<u32>(x_1[0i]));
@ -2425,7 +2425,7 @@ fn main_1() {
return; return;
} }
@stage(fragment) @fragment
fn main(@builtin(sample_mask) x_1_param : u32) { fn main(@builtin(sample_mask) x_1_param : u32) {
x_1[0i] = x_1_param; x_1[0i] = x_1_param;
main_1(); main_1();
@ -2469,7 +2469,7 @@ struct main_out {
x_1_1 : u32, x_1_1 : u32,
} }
@stage(fragment) @fragment
fn main() -> main_out { fn main() -> main_out {
main_1(); main_1();
return main_out(x_1[0i]); return main_out(x_1[0i]);
@ -2527,7 +2527,7 @@ struct main_out {
x_4_1 : vec4<f32>, x_4_1 : vec4<f32>,
} }
@stage(vertex) @vertex
fn main(@builtin(vertex_index) x_1_param : u32) -> main_out { fn main(@builtin(vertex_index) x_1_param : u32) -> main_out {
x_1 = bitcast<i32>(x_1_param); x_1 = bitcast<i32>(x_1_param);
main_1(); main_1();
@ -2565,7 +2565,7 @@ struct main_out {
x_4_1 : vec4<f32>, x_4_1 : vec4<f32>,
} }
@stage(vertex) @vertex
fn main(@builtin(vertex_index) x_1_param : u32) -> main_out { fn main(@builtin(vertex_index) x_1_param : u32) -> main_out {
x_1 = bitcast<i32>(x_1_param); x_1 = bitcast<i32>(x_1_param);
main_1(); main_1();
@ -2602,7 +2602,7 @@ struct main_out {
x_4_1 : vec4<f32>, x_4_1 : vec4<f32>,
} }
@stage(vertex) @vertex
fn main(@builtin(vertex_index) x_1_param : u32) -> main_out { fn main(@builtin(vertex_index) x_1_param : u32) -> main_out {
x_1 = bitcast<i32>(x_1_param); x_1 = bitcast<i32>(x_1_param);
main_1(); main_1();
@ -2638,7 +2638,7 @@ struct main_out {
x_4_1 : vec4<f32>, x_4_1 : vec4<f32>,
} }
@stage(vertex) @vertex
fn main(@builtin(vertex_index) x_1_param : u32) -> main_out { fn main(@builtin(vertex_index) x_1_param : u32) -> main_out {
x_1 = x_1_param; x_1 = x_1_param;
main_1(); main_1();
@ -2676,7 +2676,7 @@ struct main_out {
x_4_1 : vec4<f32>, x_4_1 : vec4<f32>,
} }
@stage(vertex) @vertex
fn main(@builtin(vertex_index) x_1_param : u32) -> main_out { fn main(@builtin(vertex_index) x_1_param : u32) -> main_out {
x_1 = x_1_param; x_1 = x_1_param;
main_1(); main_1();
@ -2713,7 +2713,7 @@ struct main_out {
x_4_1 : vec4<f32>, x_4_1 : vec4<f32>,
} }
@stage(vertex) @vertex
fn main(@builtin(vertex_index) x_1_param : u32) -> main_out { fn main(@builtin(vertex_index) x_1_param : u32) -> main_out {
x_1 = x_1_param; x_1 = x_1_param;
main_1(); main_1();
@ -2797,7 +2797,7 @@ struct main_out {
position_1 : vec4<f32>, position_1 : vec4<f32>,
} }
@stage(vertex) @vertex
fn main(@builtin(instance_index) x_1_param : u32) -> main_out { fn main(@builtin(instance_index) x_1_param : u32) -> main_out {
x_1 = bitcast<i32>(x_1_param); x_1 = bitcast<i32>(x_1_param);
main_1(); main_1();
@ -2835,7 +2835,7 @@ struct main_out {
position_1 : vec4<f32>, position_1 : vec4<f32>,
} }
@stage(vertex) @vertex
fn main(@builtin(instance_index) x_1_param : u32) -> main_out { fn main(@builtin(instance_index) x_1_param : u32) -> main_out {
x_1 = bitcast<i32>(x_1_param); x_1 = bitcast<i32>(x_1_param);
main_1(); main_1();
@ -2872,7 +2872,7 @@ struct main_out {
position_1 : vec4<f32>, position_1 : vec4<f32>,
} }
@stage(vertex) @vertex
fn main(@builtin(instance_index) x_1_param : u32) -> main_out { fn main(@builtin(instance_index) x_1_param : u32) -> main_out {
x_1 = bitcast<i32>(x_1_param); x_1 = bitcast<i32>(x_1_param);
main_1(); main_1();
@ -2931,7 +2931,7 @@ struct main_out {
position_1 : vec4<f32>, position_1 : vec4<f32>,
} }
@stage(vertex) @vertex
fn main(@builtin(instance_index) x_1_param : u32) -> main_out { fn main(@builtin(instance_index) x_1_param : u32) -> main_out {
x_1 = x_1_param; x_1 = x_1_param;
main_1(); main_1();
@ -2969,7 +2969,7 @@ struct main_out {
position_1 : vec4<f32>, position_1 : vec4<f32>,
} }
@stage(vertex) @vertex
fn main(@builtin(instance_index) x_1_param : u32) -> main_out { fn main(@builtin(instance_index) x_1_param : u32) -> main_out {
x_1 = x_1_param; x_1 = x_1_param;
main_1(); main_1();
@ -3006,7 +3006,7 @@ struct main_out {
position_1 : vec4<f32>, position_1 : vec4<f32>,
} }
@stage(vertex) @vertex
fn main(@builtin(instance_index) x_1_param : u32) -> main_out { fn main(@builtin(instance_index) x_1_param : u32) -> main_out {
x_1 = x_1_param; x_1 = x_1_param;
main_1(); main_1();
@ -3149,7 +3149,7 @@ fn main_1() {
return; 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}) { fn main(@builtin(${wgsl_builtin}) x_1_param : ${unsigned_wgsl_type}) {
x_1 = ${assignment_value}; x_1 = ${assignment_value};
main_1(); main_1();
@ -3195,7 +3195,7 @@ fn main_1() {
return; 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}) { fn main(@builtin(${wgsl_builtin}) x_1_param : ${unsigned_wgsl_type}) {
x_1 = ${assignment_value}; x_1 = ${assignment_value};
main_1(); main_1();
@ -3240,7 +3240,7 @@ fn main_1() {
return; 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}) { fn main(@builtin(${wgsl_builtin}) x_1_param : ${unsigned_wgsl_type}) {
x_1 = ${assignment_value}; x_1 = ${assignment_value};
main_1(); main_1();
@ -3552,7 +3552,7 @@ struct main_out {
x_4_1 : u32, 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 { 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_1 = x_1_param;
x_3 = x_3_param; x_3 = x_3_param;
@ -3603,7 +3603,7 @@ struct main_out {
x_4_1 : vec4<f32>, x_4_1 : vec4<f32>,
} }
@stage(vertex) @vertex
fn main(@builtin(instance_index) x_1_param : u32) -> main_out { fn main(@builtin(instance_index) x_1_param : u32) -> main_out {
x_1 = x_1_param; x_1 = x_1_param;
main_1(); main_1();
@ -3652,7 +3652,7 @@ struct main_out {
x_4_1 : vec4<f32>, x_4_1 : vec4<f32>,
} }
@stage(vertex) @vertex
fn main(@builtin(instance_index) x_1_param : u32) -> main_out { fn main(@builtin(instance_index) x_1_param : u32) -> main_out {
x_1 = bitcast<i32>(x_1_param); x_1 = bitcast<i32>(x_1_param);
main_1(); main_1();
@ -3692,7 +3692,7 @@ fn main_1() {
return; return;
} }
@stage(fragment) @fragment
fn main(@builtin(sample_mask) x_1_param : u32) { fn main(@builtin(sample_mask) x_1_param : u32) {
x_1[0i] = x_1_param; x_1[0i] = x_1_param;
main_1(); main_1();
@ -3730,7 +3730,7 @@ fn main_1() {
return; return;
} }
@stage(fragment) @fragment
fn main(@builtin(sample_mask) x_1_param : u32) { fn main(@builtin(sample_mask) x_1_param : u32) {
x_1[0i] = bitcast<i32>(x_1_param); x_1[0i] = bitcast<i32>(x_1_param);
main_1(); main_1();
@ -3776,7 +3776,7 @@ struct main_out {
x_1_1 : u32, x_1_1 : u32,
} }
@stage(fragment) @fragment
fn main() -> main_out { fn main() -> main_out {
main_1(); main_1();
return main_out(x_1[0i]); return main_out(x_1[0i]);
@ -3822,7 +3822,7 @@ struct main_out {
x_1_1 : u32, x_1_1 : u32,
} }
@stage(fragment) @fragment
fn main() -> main_out { fn main() -> main_out {
main_1(); main_1();
return main_out(bitcast<u32>(x_1[0i])); return main_out(bitcast<u32>(x_1[0i]));
@ -3865,7 +3865,7 @@ struct main_out {
x_1_1 : f32, x_1_1 : f32,
} }
@stage(fragment) @fragment
fn main() -> main_out { fn main() -> main_out {
main_1(); main_1();
return main_out(x_1); return main_out(x_1);
@ -3899,7 +3899,7 @@ struct main_out {
gl_Position : vec4<f32>, gl_Position : vec4<f32>,
} }
@stage(vertex) @vertex
fn main() -> main_out { fn main() -> main_out {
main_1(); main_1();
return main_out(gl_Position); return main_out(gl_Position);
@ -3968,7 +3968,7 @@ struct main_out {
gl_Position : vec4<f32>, gl_Position : vec4<f32>,
} }
@stage(vertex) @vertex
fn main() -> main_out { fn main() -> main_out {
main_1(); main_1();
return main_out(gl_Position); return main_out(gl_Position);
@ -4025,7 +4025,7 @@ struct main_out {
x_2_1 : vec4<f32>, 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 { 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[0i] = x_1_param;
x_1[1i] = x_1_param_1; x_1[1i] = x_1_param_1;
@ -4083,7 +4083,7 @@ struct main_out {
x_2_1 : vec4<f32>, 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 { 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[0i] = x_1_param;
x_1[1i] = x_1_param_1; x_1[1i] = x_1_param_1;
@ -4150,7 +4150,7 @@ struct main_out {
x_2_1 : vec4<f32>, 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 { 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.alice = x_1_param;
x_1.bob = x_1_param_1; x_1.bob = x_1_param_1;
@ -4209,7 +4209,7 @@ struct main_out {
x_2_1 : vec4<f32>, 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 { 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][0i] = x_1_param;
x_1[0i][1i] = x_1_param_1; x_1[0i][1i] = x_1_param_1;
@ -4276,7 +4276,7 @@ struct main_out {
x_2_1 : vec4<f32>, x_2_1 : vec4<f32>,
} }
@stage(vertex) @vertex
fn main() -> main_out { fn main() -> main_out {
main_1(); main_1();
return main_out(x_1[0i], x_1[1i], x_1[2i], x_2); 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>, x_2_1 : vec4<f32>,
} }
@stage(vertex) @vertex
fn main() -> main_out { fn main() -> main_out {
main_1(); main_1();
return main_out(x_1[0i], x_1[1i], x_2); return main_out(x_1[0i], x_1[1i], x_2);
@ -4404,7 +4404,7 @@ struct main_out {
x_2_1 : vec4<f32>, x_2_1 : vec4<f32>,
} }
@stage(vertex) @vertex
fn main() -> main_out { fn main() -> main_out {
main_1(); main_1();
return main_out(x_1.alice, x_1.bob, x_2); return main_out(x_1.alice, x_1.bob, x_2);
@ -4479,7 +4479,7 @@ struct main_out {
x_3_2 : vec4<f32>, 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 { 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.alice = x_1_param;
x_1.bob = x_1_param_1; x_1.bob = x_1_param_1;
@ -4558,7 +4558,7 @@ struct main_out {
x_10_1 : vec4<f32>, 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 { 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_1 = x_1_param;
x_2 = x_2_param; x_2 = x_2_param;
@ -4653,7 +4653,7 @@ struct main_out {
x_10_1 : vec4<f32>, x_10_1 : vec4<f32>,
} }
@stage(vertex) @vertex
fn main() -> main_out { fn main() -> main_out {
main_1(); main_1();
return main_out(x_1, x_2, x_3, x_4, x_5, x_6, x_10); 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; 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) { 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[0i] = x_1_param;
x_1[1i] = x_1_param_1; x_1[1i] = x_1_param_1;
@ -4777,7 +4777,7 @@ fn main_1() {
return; 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) { 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_1 = x_1_param;
x_2 = x_2_param; x_2 = x_2_param;
@ -4844,7 +4844,7 @@ fn main_1() {
return; 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) { 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.field0 = x_1_param;
x_1.field1 = x_1_param_1; x_1.field1 = x_1_param_1;
@ -4935,7 +4935,7 @@ struct main_out {
x_6_1 : f32, x_6_1 : f32,
} }
@stage(fragment) @fragment
fn main() -> main_out { fn main() -> main_out {
main_1(); main_1();
return main_out(x_1, x_2, x_3, x_4, x_5, x_6); 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, x_1_6 : f32,
} }
@stage(fragment) @fragment
fn main() -> main_out { fn main() -> main_out {
main_1(); main_1();
return main_out(x_1.field0, x_1.field1, x_1.field2, x_1.field3, x_1.field4, x_1.field5); 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>, x_10_1 : vec4<f32>,
} }
@stage(vertex) @vertex
fn main() -> main_out { fn main() -> main_out {
main_1(); main_1();
return main_out(x_1, x_2, x_3, x_4, x_5, x_6, x_10); 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; 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>) { 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_1 = x_1_param;
x_2 = x_2_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) { TEST_F(ParserImplErrorTest, FunctionDeclStageMissingLParen) {
EXPECT("@stage vertex) fn f() {}", EXPECT("@stage vertex) fn f() {}",
R"(test.wgsl:1:8 error: expected '(' for stage attribute 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) { TEST_F(ParserImplErrorTest, GlobalDeclInvalidAttribute) {
EXPECT("@stage(vertex) x;", EXPECT("@vertex x;",
R"(test.wgsl:1:16 error: expected declaration after attributes R"(test.wgsl:1:9 error: expected declaration after attributes
@stage(vertex) x; @vertex x;
^ ^
)"); )");
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -47,7 +47,7 @@ using alias = builder::alias<T>;
class ResolverEntryPointValidationTest : public TestHelper, public testing::Test {}; class ResolverEntryPointValidationTest : public TestHelper, public testing::Test {};
TEST_F(ResolverEntryPointValidationTest, ReturnTypeAttribute_Location) { TEST_F(ResolverEntryPointValidationTest, ReturnTypeAttribute_Location) {
// @stage(fragment) // @fragment
// fn main() -> @location(0) f32 { return 1.0; } // fn main() -> @location(0) f32 { return 1.0; }
Func(Source{{12, 34}}, "main", {}, ty.f32(), {Return(1_f)}, Func(Source{{12, 34}}, "main", {}, ty.f32(), {Return(1_f)},
{Stage(ast::PipelineStage::kFragment)}, {Location(0)}); {Stage(ast::PipelineStage::kFragment)}, {Location(0)});
@ -56,7 +56,7 @@ TEST_F(ResolverEntryPointValidationTest, ReturnTypeAttribute_Location) {
} }
TEST_F(ResolverEntryPointValidationTest, ReturnTypeAttribute_Builtin) { TEST_F(ResolverEntryPointValidationTest, ReturnTypeAttribute_Builtin) {
// @stage(vertex) // @vertex
// fn main() -> @builtin(position) vec4<f32> { return vec4<f32>(); } // fn main() -> @builtin(position) vec4<f32> { return vec4<f32>(); }
Func(Source{{12, 34}}, "main", {}, ty.vec4<f32>(), {Return(Construct(ty.vec4<f32>()))}, Func(Source{{12, 34}}, "main", {}, ty.vec4<f32>(), {Return(Construct(ty.vec4<f32>()))},
{Stage(ast::PipelineStage::kVertex)}, {Builtin(ast::Builtin::kPosition)}); {Stage(ast::PipelineStage::kVertex)}, {Builtin(ast::Builtin::kPosition)});
@ -65,7 +65,7 @@ TEST_F(ResolverEntryPointValidationTest, ReturnTypeAttribute_Builtin) {
} }
TEST_F(ResolverEntryPointValidationTest, ReturnTypeAttribute_Missing) { TEST_F(ResolverEntryPointValidationTest, ReturnTypeAttribute_Missing) {
// @stage(vertex) // @vertex
// fn main() -> f32 { // fn main() -> f32 {
// return 1.0; // return 1.0;
// } // }
@ -77,7 +77,7 @@ TEST_F(ResolverEntryPointValidationTest, ReturnTypeAttribute_Missing) {
} }
TEST_F(ResolverEntryPointValidationTest, ReturnTypeAttribute_Multiple) { TEST_F(ResolverEntryPointValidationTest, ReturnTypeAttribute_Multiple) {
// @stage(vertex) // @vertex
// fn main() -> @location(0) @builtin(position) vec4<f32> { // fn main() -> @location(0) @builtin(position) vec4<f32> {
// return vec4<f32>(); // return vec4<f32>();
// } // }
@ -95,7 +95,7 @@ TEST_F(ResolverEntryPointValidationTest, ReturnType_Struct_Valid) {
// @location(0) a : f32; // @location(0) a : f32;
// @builtin(frag_depth) b : f32; // @builtin(frag_depth) b : f32;
// }; // };
// @stage(fragment) // @fragment
// fn main() -> Output { // fn main() -> Output {
// return Output(); // return Output();
// } // }
@ -112,7 +112,7 @@ TEST_F(ResolverEntryPointValidationTest, ReturnType_Struct_MemberMultipleAttribu
// struct Output { // struct Output {
// @location(0) @builtin(frag_depth) a : f32; // @location(0) @builtin(frag_depth) a : f32;
// }; // };
// @stage(fragment) // @fragment
// fn main() -> Output { // fn main() -> Output {
// return Output(); // return Output();
// } // }
@ -134,7 +134,7 @@ TEST_F(ResolverEntryPointValidationTest, ReturnType_Struct_MemberMissingAttribut
// @location(0) a : f32; // @location(0) a : f32;
// b : f32; // b : f32;
// }; // };
// @stage(fragment) // @fragment
// fn main() -> Output { // fn main() -> Output {
// return Output(); // return Output();
// } // }
@ -154,7 +154,7 @@ TEST_F(ResolverEntryPointValidationTest, ReturnType_Struct_DuplicateBuiltins) {
// @builtin(frag_depth) a : f32; // @builtin(frag_depth) a : f32;
// @builtin(frag_depth) b : f32; // @builtin(frag_depth) b : f32;
// }; // };
// @stage(fragment) // @fragment
// fn main() -> Output { // fn main() -> Output {
// return Output(); // return Output();
// } // }
@ -172,7 +172,7 @@ TEST_F(ResolverEntryPointValidationTest, ReturnType_Struct_DuplicateBuiltins) {
} }
TEST_F(ResolverEntryPointValidationTest, ParameterAttribute_Location) { TEST_F(ResolverEntryPointValidationTest, ParameterAttribute_Location) {
// @stage(fragment) // @fragment
// fn main(@location(0) param : f32) {} // fn main(@location(0) param : f32) {}
auto* param = Param("param", ty.f32(), {Location(0)}); auto* param = Param("param", ty.f32(), {Location(0)});
Func(Source{{12, 34}}, "main", {param}, ty.void_(), {}, {Stage(ast::PipelineStage::kFragment)}); 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) { TEST_F(ResolverEntryPointValidationTest, ParameterAttribute_Missing) {
// @stage(fragment) // @fragment
// fn main(param : f32) {} // fn main(param : f32) {}
auto* param = Param(Source{{13, 43}}, "param", ty.vec4<f32>()); auto* param = Param(Source{{13, 43}}, "param", ty.vec4<f32>());
Func(Source{{12, 34}}, "main", {param}, ty.void_(), {}, {Stage(ast::PipelineStage::kFragment)}); 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) { TEST_F(ResolverEntryPointValidationTest, ParameterAttribute_Multiple) {
// @stage(fragment) // @fragment
// fn main(@location(0) @builtin(sample_index) param : u32) {} // fn main(@location(0) @builtin(sample_index) param : u32) {}
auto* param = Param( auto* param = Param(
"param", ty.u32(), "param", ty.u32(),
@ -208,7 +208,7 @@ TEST_F(ResolverEntryPointValidationTest, Parameter_Struct_Valid) {
// @location(0) a : f32; // @location(0) a : f32;
// @builtin(sample_index) b : u32; // @builtin(sample_index) b : u32;
// }; // };
// @stage(fragment) // @fragment
// fn main(param : Input) {} // fn main(param : Input) {}
auto* input = auto* input =
Structure("Input", {Member("a", ty.f32(), {Location(0)}), Structure("Input", {Member("a", ty.f32(), {Location(0)}),
@ -223,7 +223,7 @@ TEST_F(ResolverEntryPointValidationTest, Parameter_Struct_MemberMultipleAttribut
// struct Input { // struct Input {
// @location(0) @builtin(sample_index) a : u32; // @location(0) @builtin(sample_index) a : u32;
// }; // };
// @stage(fragment) // @fragment
// fn main(param : Input) {} // fn main(param : Input) {}
auto* input = auto* input =
Structure("Input", {Member("a", ty.u32(), Structure("Input", {Member("a", ty.u32(),
@ -243,7 +243,7 @@ TEST_F(ResolverEntryPointValidationTest, Parameter_Struct_MemberMissingAttribute
// @location(0) a : f32; // @location(0) a : f32;
// b : f32; // b : f32;
// }; // };
// @stage(fragment) // @fragment
// fn main(param : Input) {} // fn main(param : Input) {}
auto* input = Structure("Input", {Member(Source{{13, 43}}, "a", ty.f32(), {Location(0)}), auto* input = Structure("Input", {Member(Source{{13, 43}}, "a", ty.f32(), {Location(0)}),
Member(Source{{14, 52}}, "b", ty.f32(), {})}); Member(Source{{14, 52}}, "b", ty.f32(), {})});
@ -256,7 +256,7 @@ TEST_F(ResolverEntryPointValidationTest, Parameter_Struct_MemberMissingAttribute
} }
TEST_F(ResolverEntryPointValidationTest, Parameter_DuplicateBuiltins) { TEST_F(ResolverEntryPointValidationTest, Parameter_DuplicateBuiltins) {
// @stage(fragment) // @fragment
// fn main(@builtin(sample_index) param_a : u32, // fn main(@builtin(sample_index) param_a : u32,
// @builtin(sample_index) param_b : u32) {} // @builtin(sample_index) param_b : u32) {}
auto* param_a = Param("param_a", ty.u32(), {Builtin(ast::Builtin::kSampleIndex)}); auto* param_a = Param("param_a", ty.u32(), {Builtin(ast::Builtin::kSampleIndex)});
@ -277,7 +277,7 @@ TEST_F(ResolverEntryPointValidationTest, Parameter_Struct_DuplicateBuiltins) {
// struct InputB { // struct InputB {
// @builtin(sample_index) a : u32; // @builtin(sample_index) a : u32;
// }; // };
// @stage(fragment) // @fragment
// fn main(param_a : InputA, param_b : InputB) {} // fn main(param_a : InputA, param_b : InputB) {}
auto* input_a = auto* input_a =
Structure("InputA", {Member("a", ty.u32(), {Builtin(ast::Builtin::kSampleIndex)})}); Structure("InputA", {Member("a", ty.u32(), {Builtin(ast::Builtin::kSampleIndex)})});
@ -296,7 +296,7 @@ TEST_F(ResolverEntryPointValidationTest, Parameter_Struct_DuplicateBuiltins) {
} }
TEST_F(ResolverEntryPointValidationTest, VertexShaderMustReturnPosition) { TEST_F(ResolverEntryPointValidationTest, VertexShaderMustReturnPosition) {
// @stage(vertex) // @vertex
// fn main() {} // fn main() {}
Func(Source{{12, 34}}, "main", {}, ty.void_(), {}, {Stage(ast::PipelineStage::kVertex)}); Func(Source{{12, 34}}, "main", {}, ty.void_(), {}, {Stage(ast::PipelineStage::kVertex)});
@ -337,7 +337,7 @@ static constexpr Params cases[] = {
}; };
TEST_P(TypeValidationTest, BareInputs) { TEST_P(TypeValidationTest, BareInputs) {
// @stage(fragment) // @fragment
// fn main(@location(0) @interpolate(flat) a : *) {} // fn main(@location(0) @interpolate(flat) a : *) {}
auto params = GetParam(); auto params = GetParam();
auto* a = Param("a", params.create_ast_type(*this), {Location(0), Flat()}); auto* a = Param("a", params.create_ast_type(*this), {Location(0), Flat()});
@ -354,7 +354,7 @@ TEST_P(TypeValidationTest, StructInputs) {
// struct Input { // struct Input {
// @location(0) @interpolate(flat) a : *; // @location(0) @interpolate(flat) a : *;
// }; // };
// @stage(fragment) // @fragment
// fn main(a : Input) {} // fn main(a : Input) {}
auto params = GetParam(); auto params = GetParam();
auto* input = auto* input =
@ -370,7 +370,7 @@ TEST_P(TypeValidationTest, StructInputs) {
} }
TEST_P(TypeValidationTest, BareOutputs) { TEST_P(TypeValidationTest, BareOutputs) {
// @stage(fragment) // @fragment
// fn main() -> @location(0) * { // fn main() -> @location(0) * {
// return *(); // return *();
// } // }
@ -390,7 +390,7 @@ TEST_P(TypeValidationTest, StructOutputs) {
// struct Output { // struct Output {
// @location(0) a : *; // @location(0) a : *;
// }; // };
// @stage(fragment) // @fragment
// fn main() -> Output { // fn main() -> Output {
// return Output(); // return Output();
// } // }
@ -416,7 +416,7 @@ namespace {
using LocationAttributeTests = ResolverTest; using LocationAttributeTests = ResolverTest;
TEST_F(LocationAttributeTests, Pass) { TEST_F(LocationAttributeTests, Pass) {
// @stage(fragment) // @fragment
// fn frag_main(@location(0) @interpolate(flat) a: i32) {} // fn frag_main(@location(0) @interpolate(flat) a: i32) {}
auto* p = Param(Source{{12, 34}}, "a", ty.i32(), {Location(0), Flat()}); 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) { TEST_F(LocationAttributeTests, BadType_Input_bool) {
// @stage(fragment) // @fragment
// fn frag_main(@location(0) a: bool) {} // fn frag_main(@location(0) a: bool) {}
auto* p = Param(Source{{12, 34}}, "a", ty.bool_(), {Location(Source{{34, 56}}, 0)}); 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) { TEST_F(LocationAttributeTests, BadType_Output_Array) {
// @stage(fragment) // @fragment
// fn frag_main()->@location(0) array<f32, 2> { return array<f32, 2>(); } // fn frag_main()->@location(0) array<f32, 2> { return array<f32, 2>(); }
Func(Source{{12, 34}}, "frag_main", {}, ty.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 { // struct Input {
// a : f32; // a : f32;
// }; // };
// @stage(fragment) // @fragment
// fn main(@location(0) param : Input) {} // fn main(@location(0) param : Input) {}
auto* input = Structure("Input", {Member("a", ty.f32())}); auto* input = Structure("Input", {Member("a", ty.f32())});
auto* param = Param(Source{{12, 34}}, "param", ty.Of(input), {Location(Source{{13, 43}}, 0)}); 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 { // struct Input {
// a : Inner; // a : Inner;
// }; // };
// @stage(fragment) // @fragment
// fn main(param : Input) {} // fn main(param : Input) {}
auto* inner = Structure("Inner", {Member(Source{{13, 43}}, "a", ty.f32(), {Location(0)})}); 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))}); 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 { // struct Input {
// @location(0) a : array<f32>; // @location(0) a : array<f32>;
// }; // };
// @stage(fragment) // @fragment
// fn main(param : Input) {} // fn main(param : Input) {}
auto* input = auto* input =
Structure("Input", {Member(Source{{13, 43}}, "a", ty.array<f32>(), {Location(0)})}); 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) { TEST_F(LocationAttributeTests, BadMemberType_Input) {
// struct S { @location(0) m: array<i32>; }; // struct S { @location(0) m: array<i32>; };
// @stage(fragment) // @fragment
// fn frag_main( a: S) {} // fn frag_main( a: S) {}
auto* m = Member(Source{{34, 56}}, "m", ty.array<i32>(), auto* m = Member(Source{{34, 56}}, "m", ty.array<i32>(),
@ -535,7 +535,7 @@ TEST_F(LocationAttributeTests, BadMemberType_Input) {
TEST_F(LocationAttributeTests, BadMemberType_Output) { TEST_F(LocationAttributeTests, BadMemberType_Output) {
// struct S { @location(0) m: atomic<i32>; }; // struct S { @location(0) m: atomic<i32>; };
// @stage(fragment) // @fragment
// fn frag_main() -> S {} // fn frag_main() -> S {}
auto* m = Member(Source{{34, 56}}, "m", ty.atomic<i32>(), auto* m = Member(Source{{34, 56}}, "m", ty.atomic<i32>(),
ast::AttributeList{Location(Source{{12, 34}}, 0u)}); ast::AttributeList{Location(Source{{12, 34}}, 0u)});
@ -572,7 +572,7 @@ TEST_F(LocationAttributeTests, ReturnType_Struct_Valid) {
// @location(0) a : f32; // @location(0) a : f32;
// @builtin(frag_depth) b : f32; // @builtin(frag_depth) b : f32;
// }; // };
// @stage(fragment) // @fragment
// fn main() -> Output { // fn main() -> Output {
// return Output(); // return Output();
// } // }
@ -589,7 +589,7 @@ TEST_F(LocationAttributeTests, ReturnType_Struct) {
// struct Output { // struct Output {
// a : f32; // a : f32;
// }; // };
// @stage(vertex) // @vertex
// fn main() -> @location(0) Output { // fn main() -> @location(0) Output {
// return Output(); // return Output();
// } // }
@ -612,7 +612,7 @@ TEST_F(LocationAttributeTests, ReturnType_Struct_NestedStruct) {
// struct Output { // struct Output {
// a : Inner; // a : Inner;
// }; // };
// @stage(fragment) // @fragment
// fn main() -> Output { return Output(); } // fn main() -> Output { return Output(); }
auto* inner = Structure("Inner", {Member(Source{{13, 43}}, "a", ty.f32(), {Location(0)})}); 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))}); auto* output = Structure("Output", {Member(Source{{14, 52}}, "a", ty.Of(inner))});
@ -629,7 +629,7 @@ TEST_F(LocationAttributeTests, ReturnType_Struct_RuntimeArray) {
// struct Output { // struct Output {
// @location(0) a : array<f32>; // @location(0) a : array<f32>;
// }; // };
// @stage(fragment) // @fragment
// fn main() -> Output { // fn main() -> Output {
// return Output(); // return Output();
// } // }
@ -695,7 +695,7 @@ TEST_F(LocationAttributeTests, ComputeShaderLocationStructMember_Input) {
} }
TEST_F(LocationAttributeTests, Duplicate_input) { TEST_F(LocationAttributeTests, Duplicate_input) {
// @stage(fragment) // @fragment
// fn main(@location(1) param_a : f32, // fn main(@location(1) param_a : f32,
// @location(1) param_b : f32) {} // @location(1) param_b : f32) {}
auto* param_a = Param("param_a", ty.f32(), {Location(1)}); auto* param_a = Param("param_a", ty.f32(), {Location(1)});
@ -714,7 +714,7 @@ TEST_F(LocationAttributeTests, Duplicate_struct) {
// struct InputB { // struct InputB {
// @location(1) a : f32; // @location(1) a : f32;
// }; // };
// @stage(fragment) // @fragment
// fn main(param_a : InputA, param_b : InputB) {} // fn main(param_a : InputA, param_b : InputB) {}
auto* input_a = Structure("InputA", {Member("a", ty.f32(), {Location(1)})}); 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)})}); 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) { TEST_F(ResolverFunctionValidationTest, CannotCallEntryPoint) {
// @stage(compute) @workgroup_size(1) fn entrypoint() {} // @compute @workgroup_size(1) fn entrypoint() {}
// fn func() { return entrypoint(); } // fn func() { return entrypoint(); }
Func("entrypoint", {}, ty.void_(), {}, Func("entrypoint", {}, ty.void_(), {},
{Stage(ast::PipelineStage::kCompute), WorkgroupSize(1_i)}); {Stage(ast::PipelineStage::kCompute), WorkgroupSize(1_i)});
@ -359,8 +359,8 @@ TEST_F(ResolverFunctionValidationTest, CannotCallEntryPoint) {
} }
TEST_F(ResolverFunctionValidationTest, PipelineStage_MustBeUnique_Fail) { TEST_F(ResolverFunctionValidationTest, PipelineStage_MustBeUnique_Fail) {
// @stage(fragment) // @fragment
// @stage(vertex) // @vertex
// fn main() { return; } // fn main() { return; }
Func(Source{{12, 34}}, "main", {}, ty.void_(), Func(Source{{12, 34}}, "main", {}, ty.void_(),
{ {
@ -425,7 +425,7 @@ TEST_F(ResolverFunctionValidationTest, FunctionParamsConst) {
TEST_F(ResolverFunctionValidationTest, WorkgroupSize_GoodType_ConstU32) { TEST_F(ResolverFunctionValidationTest, WorkgroupSize_GoodType_ConstU32) {
// let x = 4u; // let x = 4u;
// let x = 8u; // let x = 8u;
// @stage(compute) @workgroup_size(x, y, 16u) // @compute @workgroup_size(x, y, 16u)
// fn main() {} // fn main() {}
auto* x = GlobalConst("x", ty.u32(), Expr(4_u)); auto* x = GlobalConst("x", ty.u32(), Expr(4_u));
auto* y = GlobalConst("y", ty.u32(), Expr(8_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) { TEST_F(ResolverFunctionValidationTest, WorkgroupSize_GoodType_I32) {
// @stage(compute) @workgroup_size(1i, 2i, 3i) // @compute @workgroup_size(1i, 2i, 3i)
// fn main() {} // fn main() {}
Func("main", {}, ty.void_(), {}, Func("main", {}, ty.void_(), {},
@ -457,7 +457,7 @@ TEST_F(ResolverFunctionValidationTest, WorkgroupSize_GoodType_I32) {
} }
TEST_F(ResolverFunctionValidationTest, WorkgroupSize_GoodType_U32) { TEST_F(ResolverFunctionValidationTest, WorkgroupSize_GoodType_U32) {
// @stage(compute) @workgroup_size(1u, 2u, 3u) // @compute @workgroup_size(1u, 2u, 3u)
// fn main() {} // fn main() {}
Func("main", {}, ty.void_(), {}, Func("main", {}, ty.void_(), {},
@ -467,7 +467,7 @@ TEST_F(ResolverFunctionValidationTest, WorkgroupSize_GoodType_U32) {
} }
TEST_F(ResolverFunctionValidationTest, WorkgroupSize_GoodType_I32_AInt) { TEST_F(ResolverFunctionValidationTest, WorkgroupSize_GoodType_I32_AInt) {
// @stage(compute) @workgroup_size(1, 2i, 3) // @compute @workgroup_size(1, 2i, 3)
// fn main() {} // fn main() {}
Func("main", {}, ty.void_(), {}, Func("main", {}, ty.void_(), {},
@ -477,7 +477,7 @@ TEST_F(ResolverFunctionValidationTest, WorkgroupSize_GoodType_I32_AInt) {
} }
TEST_F(ResolverFunctionValidationTest, WorkgroupSize_GoodType_U32_AInt) { TEST_F(ResolverFunctionValidationTest, WorkgroupSize_GoodType_U32_AInt) {
// @stage(compute) @workgroup_size(1u, 2, 3u) // @compute @workgroup_size(1u, 2, 3u)
// fn main() {} // fn main() {}
Func("main", {}, ty.void_(), {}, Func("main", {}, ty.void_(), {},
@ -487,7 +487,7 @@ TEST_F(ResolverFunctionValidationTest, WorkgroupSize_GoodType_U32_AInt) {
} }
TEST_F(ResolverFunctionValidationTest, WorkgroupSize_MismatchType_U32) { TEST_F(ResolverFunctionValidationTest, WorkgroupSize_MismatchType_U32) {
// @stage(compute) @workgroup_size(1u, 2, 3_i) // @compute @workgroup_size(1u, 2, 3_i)
// fn main() {} // fn main() {}
Func("main", {}, ty.void_(), {}, Func("main", {}, ty.void_(), {},
@ -499,7 +499,7 @@ TEST_F(ResolverFunctionValidationTest, WorkgroupSize_MismatchType_U32) {
} }
TEST_F(ResolverFunctionValidationTest, WorkgroupSize_MismatchType_I32) { TEST_F(ResolverFunctionValidationTest, WorkgroupSize_MismatchType_I32) {
// @stage(compute) @workgroup_size(1_i, 2u, 3) // @compute @workgroup_size(1_i, 2u, 3)
// fn main() {} // fn main() {}
Func("main", {}, ty.void_(), {}, Func("main", {}, ty.void_(), {},
@ -512,7 +512,7 @@ TEST_F(ResolverFunctionValidationTest, WorkgroupSize_MismatchType_I32) {
TEST_F(ResolverFunctionValidationTest, WorkgroupSize_Const_TypeMismatch) { TEST_F(ResolverFunctionValidationTest, WorkgroupSize_Const_TypeMismatch) {
// let x = 64u; // let x = 64u;
// @stage(compute) @workgroup_size(1i, x) // @compute @workgroup_size(1i, x)
// fn main() {} // fn main() {}
GlobalConst("x", ty.u32(), Expr(64_u)); GlobalConst("x", ty.u32(), Expr(64_u));
Func("main", {}, ty.void_(), {}, Func("main", {}, ty.void_(), {},
@ -526,7 +526,7 @@ TEST_F(ResolverFunctionValidationTest, WorkgroupSize_Const_TypeMismatch) {
TEST_F(ResolverFunctionValidationTest, WorkgroupSize_Const_TypeMismatch2) { TEST_F(ResolverFunctionValidationTest, WorkgroupSize_Const_TypeMismatch2) {
// let x = 64u; // let x = 64u;
// let y = 32i; // let y = 32i;
// @stage(compute) @workgroup_size(x, y) // @compute @workgroup_size(x, y)
// fn main() {} // fn main() {}
GlobalConst("x", ty.u32(), Expr(64_u)); GlobalConst("x", ty.u32(), Expr(64_u));
GlobalConst("y", ty.i32(), Expr(32_i)); GlobalConst("y", ty.i32(), Expr(32_i));
@ -540,7 +540,7 @@ TEST_F(ResolverFunctionValidationTest, WorkgroupSize_Const_TypeMismatch2) {
TEST_F(ResolverFunctionValidationTest, WorkgroupSize_Mismatch_ConstU32) { TEST_F(ResolverFunctionValidationTest, WorkgroupSize_Mismatch_ConstU32) {
// let x = 4u; // let x = 4u;
// let x = 8u; // let x = 8u;
// @stage(compute) @workgroup_size(x, y, 16i) // @compute @workgroup_size(x, y, 16i)
// fn main() {} // fn main() {}
GlobalConst("x", ty.u32(), Expr(4_u)); GlobalConst("x", ty.u32(), Expr(4_u));
GlobalConst("y", ty.u32(), Expr(8_u)); GlobalConst("y", ty.u32(), Expr(8_u));
@ -553,7 +553,7 @@ TEST_F(ResolverFunctionValidationTest, WorkgroupSize_Mismatch_ConstU32) {
} }
TEST_F(ResolverFunctionValidationTest, WorkgroupSize_Literal_BadType) { TEST_F(ResolverFunctionValidationTest, WorkgroupSize_Literal_BadType) {
// @stage(compute) @workgroup_size(64.0) // @compute @workgroup_size(64.0)
// fn main() {} // fn main() {}
Func("main", {}, ty.void_(), {}, Func("main", {}, ty.void_(), {},
@ -566,7 +566,7 @@ TEST_F(ResolverFunctionValidationTest, WorkgroupSize_Literal_BadType) {
} }
TEST_F(ResolverFunctionValidationTest, WorkgroupSize_Literal_Negative) { TEST_F(ResolverFunctionValidationTest, WorkgroupSize_Literal_Negative) {
// @stage(compute) @workgroup_size(-2i) // @compute @workgroup_size(-2i)
// fn main() {} // fn main() {}
Func("main", {}, ty.void_(), {}, Func("main", {}, ty.void_(), {},
@ -577,7 +577,7 @@ TEST_F(ResolverFunctionValidationTest, WorkgroupSize_Literal_Negative) {
} }
TEST_F(ResolverFunctionValidationTest, WorkgroupSize_Literal_Zero) { TEST_F(ResolverFunctionValidationTest, WorkgroupSize_Literal_Zero) {
// @stage(compute) @workgroup_size(0i) // @compute @workgroup_size(0i)
// fn main() {} // fn main() {}
Func("main", {}, ty.void_(), {}, Func("main", {}, ty.void_(), {},
@ -589,7 +589,7 @@ TEST_F(ResolverFunctionValidationTest, WorkgroupSize_Literal_Zero) {
TEST_F(ResolverFunctionValidationTest, WorkgroupSize_Const_BadType) { TEST_F(ResolverFunctionValidationTest, WorkgroupSize_Const_BadType) {
// let x = 64.0; // let x = 64.0;
// @stage(compute) @workgroup_size(x) // @compute @workgroup_size(x)
// fn main() {} // fn main() {}
GlobalConst("x", ty.f32(), Expr(64_f)); GlobalConst("x", ty.f32(), Expr(64_f));
Func("main", {}, ty.void_(), {}, Func("main", {}, ty.void_(), {},
@ -603,7 +603,7 @@ TEST_F(ResolverFunctionValidationTest, WorkgroupSize_Const_BadType) {
TEST_F(ResolverFunctionValidationTest, WorkgroupSize_Const_Negative) { TEST_F(ResolverFunctionValidationTest, WorkgroupSize_Const_Negative) {
// let x = -2i; // let x = -2i;
// @stage(compute) @workgroup_size(x) // @compute @workgroup_size(x)
// fn main() {} // fn main() {}
GlobalConst("x", ty.i32(), Expr(-2_i)); GlobalConst("x", ty.i32(), Expr(-2_i));
Func("main", {}, ty.void_(), {}, Func("main", {}, ty.void_(), {},
@ -615,7 +615,7 @@ TEST_F(ResolverFunctionValidationTest, WorkgroupSize_Const_Negative) {
TEST_F(ResolverFunctionValidationTest, WorkgroupSize_Const_Zero) { TEST_F(ResolverFunctionValidationTest, WorkgroupSize_Const_Zero) {
// let x = 0i; // let x = 0i;
// @stage(compute) @workgroup_size(x) // @compute @workgroup_size(x)
// fn main() {} // fn main() {}
GlobalConst("x", ty.i32(), Expr(0_i)); GlobalConst("x", ty.i32(), Expr(0_i));
Func("main", {}, ty.void_(), {}, Func("main", {}, ty.void_(), {},
@ -627,7 +627,7 @@ TEST_F(ResolverFunctionValidationTest, WorkgroupSize_Const_Zero) {
TEST_F(ResolverFunctionValidationTest, WorkgroupSize_Const_NestedZeroValueConstructor) { TEST_F(ResolverFunctionValidationTest, WorkgroupSize_Const_NestedZeroValueConstructor) {
// let x = i32(i32(i32())); // let x = i32(i32(i32()));
// @stage(compute) @workgroup_size(x) // @compute @workgroup_size(x)
// fn main() {} // fn main() {}
GlobalConst("x", ty.i32(), Construct(ty.i32(), Construct(ty.i32(), Construct(ty.i32())))); GlobalConst("x", ty.i32(), Construct(ty.i32(), Construct(ty.i32(), Construct(ty.i32()))));
Func("main", {}, ty.void_(), {}, Func("main", {}, ty.void_(), {},
@ -639,7 +639,7 @@ TEST_F(ResolverFunctionValidationTest, WorkgroupSize_Const_NestedZeroValueConstr
TEST_F(ResolverFunctionValidationTest, WorkgroupSize_NonConst) { TEST_F(ResolverFunctionValidationTest, WorkgroupSize_NonConst) {
// var<private> x = 64i; // var<private> x = 64i;
// @stage(compute) @workgroup_size(x) // @compute @workgroup_size(x)
// fn main() {} // fn main() {}
Global("x", ty.i32(), ast::StorageClass::kPrivate, Expr(64_i)); Global("x", ty.i32(), ast::StorageClass::kPrivate, Expr(64_i));
Func("main", {}, ty.void_(), {}, Func("main", {}, ty.void_(), {},
@ -652,7 +652,7 @@ TEST_F(ResolverFunctionValidationTest, WorkgroupSize_NonConst) {
} }
TEST_F(ResolverFunctionValidationTest, WorkgroupSize_InvalidExpr) { TEST_F(ResolverFunctionValidationTest, WorkgroupSize_InvalidExpr) {
// @stage(compute) @workgroup_size(i32(1)) // @compute @workgroup_size(i32(1))
// fn main() {} // fn main() {}
Func("main", {}, ty.void_(), {}, Func("main", {}, ty.void_(), {},
{Stage(ast::PipelineStage::kCompute), {Stage(ast::PipelineStage::kCompute),

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -40,7 +40,7 @@ struct SB {
@group(0) @binding(0) var<storage, read> sb : SB; @group(0) @binding(0) var<storage, read> sb : SB;
@stage(compute) @workgroup_size(1) @compute @workgroup_size(1)
fn main() { fn main() {
} }
)"; )";
@ -57,7 +57,7 @@ struct SB {
@group(0) @binding(0) var<storage, read> sb : SB; @group(0) @binding(0) var<storage, read> sb : SB;
@stage(compute) @workgroup_size(1) @compute @workgroup_size(1)
fn main() { fn main() {
var len : u32 = arrayLength(&sb.arr); var len : u32 = arrayLength(&sb.arr);
} }
@ -75,7 +75,7 @@ struct SB {
@group(0) @binding(0) var<storage, read> sb : SB; @group(0) @binding(0) var<storage, read> sb : SB;
@stage(compute) @workgroup_size(1) @compute @workgroup_size(1)
fn main() { fn main() {
var len : u32 = arrayLength(&sb.arr); var len : u32 = arrayLength(&sb.arr);
} }
@ -94,7 +94,7 @@ TEST_F(ArrayLengthFromUniformTest, Basic) {
auto* src = R"( auto* src = R"(
@group(0) @binding(0) var<storage, read> sb : array<i32>; @group(0) @binding(0) var<storage, read> sb : array<i32>;
@stage(compute) @workgroup_size(1) @compute @workgroup_size(1)
fn main() { fn main() {
var len : u32 = arrayLength(&sb); var len : u32 = arrayLength(&sb);
} }
@ -109,7 +109,7 @@ struct tint_symbol {
@group(0) @binding(0) var<storage, read> sb : array<i32>; @group(0) @binding(0) var<storage, read> sb : array<i32>;
@stage(compute) @workgroup_size(1) @compute @workgroup_size(1)
fn main() { fn main() {
var len : u32 = (tint_symbol_1.buffer_size[0u][0u] / 4u); 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; @group(0) @binding(0) var<storage, read> sb : SB;
@stage(compute) @workgroup_size(1) @compute @workgroup_size(1)
fn main() { fn main() {
var len : u32 = arrayLength(&sb.arr); var len : u32 = arrayLength(&sb.arr);
} }
@ -157,7 +157,7 @@ struct SB {
@group(0) @binding(0) var<storage, read> sb : SB; @group(0) @binding(0) var<storage, read> sb : SB;
@stage(compute) @workgroup_size(1) @compute @workgroup_size(1)
fn main() { fn main() {
var len : u32 = ((tint_symbol_1.buffer_size[0u][0u] - 4u) / 4u); 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(3) @binding(2) var<storage, read> sb4 : SB4;
@group(4) @binding(2) var<storage, read> sb5 : array<vec4<f32>>; @group(4) @binding(2) var<storage, read> sb5 : array<vec4<f32>>;
@stage(compute) @workgroup_size(1) @compute @workgroup_size(1)
fn main() { fn main() {
var len1 : u32 = arrayLength(&(sb1.arr1)); var len1 : u32 = arrayLength(&(sb1.arr1));
var len2 : u32 = arrayLength(&(sb2.arr2)); var len2 : u32 = arrayLength(&(sb2.arr2));
@ -240,7 +240,7 @@ struct SB4 {
@group(4) @binding(2) var<storage, read> sb5 : array<vec4<f32>>; @group(4) @binding(2) var<storage, read> sb5 : array<vec4<f32>>;
@stage(compute) @workgroup_size(1) @compute @workgroup_size(1)
fn main() { fn main() {
var len1 : u32 = ((tint_symbol_1.buffer_size[0u][0u] - 4u) / 4u); var len1 : u32 = ((tint_symbol_1.buffer_size[0u][0u] - 4u) / 4u);
var len2 : u32 = ((tint_symbol_1.buffer_size[0u][1u] - 16u) / 16u); 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(3) @binding(2) var<storage, read> sb4 : SB4;
@group(4) @binding(2) var<storage, read> sb5 : array<vec4<f32>>; @group(4) @binding(2) var<storage, read> sb5 : array<vec4<f32>>;
@stage(compute) @workgroup_size(1) @compute @workgroup_size(1)
fn main() { fn main() {
var len1 : u32 = arrayLength(&(sb1.arr1)); var len1 : u32 = arrayLength(&(sb1.arr1));
var len3 : u32 = arrayLength(&sb3); var len3 : u32 = arrayLength(&sb3);
@ -329,7 +329,7 @@ struct SB4 {
@group(4) @binding(2) var<storage, read> sb5 : array<vec4<f32>>; @group(4) @binding(2) var<storage, read> sb5 : array<vec4<f32>>;
@stage(compute) @workgroup_size(1) @compute @workgroup_size(1)
fn main() { fn main() {
var len1 : u32 = ((tint_symbol_1.buffer_size[0u][0u] - 4u) / 4u); var len1 : u32 = ((tint_symbol_1.buffer_size[0u][0u] - 4u) / 4u);
var len3 : u32 = (tint_symbol_1.buffer_size[0u][2u] / 16u); 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; @group(0) @binding(0) var<storage, read> sb : SB;
@stage(compute) @workgroup_size(1) @compute @workgroup_size(1)
fn main() { fn main() {
_ = &(sb.arr); _ = &(sb.arr);
} }
@ -397,7 +397,7 @@ struct SB2 {
@group(1) @binding(2) var<storage, read> sb2 : SB2; @group(1) @binding(2) var<storage, read> sb2 : SB2;
@stage(compute) @workgroup_size(1) @compute @workgroup_size(1)
fn main() { fn main() {
var len1 : u32 = arrayLength(&(sb1.arr1)); var len1 : u32 = arrayLength(&(sb1.arr1));
var len2 : u32 = arrayLength(&(sb2.arr2)); var len2 : u32 = arrayLength(&(sb2.arr2));
@ -426,7 +426,7 @@ struct SB2 {
@group(1) @binding(2) var<storage, read> sb2 : SB2; @group(1) @binding(2) var<storage, read> sb2 : SB2;
@stage(compute) @workgroup_size(1) @compute @workgroup_size(1)
fn main() { fn main() {
var len1 : u32 = ((tint_symbol_1.buffer_size[0u][0u] - 4u) / 4u); var len1 : u32 = ((tint_symbol_1.buffer_size[0u][0u] - 4u) / 4u);
var len2 : u32 = arrayLength(&(sb2.arr2)); var len2 : u32 = arrayLength(&(sb2.arr2));
@ -449,7 +449,7 @@ fn main() {
TEST_F(ArrayLengthFromUniformTest, OutOfOrder) { TEST_F(ArrayLengthFromUniformTest, OutOfOrder) {
auto* src = R"( auto* src = R"(
@stage(compute) @workgroup_size(1) @compute @workgroup_size(1)
fn main() { fn main() {
var len : u32 = arrayLength(&sb.arr); var len : u32 = arrayLength(&sb.arr);
} }
@ -469,7 +469,7 @@ struct tint_symbol {
@group(0) @binding(30) var<uniform> tint_symbol_1 : tint_symbol; @group(0) @binding(30) var<uniform> tint_symbol_1 : tint_symbol;
@stage(compute) @workgroup_size(1) @compute @workgroup_size(1)
fn main() { fn main() {
var len : u32 = ((tint_symbol_1.buffer_size[0u][0u] - 4u) / 4u); 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; @group(3) @binding(2) var<storage, read> b : S;
@stage(compute) @workgroup_size(1) @compute @workgroup_size(1)
fn f() { fn f() {
} }
)"; )";
@ -99,7 +99,7 @@ struct S {
@group(3) @binding(2) var<storage, read> b : S; @group(3) @binding(2) var<storage, read> b : S;
@stage(compute) @workgroup_size(1) @compute @workgroup_size(1)
fn f() { fn f() {
} }
)"; )";
@ -113,7 +113,7 @@ struct S {
@group(3) @binding(2) var<storage, read> b : S; @group(3) @binding(2) var<storage, read> b : S;
@stage(compute) @workgroup_size(1) @compute @workgroup_size(1)
fn f() { fn f() {
} }
)"; )";
@ -143,7 +143,7 @@ struct S {
@group(4) @binding(3) var<storage, read> c : S; @group(4) @binding(3) var<storage, read> c : S;
@stage(compute) @workgroup_size(1) @compute @workgroup_size(1)
fn f() { fn f() {
} }
)"; )";
@ -159,7 +159,7 @@ struct S {
@group(4) @binding(3) var<storage, read> c : S; @group(4) @binding(3) var<storage, read> c : S;
@stage(compute) @workgroup_size(1) @compute @workgroup_size(1)
fn f() { fn f() {
} }
)"; )";
@ -187,7 +187,7 @@ struct S {
@group(3) @binding(2) var<storage, read> b : S; @group(3) @binding(2) var<storage, read> b : S;
@stage(compute) @workgroup_size(1) @compute @workgroup_size(1)
fn f() { fn f() {
} }
)"; )";
@ -201,7 +201,7 @@ struct S {
@group(6) @binding(7) var<storage, write> b : S; @group(6) @binding(7) var<storage, write> b : S;
@stage(compute) @workgroup_size(1) @compute @workgroup_size(1)
fn f() { fn f() {
} }
)"; )";
@ -235,7 +235,7 @@ struct S {
@group(5) @binding(4) var<storage, read> d : S; @group(5) @binding(4) var<storage, read> d : S;
@stage(compute) @workgroup_size(1) @compute @workgroup_size(1)
fn f() { fn f() {
let x : i32 = (((a.i + b.i) + c.i) + d.i); 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; @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() { fn f() {
let x : i32 = (((a.i + b.i) + c.i) + d.i); 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; @group(5) @binding(4) var<storage, read> d : S;
@stage(compute) @workgroup_size(1) @compute @workgroup_size(1)
fn f1() { fn f1() {
let x : i32 = (a.i + c.i); let x : i32 = (a.i + c.i);
} }
@stage(compute) @workgroup_size(1) @compute @workgroup_size(1)
fn f2() { fn f2() {
let x : i32 = (b.i + d.i); let x : i32 = (b.i + d.i);
} }
@ -311,12 +311,12 @@ struct S {
@group(5) @binding(4) var<storage, read> d : S; @group(5) @binding(4) var<storage, read> d : S;
@stage(compute) @workgroup_size(1) @compute @workgroup_size(1)
fn f1() { fn f1() {
let x : i32 = (a.i + c.i); let x : i32 = (a.i + c.i);
} }
@stage(compute) @workgroup_size(1) @compute @workgroup_size(1)
fn f2() { fn f2() {
let x : i32 = (b.i + d.i); let x : i32 = (b.i + d.i);
} }
@ -345,7 +345,7 @@ struct S {
@group(3) @binding(2) var<storage, read> b : S; @group(3) @binding(2) var<storage, read> b : S;
@stage(compute) @workgroup_size(1) @compute @workgroup_size(1)
fn f() { fn f() {
} }
)"; )";

View File

@ -38,7 +38,7 @@ struct SB {
@group(0) @binding(0) var<storage, read> sb : SB; @group(0) @binding(0) var<storage, read> sb : SB;
@stage(compute) @workgroup_size(1) @compute @workgroup_size(1)
fn main() { fn main() {
} }
)"; )";
@ -55,7 +55,7 @@ struct SB {
@group(0) @binding(0) var<storage, read> sb : SB; @group(0) @binding(0) var<storage, read> sb : SB;
@stage(compute) @workgroup_size(1) @compute @workgroup_size(1)
fn main() { fn main() {
var len : u32 = arrayLength(&sb.arr); var len : u32 = arrayLength(&sb.arr);
} }
@ -68,7 +68,7 @@ TEST_F(CalculateArrayLengthTest, BasicArray) {
auto* src = R"( auto* src = R"(
@group(0) @binding(0) var<storage, read> sb : array<i32>; @group(0) @binding(0) var<storage, read> sb : array<i32>;
@stage(compute) @workgroup_size(1) @compute @workgroup_size(1)
fn main() { fn main() {
var len : u32 = arrayLength(&sb); 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>; @group(0) @binding(0) var<storage, read> sb : array<i32>;
@stage(compute) @workgroup_size(1) @compute @workgroup_size(1)
fn main() { fn main() {
var tint_symbol_1 : u32 = 0u; var tint_symbol_1 : u32 = 0u;
tint_symbol(sb, &(tint_symbol_1)); tint_symbol(sb, &(tint_symbol_1));
@ -103,7 +103,7 @@ struct SB {
@group(0) @binding(0) var<storage, read> sb : SB; @group(0) @binding(0) var<storage, read> sb : SB;
@stage(compute) @workgroup_size(1) @compute @workgroup_size(1)
fn main() { fn main() {
var len : u32 = arrayLength(&sb.arr); var len : u32 = arrayLength(&sb.arr);
} }
@ -120,7 +120,7 @@ struct SB {
@group(0) @binding(0) var<storage, read> sb : SB; @group(0) @binding(0) var<storage, read> sb : SB;
@stage(compute) @workgroup_size(1) @compute @workgroup_size(1)
fn main() { fn main() {
var tint_symbol_1 : u32 = 0u; var tint_symbol_1 : u32 = 0u;
tint_symbol(sb, &(tint_symbol_1)); tint_symbol(sb, &(tint_symbol_1));
@ -142,7 +142,7 @@ struct S {
@group(0) @binding(0) var<storage, read> arr : array<S>; @group(0) @binding(0) var<storage, read> arr : array<S>;
@stage(compute) @workgroup_size(1) @compute @workgroup_size(1)
fn main() { fn main() {
let len = arrayLength(&arr); let len = arrayLength(&arr);
} }
@ -157,7 +157,7 @@ struct S {
@group(0) @binding(0) var<storage, read> arr : array<S>; @group(0) @binding(0) var<storage, read> arr : array<S>;
@stage(compute) @workgroup_size(1) @compute @workgroup_size(1)
fn main() { fn main() {
var tint_symbol_1 : u32 = 0u; var tint_symbol_1 : u32 = 0u;
tint_symbol(arr, &(tint_symbol_1)); tint_symbol(arr, &(tint_symbol_1));
@ -179,7 +179,7 @@ struct S {
@group(0) @binding(0) var<storage, read> arr : array<array<S, 4>>; @group(0) @binding(0) var<storage, read> arr : array<array<S, 4>>;
@stage(compute) @workgroup_size(1) @compute @workgroup_size(1)
fn main() { fn main() {
let len = arrayLength(&arr); let len = arrayLength(&arr);
} }
@ -194,7 +194,7 @@ struct S {
@group(0) @binding(0) var<storage, read> arr : array<array<S, 4>>; @group(0) @binding(0) var<storage, read> arr : array<array<S, 4>>;
@stage(compute) @workgroup_size(1) @compute @workgroup_size(1)
fn main() { fn main() {
var tint_symbol_1 : u32 = 0u; var tint_symbol_1 : u32 = 0u;
tint_symbol(arr, &(tint_symbol_1)); tint_symbol(arr, &(tint_symbol_1));
@ -212,7 +212,7 @@ TEST_F(CalculateArrayLengthTest, InSameBlock) {
auto* src = R"( auto* src = R"(
@group(0) @binding(0) var<storage, read> sb : array<i32>;; @group(0) @binding(0) var<storage, read> sb : array<i32>;;
@stage(compute) @workgroup_size(1) @compute @workgroup_size(1)
fn main() { fn main() {
var a : u32 = arrayLength(&sb); var a : u32 = arrayLength(&sb);
var b : 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>; @group(0) @binding(0) var<storage, read> sb : array<i32>;
@stage(compute) @workgroup_size(1) @compute @workgroup_size(1)
fn main() { fn main() {
var tint_symbol_1 : u32 = 0u; var tint_symbol_1 : u32 = 0u;
tint_symbol(sb, &(tint_symbol_1)); tint_symbol(sb, &(tint_symbol_1));
@ -251,7 +251,7 @@ struct SB {
@group(0) @binding(0) var<storage, read> sb : SB; @group(0) @binding(0) var<storage, read> sb : SB;
@stage(compute) @workgroup_size(1) @compute @workgroup_size(1)
fn main() { fn main() {
var a : u32 = arrayLength(&sb.arr); var a : u32 = arrayLength(&sb.arr);
var b : 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; @group(0) @binding(0) var<storage, read> sb : SB;
@stage(compute) @workgroup_size(1) @compute @workgroup_size(1)
fn main() { fn main() {
var tint_symbol_1 : u32 = 0u; var tint_symbol_1 : u32 = 0u;
tint_symbol(sb, &(tint_symbol_1)); tint_symbol(sb, &(tint_symbol_1));
@ -295,7 +295,7 @@ struct SB {
@group(0) @binding(0) var<storage, read> sb : SB; @group(0) @binding(0) var<storage, read> sb : SB;
@stage(compute) @workgroup_size(1) @compute @workgroup_size(1)
fn main() { fn main() {
if (true) { if (true) {
var len : u32 = arrayLength(&sb.arr); var len : u32 = arrayLength(&sb.arr);
@ -318,7 +318,7 @@ struct SB {
@group(0) @binding(0) var<storage, read> sb : SB; @group(0) @binding(0) var<storage, read> sb : SB;
@stage(compute) @workgroup_size(1) @compute @workgroup_size(1)
fn main() { fn main() {
if (true) { if (true) {
var tint_symbol_1 : u32 = 0u; var tint_symbol_1 : u32 = 0u;
@ -359,7 +359,7 @@ struct SB2 {
@group(0) @binding(2) var<storage, read> sb3 : array<i32>; @group(0) @binding(2) var<storage, read> sb3 : array<i32>;
@stage(compute) @workgroup_size(1) @compute @workgroup_size(1)
fn main() { fn main() {
var len1 : u32 = arrayLength(&(sb1.arr1)); var len1 : u32 = arrayLength(&(sb1.arr1));
var len2 : u32 = arrayLength(&(sb2.arr2)); var len2 : u32 = arrayLength(&(sb2.arr2));
@ -394,7 +394,7 @@ struct SB2 {
@group(0) @binding(2) var<storage, read> sb3 : array<i32>; @group(0) @binding(2) var<storage, read> sb3 : array<i32>;
@stage(compute) @workgroup_size(1) @compute @workgroup_size(1)
fn main() { fn main() {
var tint_symbol_1 : u32 = 0u; var tint_symbol_1 : u32 = 0u;
tint_symbol(sb1, &(tint_symbol_1)); tint_symbol(sb1, &(tint_symbol_1));
@ -427,7 +427,7 @@ struct SB {
@group(0) @binding(0) var<storage, read> a : SB; @group(0) @binding(0) var<storage, read> a : SB;
@group(0) @binding(1) var<storage, read> b : SB; @group(0) @binding(1) var<storage, read> b : SB;
@stage(compute) @workgroup_size(1) @compute @workgroup_size(1)
fn main() { fn main() {
let x = &a; let x = &a;
var a : u32 = arrayLength(&a.arr); var a : u32 = arrayLength(&a.arr);
@ -451,7 +451,7 @@ struct SB {
@group(0) @binding(1) var<storage, read> b : SB; @group(0) @binding(1) var<storage, read> b : SB;
@stage(compute) @workgroup_size(1) @compute @workgroup_size(1)
fn main() { fn main() {
var tint_symbol_1 : u32 = 0u; var tint_symbol_1 : u32 = 0u;
tint_symbol(a, &(tint_symbol_1)); tint_symbol(a, &(tint_symbol_1));
@ -473,7 +473,7 @@ fn main() {
TEST_F(CalculateArrayLengthTest, OutOfOrder) { TEST_F(CalculateArrayLengthTest, OutOfOrder) {
auto* src = R"( auto* src = R"(
@stage(compute) @workgroup_size(1) @compute @workgroup_size(1)
fn main() { fn main() {
var len1 : u32 = arrayLength(&(sb1.arr1)); var len1 : u32 = arrayLength(&(sb1.arr1));
var len2 : u32 = arrayLength(&(sb2.arr2)); 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) @internal(intrinsic_buffer_size)
fn tint_symbol_6(@internal(disable_validation__ignore_constructible_function_parameter) buffer : array<i32>, result : ptr<function, u32>) 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() { fn main() {
var tint_symbol_1 : u32 = 0u; var tint_symbol_1 : u32 = 0u;
tint_symbol(sb1, &(tint_symbol_1)); 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; @group(0) @binding(0) var<storage, read_write> sb : SB;
@stage(compute) @workgroup_size(1) @compute @workgroup_size(1)
fn main() { fn main() {
var a : i32 = sb.a; var a : i32 = sb.a;
var b : u32 = sb.b; var b : u32 = sb.b;
@ -213,7 +213,7 @@ fn tint_symbol_21(@internal(disable_validation__ignore_constructible_function_pa
return arr; return arr;
} }
@stage(compute) @workgroup_size(1) @compute @workgroup_size(1)
fn main() { fn main() {
var a : i32 = tint_symbol(sb, 0u); var a : i32 = tint_symbol(sb, 0u);
var b : u32 = tint_symbol_1(sb, 4u); var b : u32 = tint_symbol_1(sb, 4u);
@ -247,7 +247,7 @@ fn main() {
TEST_F(DecomposeMemoryAccessTest, SB_BasicLoad_OutOfOrder) { TEST_F(DecomposeMemoryAccessTest, SB_BasicLoad_OutOfOrder) {
auto* src = R"( auto* src = R"(
@stage(compute) @workgroup_size(1) @compute @workgroup_size(1)
fn main() { fn main() {
var a : i32 = sb.a; var a : i32 = sb.a;
var b : u32 = sb.b; var b : u32 = sb.b;
@ -382,7 +382,7 @@ fn tint_symbol_21(@internal(disable_validation__ignore_constructible_function_pa
return arr; return arr;
} }
@stage(compute) @workgroup_size(1) @compute @workgroup_size(1)
fn main() { fn main() {
var a : i32 = tint_symbol(sb, 0u); var a : i32 = tint_symbol(sb, 0u);
var b : u32 = tint_symbol_1(sb, 4u); var b : u32 = tint_symbol_1(sb, 4u);
@ -470,7 +470,7 @@ struct UB {
@group(0) @binding(0) var<uniform> ub : UB; @group(0) @binding(0) var<uniform> ub : UB;
@stage(compute) @workgroup_size(1) @compute @workgroup_size(1)
fn main() { fn main() {
var a : i32 = ub.a; var a : i32 = ub.a;
var b : u32 = ub.b; var b : u32 = ub.b;
@ -605,7 +605,7 @@ fn tint_symbol_21(@internal(disable_validation__ignore_constructible_function_pa
return arr; return arr;
} }
@stage(compute) @workgroup_size(1) @compute @workgroup_size(1)
fn main() { fn main() {
var a : i32 = tint_symbol(ub, 0u); var a : i32 = tint_symbol(ub, 0u);
var b : u32 = tint_symbol_1(ub, 4u); var b : u32 = tint_symbol_1(ub, 4u);
@ -639,7 +639,7 @@ fn main() {
TEST_F(DecomposeMemoryAccessTest, UB_BasicLoad_OutOfOrder) { TEST_F(DecomposeMemoryAccessTest, UB_BasicLoad_OutOfOrder) {
auto* src = R"( auto* src = R"(
@stage(compute) @workgroup_size(1) @compute @workgroup_size(1)
fn main() { fn main() {
var a : i32 = ub.a; var a : i32 = ub.a;
var b : u32 = ub.b; var b : u32 = ub.b;
@ -774,7 +774,7 @@ fn tint_symbol_21(@internal(disable_validation__ignore_constructible_function_pa
return arr; return arr;
} }
@stage(compute) @workgroup_size(1) @compute @workgroup_size(1)
fn main() { fn main() {
var a : i32 = tint_symbol(ub, 0u); var a : i32 = tint_symbol(ub, 0u);
var b : u32 = tint_symbol_1(ub, 4u); var b : u32 = tint_symbol_1(ub, 4u);
@ -862,7 +862,7 @@ struct SB {
@group(0) @binding(0) var<storage, read_write> sb : SB; @group(0) @binding(0) var<storage, read_write> sb : SB;
@stage(compute) @workgroup_size(1) @compute @workgroup_size(1)
fn main() { fn main() {
sb.a = i32(); sb.a = i32();
sb.b = u32(); 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() { fn main() {
tint_symbol(sb, 0u, i32()); tint_symbol(sb, 0u, i32());
tint_symbol_1(sb, 4u, u32()); tint_symbol_1(sb, 4u, u32());
@ -1048,7 +1048,7 @@ fn main() {
TEST_F(DecomposeMemoryAccessTest, SB_BasicStore_OutOfOrder) { TEST_F(DecomposeMemoryAccessTest, SB_BasicStore_OutOfOrder) {
auto* src = R"( auto* src = R"(
@stage(compute) @workgroup_size(1) @compute @workgroup_size(1)
fn main() { fn main() {
sb.a = i32(); sb.a = i32();
sb.b = u32(); 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() { fn main() {
tint_symbol(sb, 0u, i32()); tint_symbol(sb, 0u, i32());
tint_symbol_1(sb, 4u, u32()); tint_symbol_1(sb, 4u, u32());
@ -1288,7 +1288,7 @@ struct SB {
@group(0) @binding(0) var<storage, read_write> sb : SB; @group(0) @binding(0) var<storage, read_write> sb : SB;
@stage(compute) @workgroup_size(1) @compute @workgroup_size(1)
fn main() { fn main() {
var x : SB = sb; 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))); 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() { fn main() {
var x : SB = tint_symbol(sb, 0u); var x : SB = tint_symbol(sb, 0u);
} }
@ -1419,7 +1419,7 @@ fn main() {
TEST_F(DecomposeMemoryAccessTest, LoadStructure_OutOfOrder) { TEST_F(DecomposeMemoryAccessTest, LoadStructure_OutOfOrder) {
auto* src = R"( auto* src = R"(
@stage(compute) @workgroup_size(1) @compute @workgroup_size(1)
fn main() { fn main() {
var x : SB = sb; 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))); 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() { fn main() {
var x : SB = tint_symbol(sb, 0u); var x : SB = tint_symbol(sb, 0u);
} }
@ -1604,7 +1604,7 @@ struct SB {
@group(0) @binding(0) var<storage, read_write> sb : SB; @group(0) @binding(0) var<storage, read_write> sb : SB;
@stage(compute) @workgroup_size(1) @compute @workgroup_size(1)
fn main() { fn main() {
sb = SB(); sb = SB();
} }
@ -1760,7 +1760,7 @@ fn tint_symbol(@internal(disable_validation__ignore_constructible_function_param
tint_symbol_22(buffer, (offset + 512u), value.v); tint_symbol_22(buffer, (offset + 512u), value.v);
} }
@stage(compute) @workgroup_size(1) @compute @workgroup_size(1)
fn main() { fn main() {
tint_symbol(sb, 0u, SB()); tint_symbol(sb, 0u, SB());
} }
@ -1773,7 +1773,7 @@ fn main() {
TEST_F(DecomposeMemoryAccessTest, StoreStructure_OutOfOrder) { TEST_F(DecomposeMemoryAccessTest, StoreStructure_OutOfOrder) {
auto* src = R"( auto* src = R"(
@stage(compute) @workgroup_size(1) @compute @workgroup_size(1)
fn main() { fn main() {
sb = SB(); sb = SB();
} }
@ -1929,7 +1929,7 @@ fn tint_symbol(@internal(disable_validation__ignore_constructible_function_param
tint_symbol_22(buffer, (offset + 512u), value.v); tint_symbol_22(buffer, (offset + 512u), value.v);
} }
@stage(compute) @workgroup_size(1) @compute @workgroup_size(1)
fn main() { fn main() {
tint_symbol(sb, 0u, SB()); tint_symbol(sb, 0u, SB());
} }
@ -1993,7 +1993,7 @@ struct SB {
@group(0) @binding(0) var<storage, read_write> sb : SB; @group(0) @binding(0) var<storage, read_write> sb : SB;
@stage(compute) @workgroup_size(1) @compute @workgroup_size(1)
fn main() { fn main() {
var x : f32 = sb.b[4].b[1].b.z; 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) @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 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() { fn main() {
var x : f32 = tint_symbol(sb, 712u); var x : f32 = tint_symbol(sb, 712u);
} }
@ -2043,7 +2043,7 @@ fn main() {
TEST_F(DecomposeMemoryAccessTest, ComplexStaticAccessChain_OutOfOrder) { TEST_F(DecomposeMemoryAccessTest, ComplexStaticAccessChain_OutOfOrder) {
auto* src = R"( auto* src = R"(
@stage(compute) @workgroup_size(1) @compute @workgroup_size(1)
fn main() { fn main() {
var x : f32 = sb.b[4].b[1].b.z; 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) @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 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() { fn main() {
var x : f32 = tint_symbol(sb, 712u); var x : f32 = tint_symbol(sb, 712u);
} }
@ -2133,7 +2133,7 @@ struct SB {
@group(0) @binding(0) var<storage, read_write> sb : SB; @group(0) @binding(0) var<storage, read_write> sb : SB;
@stage(compute) @workgroup_size(1) @compute @workgroup_size(1)
fn main() { fn main() {
var i : i32 = 4; var i : i32 = 4;
var j : u32 = 1u; var j : u32 = 1u;
@ -2166,7 +2166,7 @@ struct SB {
@internal(intrinsic_load_storage_f32) @internal(disable_validation__function_has_no_body) @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 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() { fn main() {
var i : i32 = 4; var i : i32 = 4;
var j : u32 = 1u; var j : u32 = 1u;
@ -2182,7 +2182,7 @@ fn main() {
TEST_F(DecomposeMemoryAccessTest, ComplexDynamicAccessChain_OutOfOrder) { TEST_F(DecomposeMemoryAccessTest, ComplexDynamicAccessChain_OutOfOrder) {
auto* src = R"( auto* src = R"(
@stage(compute) @workgroup_size(1) @compute @workgroup_size(1)
fn main() { fn main() {
var i : i32 = 4; var i : i32 = 4;
var j : u32 = 1u; var j : u32 = 1u;
@ -2215,7 +2215,7 @@ struct S1 {
@internal(intrinsic_load_storage_f32) @internal(disable_validation__function_has_no_body) @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 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() { fn main() {
var i : i32 = 4; var i : i32 = 4;
var j : u32 = 1u; var j : u32 = 1u;
@ -2279,7 +2279,7 @@ struct SB {
@group(0) @binding(0) var<storage, read_write> sb : SB; @group(0) @binding(0) var<storage, read_write> sb : SB;
@stage(compute) @workgroup_size(1) @compute @workgroup_size(1)
fn main() { fn main() {
var i : i32 = 4; var i : i32 = 4;
var j : u32 = 1u; var j : u32 = 1u;
@ -2320,7 +2320,7 @@ struct SB {
@internal(intrinsic_load_storage_f32) @internal(disable_validation__function_has_no_body) @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 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() { fn main() {
var i : i32 = 4; var i : i32 = 4;
var j : u32 = 1u; var j : u32 = 1u;
@ -2336,7 +2336,7 @@ fn main() {
TEST_F(DecomposeMemoryAccessTest, ComplexDynamicAccessChainWithAliases_OutOfOrder) { TEST_F(DecomposeMemoryAccessTest, ComplexDynamicAccessChainWithAliases_OutOfOrder) {
auto* src = R"( auto* src = R"(
@stage(compute) @workgroup_size(1) @compute @workgroup_size(1)
fn main() { fn main() {
var i : i32 = 4; var i : i32 = 4;
var j : u32 = 1u; var j : u32 = 1u;
@ -2377,7 +2377,7 @@ struct S1 {
@internal(intrinsic_load_storage_f32) @internal(disable_validation__function_has_no_body) @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 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() { fn main() {
var i : i32 = 4; var i : i32 = 4;
var j : u32 = 1u; var j : u32 = 1u;
@ -2429,7 +2429,7 @@ struct SB {
@group(0) @binding(0) var<storage, read_write> sb : SB; @group(0) @binding(0) var<storage, read_write> sb : SB;
@stage(compute) @workgroup_size(1) @compute @workgroup_size(1)
fn main() { fn main() {
atomicStore(&sb.a, 123); atomicStore(&sb.a, 123);
atomicLoad(&sb.a); 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) @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 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() { fn main() {
tint_atomicStore(sb, 16u, 123); tint_atomicStore(sb, 16u, 123);
tint_atomicLoad(sb, 16u); tint_atomicLoad(sb, 16u);
@ -2576,7 +2576,7 @@ fn main() {
TEST_F(DecomposeMemoryAccessTest, StorageBufferAtomics_OutOfOrder) { TEST_F(DecomposeMemoryAccessTest, StorageBufferAtomics_OutOfOrder) {
auto* src = R"( auto* src = R"(
@stage(compute) @workgroup_size(1) @compute @workgroup_size(1)
fn main() { fn main() {
atomicStore(&sb.a, 123); atomicStore(&sb.a, 123);
atomicLoad(&sb.a); 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) @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 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() { fn main() {
tint_atomicStore(sb, 16u, 123); tint_atomicStore(sb, 16u, 123);
tint_atomicLoad(sb, 16u); tint_atomicLoad(sb, 16u);
@ -2739,7 +2739,7 @@ struct S {
var<workgroup> w : S; var<workgroup> w : S;
@stage(compute) @workgroup_size(1) @compute @workgroup_size(1)
fn main() { fn main() {
atomicStore(&(w.a), 123); atomicStore(&(w.a), 123);
atomicLoad(&(w.a)); atomicLoad(&(w.a));
@ -2775,7 +2775,7 @@ fn main() {
TEST_F(DecomposeMemoryAccessTest, WorkgroupBufferAtomics_OutOfOrder) { TEST_F(DecomposeMemoryAccessTest, WorkgroupBufferAtomics_OutOfOrder) {
auto* src = R"( auto* src = R"(
@stage(compute) @workgroup_size(1) @compute @workgroup_size(1)
fn main() { fn main() {
atomicStore(&(w.a), 123); atomicStore(&(w.a), 123);
atomicLoad(&(w.a)); atomicLoad(&(w.a));

View File

@ -71,7 +71,7 @@ TEST_F(DecomposeStridedArrayTest, Empty) {
TEST_F(DecomposeStridedArrayTest, PrivateDefaultStridedArray) { TEST_F(DecomposeStridedArrayTest, PrivateDefaultStridedArray) {
// var<private> arr : @stride(4) array<f32, 4u> // var<private> arr : @stride(4) array<f32, 4u>
// //
// @stage(compute) @workgroup_size(1) // @compute @workgroup_size(1)
// fn f() { // fn f() {
// let a : @stride(4) array<f32, 4u> = a; // let a : @stride(4) array<f32, 4u> = a;
// let b : f32 = arr[1]; // let b : f32 = arr[1];
@ -92,7 +92,7 @@ TEST_F(DecomposeStridedArrayTest, PrivateDefaultStridedArray) {
auto* expect = R"( auto* expect = R"(
var<private> arr : array<f32, 4u>; var<private> arr : array<f32, 4u>;
@stage(compute) @workgroup_size(1i) @compute @workgroup_size(1i)
fn f() { fn f() {
let a : array<f32, 4u> = arr; let a : array<f32, 4u> = arr;
let b : f32 = arr[1i]; let b : f32 = arr[1i];
@ -107,7 +107,7 @@ fn f() {
TEST_F(DecomposeStridedArrayTest, PrivateStridedArray) { TEST_F(DecomposeStridedArrayTest, PrivateStridedArray) {
// var<private> arr : @stride(32) array<f32, 4u> // var<private> arr : @stride(32) array<f32, 4u>
// //
// @stage(compute) @workgroup_size(1) // @compute @workgroup_size(1)
// fn f() { // fn f() {
// let a : @stride(32) array<f32, 4u> = a; // let a : @stride(32) array<f32, 4u> = a;
// let b : f32 = arr[1]; // let b : f32 = arr[1];
@ -133,7 +133,7 @@ struct strided_arr {
var<private> arr : array<strided_arr, 4u>; var<private> arr : array<strided_arr, 4u>;
@stage(compute) @workgroup_size(1i) @compute @workgroup_size(1i)
fn f() { fn f() {
let a : array<strided_arr, 4u> = arr; let a : array<strided_arr, 4u> = arr;
let b : f32 = arr[1i].el; let b : f32 = arr[1i].el;
@ -151,7 +151,7 @@ TEST_F(DecomposeStridedArrayTest, ReadUniformStridedArray) {
// }; // };
// @group(0) @binding(0) var<uniform> s : S; // @group(0) @binding(0) var<uniform> s : S;
// //
// @stage(compute) @workgroup_size(1) // @compute @workgroup_size(1)
// fn f() { // fn f() {
// let a : @stride(32) array<f32, 4u> = s.a; // let a : @stride(32) array<f32, 4u> = s.a;
// let b : f32 = s.a[1]; // let b : f32 = s.a[1];
@ -181,7 +181,7 @@ struct S {
@group(0) @binding(0) var<uniform> s : S; @group(0) @binding(0) var<uniform> s : S;
@stage(compute) @workgroup_size(1i) @compute @workgroup_size(1i)
fn f() { fn f() {
let a : array<strided_arr, 4u> = s.a; let a : array<strided_arr, 4u> = s.a;
let b : f32 = s.a[1i].el; let b : f32 = s.a[1i].el;
@ -199,7 +199,7 @@ TEST_F(DecomposeStridedArrayTest, ReadUniformDefaultStridedArray) {
// }; // };
// @group(0) @binding(0) var<uniform> s : S; // @group(0) @binding(0) var<uniform> s : S;
// //
// @stage(compute) @workgroup_size(1) // @compute @workgroup_size(1)
// fn f() { // fn f() {
// let a : @stride(16) array<vec4<f32>, 4u> = s.a; // let a : @stride(16) array<vec4<f32>, 4u> = s.a;
// let b : f32 = s.a[1][2]; // let b : f32 = s.a[1][2];
@ -227,7 +227,7 @@ struct S {
@group(0) @binding(0) var<uniform> s : S; @group(0) @binding(0) var<uniform> s : S;
@stage(compute) @workgroup_size(1i) @compute @workgroup_size(1i)
fn f() { fn f() {
let a : array<vec4<f32>, 4u> = s.a; let a : array<vec4<f32>, 4u> = s.a;
let b : f32 = s.a[1i][2i]; let b : f32 = s.a[1i][2i];
@ -245,7 +245,7 @@ TEST_F(DecomposeStridedArrayTest, ReadStorageStridedArray) {
// }; // };
// @group(0) @binding(0) var<storage> s : S; // @group(0) @binding(0) var<storage> s : S;
// //
// @stage(compute) @workgroup_size(1) // @compute @workgroup_size(1)
// fn f() { // fn f() {
// let a : @stride(32) array<f32, 4u> = s.a; // let a : @stride(32) array<f32, 4u> = s.a;
// let b : f32 = s.a[1]; // let b : f32 = s.a[1];
@ -275,7 +275,7 @@ struct S {
@group(0) @binding(0) var<storage> s : S; @group(0) @binding(0) var<storage> s : S;
@stage(compute) @workgroup_size(1i) @compute @workgroup_size(1i)
fn f() { fn f() {
let a : array<strided_arr, 4u> = s.a; let a : array<strided_arr, 4u> = s.a;
let b : f32 = s.a[1i].el; let b : f32 = s.a[1i].el;
@ -293,7 +293,7 @@ TEST_F(DecomposeStridedArrayTest, ReadStorageDefaultStridedArray) {
// }; // };
// @group(0) @binding(0) var<storage> s : S; // @group(0) @binding(0) var<storage> s : S;
// //
// @stage(compute) @workgroup_size(1) // @compute @workgroup_size(1)
// fn f() { // fn f() {
// let a : @stride(4) array<f32, 4u> = s.a; // let a : @stride(4) array<f32, 4u> = s.a;
// let b : f32 = s.a[1]; // let b : f32 = s.a[1];
@ -318,7 +318,7 @@ struct S {
@group(0) @binding(0) var<storage> s : S; @group(0) @binding(0) var<storage> s : S;
@stage(compute) @workgroup_size(1i) @compute @workgroup_size(1i)
fn f() { fn f() {
let a : array<f32, 4u> = s.a; let a : array<f32, 4u> = s.a;
let b : f32 = s.a[1i]; let b : f32 = s.a[1i];
@ -336,7 +336,7 @@ TEST_F(DecomposeStridedArrayTest, WriteStorageStridedArray) {
// }; // };
// @group(0) @binding(0) var<storage, read_write> s : S; // @group(0) @binding(0) var<storage, read_write> s : S;
// //
// @stage(compute) @workgroup_size(1) // @compute @workgroup_size(1)
// fn f() { // fn f() {
// s.a = @stride(32) array<f32, 4u>(); // s.a = @stride(32) array<f32, 4u>();
// s.a = @stride(32) array<f32, 4u>(1.0, 2.0, 3.0, 4.0); // 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; @group(0) @binding(0) var<storage, read_write> s : S;
@stage(compute) @workgroup_size(1i) @compute @workgroup_size(1i)
fn f() { fn f() {
s.a = array<strided_arr, 4u>(); 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)); 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; // @group(0) @binding(0) var<storage, read_write> s : S;
// //
// @stage(compute) @workgroup_size(1) // @compute @workgroup_size(1)
// fn f() { // fn f() {
// s.a = @stride(4) array<f32, 4u>(); // s.a = @stride(4) array<f32, 4u>();
// s.a = @stride(4) array<f32, 4u>(1.0, 2.0, 3.0, 4.0); // 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; @group(0) @binding(0) var<storage, read_write> s : S;
@stage(compute) @workgroup_size(1i) @compute @workgroup_size(1i)
fn f() { fn f() {
s.a = array<f32, 4u>(); s.a = array<f32, 4u>();
s.a = array<f32, 4u>(1.0f, 2.0f, 3.0f, 4.0f); 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; // @group(0) @binding(0) var<storage, read_write> s : S;
// //
// @stage(compute) @workgroup_size(1) // @compute @workgroup_size(1)
// fn f() { // fn f() {
// let a = &s.a; // let a = &s.a;
// let b = &*&*(a); // let b = &*&*(a);
@ -479,7 +479,7 @@ struct S {
@group(0) @binding(0) var<storage, read_write> s : S; @group(0) @binding(0) var<storage, read_write> s : S;
@stage(compute) @workgroup_size(1i) @compute @workgroup_size(1i)
fn f() { fn f() {
let c = s.a; let c = s.a;
let d = s.a[1i].el; let d = s.a[1i].el;
@ -500,7 +500,7 @@ TEST_F(DecomposeStridedArrayTest, PrivateAliasedStridedArray) {
// }; // };
// @group(0) @binding(0) var<storage, read_write> s : S; // @group(0) @binding(0) var<storage, read_write> s : S;
// //
// @stage(compute) @workgroup_size(1) // @compute @workgroup_size(1)
// fn f() { // fn f() {
// let a : ARR = s.a; // let a : ARR = s.a;
// let b : f32 = s.a[1]; // let b : f32 = s.a[1];
@ -541,7 +541,7 @@ struct S {
@group(0) @binding(0) var<storage, read_write> s : S; @group(0) @binding(0) var<storage, read_write> s : S;
@stage(compute) @workgroup_size(1i) @compute @workgroup_size(1i)
fn f() { fn f() {
let a : ARR = s.a; let a : ARR = s.a;
let b : f32 = s.a[1i].el; 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; // @group(0) @binding(0) var<storage, read_write> s : S;
// //
// @stage(compute) @workgroup_size(1) // @compute @workgroup_size(1)
// fn f() { // fn f() {
// let a : ARR_B = s.a; // let a : ARR_B = s.a;
// let b : array<@stride(8) array<f32, 2u>, 3u> = s.a[3]; // 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; @group(0) @binding(0) var<storage, read_write> s : S;
@stage(compute) @workgroup_size(1i) @compute @workgroup_size(1i)
fn f() { fn f() {
let a : ARR_B = s.a; let a : ARR_B = s.a;
let b : array<ARR_A, 3u> = s.a[3i].el; 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; // @group(0) @binding(0) var<uniform> s : S;
// //
// @stage(compute) @workgroup_size(1) // @compute @workgroup_size(1)
// fn f() { // fn f() {
// let x : mat2x2<f32> = s.m; // 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]); return mat2x2<f32>(arr[0u], arr[1u]);
} }
@stage(compute) @workgroup_size(1i) @compute @workgroup_size(1i)
fn f() { fn f() {
let x : mat2x2<f32> = arr_to_mat2x2_stride_32(s.m); 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; // @group(0) @binding(0) var<uniform> s : S;
// //
// @stage(compute) @workgroup_size(1) // @compute @workgroup_size(1)
// fn f() { // fn f() {
// let x : vec2<f32> = s.m[1]; // let x : vec2<f32> = s.m[1];
// } // }
@ -152,7 +152,7 @@ struct S {
@group(0) @binding(0) var<uniform> s : S; @group(0) @binding(0) var<uniform> s : S;
@stage(compute) @workgroup_size(1i) @compute @workgroup_size(1i)
fn f() { fn f() {
let x : vec2<f32> = s.m[1i]; let x : vec2<f32> = s.m[1i];
} }
@ -171,7 +171,7 @@ TEST_F(DecomposeStridedMatrixTest, ReadUniformMatrix_DefaultStride) {
// }; // };
// @group(0) @binding(0) var<uniform> s : S; // @group(0) @binding(0) var<uniform> s : S;
// //
// @stage(compute) @workgroup_size(1) // @compute @workgroup_size(1)
// fn f() { // fn f() {
// let x : mat2x2<f32> = s.m; // let x : mat2x2<f32> = s.m;
// } // }
@ -205,7 +205,7 @@ struct S {
@group(0) @binding(0) var<uniform> s : S; @group(0) @binding(0) var<uniform> s : S;
@stage(compute) @workgroup_size(1i) @compute @workgroup_size(1i)
fn f() { fn f() {
let x : mat2x2<f32> = s.m; let x : mat2x2<f32> = s.m;
} }
@ -224,7 +224,7 @@ TEST_F(DecomposeStridedMatrixTest, ReadStorageMatrix) {
// }; // };
// @group(0) @binding(0) var<storage, read_write> s : S; // @group(0) @binding(0) var<storage, read_write> s : S;
// //
// @stage(compute) @workgroup_size(1) // @compute @workgroup_size(1)
// fn f() { // fn f() {
// let x : mat2x2<f32> = s.m; // 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]); return mat2x2<f32>(arr[0u], arr[1u]);
} }
@stage(compute) @workgroup_size(1i) @compute @workgroup_size(1i)
fn f() { fn f() {
let x : mat2x2<f32> = arr_to_mat2x2_stride_32(s.m); 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; // @group(0) @binding(0) var<storage, read_write> s : S;
// //
// @stage(compute) @workgroup_size(1) // @compute @workgroup_size(1)
// fn f() { // fn f() {
// let x : vec2<f32> = s.m[1]; // let x : vec2<f32> = s.m[1];
// } // }
@ -316,7 +316,7 @@ struct S {
@group(0) @binding(0) var<storage, read_write> s : S; @group(0) @binding(0) var<storage, read_write> s : S;
@stage(compute) @workgroup_size(1i) @compute @workgroup_size(1i)
fn f() { fn f() {
let x : vec2<f32> = s.m[1i]; 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; // @group(0) @binding(0) var<storage, read_write> s : S;
// //
// @stage(compute) @workgroup_size(1) // @compute @workgroup_size(1)
// fn f() { // fn f() {
// s.m = mat2x2<f32>(vec2<f32>(1.0, 2.0), vec2<f32>(3.0, 4.0)); // 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]); return @stride(32) array<vec2<f32>, 2u>(m[0u], m[1u]);
} }
@stage(compute) @workgroup_size(1i) @compute @workgroup_size(1i)
fn f() { fn f() {
s.m = mat2x2_stride_32_to_arr(mat2x2<f32>(vec2<f32>(1.0f, 2.0f), vec2<f32>(3.0f, 4.0f))); 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; // @group(0) @binding(0) var<storage, read_write> s : S;
// //
// @stage(compute) @workgroup_size(1) // @compute @workgroup_size(1)
// fn f() { // fn f() {
// s.m[1] = vec2<f32>(1.0, 2.0); // 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; @group(0) @binding(0) var<storage, read_write> s : S;
@stage(compute) @workgroup_size(1i) @compute @workgroup_size(1i)
fn f() { fn f() {
s.m[1i] = vec2<f32>(1.0f, 2.0f); 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; // @group(0) @binding(0) var<storage, read_write> s : S;
// //
// @stage(compute) @workgroup_size(1) // @compute @workgroup_size(1)
// fn f() { // fn f() {
// let a = &s.m; // let a = &s.m;
// let b = &*&*(a); // 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]); return @stride(32) array<vec2<f32>, 2u>(m[0u], m[1u]);
} }
@stage(compute) @workgroup_size(1i) @compute @workgroup_size(1i)
fn f() { fn f() {
let x = arr_to_mat2x2_stride_32(s.m); let x = arr_to_mat2x2_stride_32(s.m);
let y = s.m[1i]; let y = s.m[1i];
@ -523,7 +523,7 @@ TEST_F(DecomposeStridedMatrixTest, ReadPrivateMatrix) {
// }; // };
// var<private> s : S; // var<private> s : S;
// //
// @stage(compute) @workgroup_size(1) // @compute @workgroup_size(1)
// fn f() { // fn f() {
// let x : mat2x2<f32> = s.m; // let x : mat2x2<f32> = s.m;
// } // }
@ -557,7 +557,7 @@ struct S {
var<private> s : S; var<private> s : S;
@stage(compute) @workgroup_size(1i) @compute @workgroup_size(1i)
fn f() { fn f() {
let x : mat2x2<f32> = s.m; let x : mat2x2<f32> = s.m;
} }
@ -576,7 +576,7 @@ TEST_F(DecomposeStridedMatrixTest, WritePrivateMatrix) {
// }; // };
// var<private> s : S; // var<private> s : S;
// //
// @stage(compute) @workgroup_size(1) // @compute @workgroup_size(1)
// fn f() { // fn f() {
// s.m = mat2x2<f32>(vec2<f32>(1.0, 2.0), vec2<f32>(3.0, 4.0)); // 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; var<private> s : S;
@stage(compute) @workgroup_size(1i) @compute @workgroup_size(1i)
fn f() { fn f() {
s.m = mat2x2<f32>(vec2<f32>(1.0f, 2.0f), vec2<f32>(3.0f, 4.0f)); 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"( auto* src = R"(
@group(0) @binding(0) var<storage, read> global : i32; @group(0) @binding(0) var<storage, read> global : i32;
@stage(compute) @workgroup_size(64) @compute @workgroup_size(64)
fn main() { fn main() {
if ((global == 42)) { if ((global == 42)) {
workgroupBarrier(); workgroupBarrier();

View File

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

View File

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

View File

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

View File

@ -56,7 +56,7 @@ TEST_F(MultiplanarExternalTextureTest, ErrorNoPassedData) {
@group(0) @binding(0) var s : sampler; @group(0) @binding(0) var s : sampler;
@group(0) @binding(1) var ext_tex : texture_external; @group(0) @binding(1) var ext_tex : texture_external;
@stage(fragment) @fragment
fn main(@builtin(position) coord : vec4<f32>) -> @location(0) vec4<f32> { fn main(@builtin(position) coord : vec4<f32>) -> @location(0) vec4<f32> {
return textureSampleLevel(ext_tex, s, coord.xy); 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(0) var s : sampler;
@group(0) @binding(1) var ext_tex : texture_external; @group(0) @binding(1) var ext_tex : texture_external;
@stage(fragment) @fragment
fn main(@builtin(position) coord : vec4<f32>) -> @location(0) vec4<f32> { fn main(@builtin(position) coord : vec4<f32>) -> @location(0) vec4<f32> {
return textureSampleLevel(ext_tex, s, coord.xy); return textureSampleLevel(ext_tex, s, coord.xy);
} }
@ -96,7 +96,7 @@ TEST_F(MultiplanarExternalTextureTest, Dimensions) {
auto* src = R"( auto* src = R"(
@group(0) @binding(0) var ext_tex : texture_external; @group(0) @binding(0) var ext_tex : texture_external;
@stage(fragment) @fragment
fn main(@builtin(position) coord : vec4<f32>) -> @location(0) vec4<f32> { fn main(@builtin(position) coord : vec4<f32>) -> @location(0) vec4<f32> {
var dim : vec2<i32>; var dim : vec2<i32>;
dim = textureDimensions(ext_tex); dim = textureDimensions(ext_tex);
@ -130,7 +130,7 @@ struct ExternalTextureParams {
@group(0) @binding(0) var ext_tex : texture_2d<f32>; @group(0) @binding(0) var ext_tex : texture_2d<f32>;
@stage(fragment) @fragment
fn main(@builtin(position) coord : vec4<f32>) -> @location(0) vec4<f32> { fn main(@builtin(position) coord : vec4<f32>) -> @location(0) vec4<f32> {
var dim : vec2<i32>; var dim : vec2<i32>;
dim = textureDimensions(ext_tex); 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. // Tests that the transform works with a textureDimensions call.
TEST_F(MultiplanarExternalTextureTest, Dimensions_OutOfOrder) { TEST_F(MultiplanarExternalTextureTest, Dimensions_OutOfOrder) {
auto* src = R"( auto* src = R"(
@stage(fragment) @fragment
fn main(@builtin(position) coord : vec4<f32>) -> @location(0) vec4<f32> { fn main(@builtin(position) coord : vec4<f32>) -> @location(0) vec4<f32> {
var dim : vec2<i32>; var dim : vec2<i32>;
dim = textureDimensions(ext_tex); dim = textureDimensions(ext_tex);
@ -182,7 +182,7 @@ struct ExternalTextureParams {
@group(0) @binding(2) var<uniform> ext_tex_params : 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> { fn main(@builtin(position) coord : vec4<f32>) -> @location(0) vec4<f32> {
var dim : vec2<i32>; var dim : vec2<i32>;
dim = textureDimensions(ext_tex); dim = textureDimensions(ext_tex);
@ -205,7 +205,7 @@ TEST_F(MultiplanarExternalTextureTest, BasicTextureSampleLevel) {
@group(0) @binding(0) var s : sampler; @group(0) @binding(0) var s : sampler;
@group(0) @binding(1) var ext_tex : texture_external; @group(0) @binding(1) var ext_tex : texture_external;
@stage(fragment) @fragment
fn main(@builtin(position) coord : vec4<f32>) -> @location(0) vec4<f32> { fn main(@builtin(position) coord : vec4<f32>) -> @location(0) vec4<f32> {
return textureSampleLevel(ext_tex, s, coord.xy); 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); return vec4<f32>(color, 1.0f);
} }
@stage(fragment) @fragment
fn main(@builtin(position) coord : vec4<f32>) -> @location(0) vec4<f32> { 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); 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 that the transform works with a textureSampleLevel call.
TEST_F(MultiplanarExternalTextureTest, BasicTextureSampleLevel_OutOfOrder) { TEST_F(MultiplanarExternalTextureTest, BasicTextureSampleLevel_OutOfOrder) {
auto* src = R"( auto* src = R"(
@stage(fragment) @fragment
fn main(@builtin(position) coord : vec4<f32>) -> @location(0) vec4<f32> { fn main(@builtin(position) coord : vec4<f32>) -> @location(0) vec4<f32> {
return textureSampleLevel(ext_tex, s, coord.xy); 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); return vec4<f32>(color, 1.0f);
} }
@stage(fragment) @fragment
fn main(@builtin(position) coord : vec4<f32>) -> @location(0) vec4<f32> { 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); 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"( auto* src = R"(
@group(0) @binding(0) var ext_tex : texture_external; @group(0) @binding(0) var ext_tex : texture_external;
@stage(fragment) @fragment
fn main(@builtin(position) coord : vec4<f32>) -> @location(0) vec4<f32> { fn main(@builtin(position) coord : vec4<f32>) -> @location(0) vec4<f32> {
return textureLoad(ext_tex, vec2<i32>(1, 1)); 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); return vec4<f32>(color, 1.0f);
} }
@stage(fragment) @fragment
fn main(@builtin(position) coord : vec4<f32>) -> @location(0) vec4<f32> { 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); 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. // Tests that the transform works with a textureLoad call.
TEST_F(MultiplanarExternalTextureTest, BasicTextureLoad_OutOfOrder) { TEST_F(MultiplanarExternalTextureTest, BasicTextureLoad_OutOfOrder) {
auto* src = R"( auto* src = R"(
@stage(fragment) @fragment
fn main(@builtin(position) coord : vec4<f32>) -> @location(0) vec4<f32> { fn main(@builtin(position) coord : vec4<f32>) -> @location(0) vec4<f32> {
return textureLoad(ext_tex, vec2<i32>(1, 1)); 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); return vec4<f32>(color, 1.0f);
} }
@stage(fragment) @fragment
fn main(@builtin(position) coord : vec4<f32>) -> @location(0) vec4<f32> { 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); 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(0) var s : sampler;
@group(0) @binding(1) var ext_tex : texture_external; @group(0) @binding(1) var ext_tex : texture_external;
@stage(fragment) @fragment
fn main(@builtin(position) coord : vec4<f32>) -> @location(0) vec4<f32> { 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)); 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); return vec4<f32>(color, 1.0f);
} }
@stage(fragment) @fragment
fn main(@builtin(position) coord : vec4<f32>) -> @location(0) vec4<f32> { 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)); 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. // call.
TEST_F(MultiplanarExternalTextureTest, TextureSampleAndTextureLoad_OutOfOrder) { TEST_F(MultiplanarExternalTextureTest, TextureSampleAndTextureLoad_OutOfOrder) {
auto* src = R"( auto* src = R"(
@stage(fragment) @fragment
fn main(@builtin(position) coord : vec4<f32>) -> @location(0) vec4<f32> { 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)); 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); return vec4<f32>(color, 1.0f);
} }
@stage(fragment) @fragment
fn main(@builtin(position) coord : vec4<f32>) -> @location(0) vec4<f32> { 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)); 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(0) @binding(3) var ext_tex_2 : texture_external;
@group(1) @binding(0) var ext_tex_3 : 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> { 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); 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); return vec4<f32>(color, 1.0f);
} }
@stage(fragment) @fragment
fn main(@builtin(position) coord : vec4<f32>) -> @location(0) vec4<f32> { 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)); 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(0) var ext_tex : texture_external;
@group(0) @binding(1) var smp : sampler; @group(0) @binding(1) var smp : sampler;
@stage(fragment) @fragment
fn main() { fn main() {
f(ext_tex, smp); 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; @group(0) @binding(1) var smp : sampler;
@stage(fragment) @fragment
fn main() { fn main() {
f(ext_tex, ext_tex_plane_1, ext_tex_params, smp); f(ext_tex, ext_tex_plane_1, ext_tex_params, smp);
} }
@ -843,7 +843,7 @@ fn main() {
// correct output. // correct output.
TEST_F(MultiplanarExternalTextureTest, ExternalTexturePassedAsParam_OutOfOrder) { TEST_F(MultiplanarExternalTextureTest, ExternalTexturePassedAsParam_OutOfOrder) {
auto* src = R"( auto* src = R"(
@stage(fragment) @fragment
fn main() { fn main() {
f(ext_tex, smp); f(ext_tex, smp);
} }
@ -880,7 +880,7 @@ struct ExternalTextureParams {
@group(0) @binding(3) var<uniform> ext_tex_params : ExternalTextureParams; @group(0) @binding(3) var<uniform> ext_tex_params : ExternalTextureParams;
@stage(fragment) @fragment
fn main() { fn main() {
f(ext_tex, ext_tex_plane_1, ext_tex_params, smp); 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(0) var ext_tex : texture_external;
@group(0) @binding(1) var smp : sampler; @group(0) @binding(1) var smp : sampler;
@stage(fragment) @fragment
fn main() { fn main() {
f(smp, ext_tex); 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; @group(0) @binding(1) var smp : sampler;
@stage(fragment) @fragment
fn main() { fn main() {
f(smp, ext_tex, ext_tex_plane_1, ext_tex_params); 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(1) var smp : sampler;
@group(0) @binding(2) var ext_tex2 : texture_external; @group(0) @binding(2) var ext_tex2 : texture_external;
@stage(fragment) @fragment
fn main() { fn main() {
f(ext_tex, smp, ext_tex2); 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>; @group(0) @binding(2) var ext_tex2 : texture_2d<f32>;
@stage(fragment) @fragment
fn main() { fn main() {
f(ext_tex, ext_tex_plane_1, ext_tex_params, smp, ext_tex2, ext_tex_plane_1_1, ext_tex_params_1); 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. // correct output.
TEST_F(MultiplanarExternalTextureTest, ExternalTexturePassedAsParamMultiple_OutOfOrder) { TEST_F(MultiplanarExternalTextureTest, ExternalTexturePassedAsParamMultiple_OutOfOrder) {
auto* src = R"( auto* src = R"(
@stage(fragment) @fragment
fn main() { fn main() {
f(ext_tex, smp, ext_tex2); f(ext_tex, smp, ext_tex2);
} }
@ -1143,7 +1143,7 @@ struct ExternalTextureParams {
@group(0) @binding(6) var<uniform> ext_tex_params_1 : ExternalTextureParams; @group(0) @binding(6) var<uniform> ext_tex_params_1 : ExternalTextureParams;
@stage(fragment) @fragment
fn main() { fn main() {
f(ext_tex, ext_tex_plane_1, ext_tex_params, smp, ext_tex2, ext_tex_plane_1_1, ext_tex_params_1); 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(0) var ext_tex : texture_external;
@group(0) @binding(1) var smp : sampler; @group(0) @binding(1) var smp : sampler;
@stage(fragment) @fragment
fn main() { fn main() {
f(ext_tex, smp); 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; @group(0) @binding(1) var smp : sampler;
@stage(fragment) @fragment
fn main() { fn main() {
f(ext_tex, ext_tex_plane_1, ext_tex_params, smp); 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(0) var ext_tex : texture_external;
@group(0) @binding(1) var smp : sampler; @group(0) @binding(1) var smp : sampler;
@stage(fragment) @fragment
fn main() { fn main() {
f(ext_tex, smp); 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; @group(0) @binding(1) var smp : sampler;
@stage(fragment) @fragment
fn main() { fn main() {
f(ext_tex, ext_tex_plane_1, ext_tex_params, smp); 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(0) var ext_tex : ET;
@group(0) @binding(1) var smp : sampler; @group(0) @binding(1) var smp : sampler;
@stage(fragment) @fragment
fn main() { fn main() {
f(ext_tex, smp); 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; @group(0) @binding(1) var smp : sampler;
@stage(fragment) @fragment
fn main() { fn main() {
f(ext_tex, ext_tex_plane_1, ext_tex_params, smp); 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 // Tests that the the transform handles aliases to external textures
TEST_F(MultiplanarExternalTextureTest, ExternalTextureAlias_OutOfOrder) { TEST_F(MultiplanarExternalTextureTest, ExternalTextureAlias_OutOfOrder) {
auto* src = R"( auto* src = R"(
@stage(fragment) @fragment
fn main() { fn main() {
f(ext_tex, smp); f(ext_tex, smp);
} }
@ -1536,7 +1536,7 @@ struct ExternalTextureParams {
@group(0) @binding(3) var<uniform> ext_tex_params : ExternalTextureParams; @group(0) @binding(3) var<uniform> ext_tex_params : ExternalTextureParams;
@stage(fragment) @fragment
fn main() { fn main() {
f(ext_tex, ext_tex_plane_1, ext_tex_params, smp); 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) { TEST_F(NumWorkgroupsFromUniformTest, ShouldRunHasNumWorkgroups) {
auto* src = R"( auto* src = R"(
@stage(compute) @workgroup_size(1) @compute @workgroup_size(1)
fn main(@builtin(num_workgroups) num_wgs : vec3<u32>) { 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) { TEST_F(NumWorkgroupsFromUniformTest, Error_MissingTransformData) {
auto* src = R"( auto* src = R"(
@stage(compute) @workgroup_size(1) @compute @workgroup_size(1)
fn main(@builtin(num_workgroups) num_wgs : vec3<u32>) { 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) { TEST_F(NumWorkgroupsFromUniformTest, Basic) {
auto* src = R"( auto* src = R"(
@stage(compute) @workgroup_size(1) @compute @workgroup_size(1)
fn main(@builtin(num_workgroups) num_wgs : vec3<u32>) { fn main(@builtin(num_workgroups) num_wgs : vec3<u32>) {
let groups_x = num_wgs.x; let groups_x = num_wgs.x;
let groups_y = num_wgs.y; let groups_y = num_wgs.y;
@ -82,7 +82,7 @@ fn main_inner(num_wgs : vec3<u32>) {
let groups_z = num_wgs.z; let groups_z = num_wgs.z;
} }
@stage(compute) @workgroup_size(1) @compute @workgroup_size(1)
fn main() { fn main() {
main_inner(tint_symbol_3.num_workgroups); main_inner(tint_symbol_3.num_workgroups);
} }
@ -101,7 +101,7 @@ struct Builtins {
@builtin(num_workgroups) num_wgs : vec3<u32>, @builtin(num_workgroups) num_wgs : vec3<u32>,
}; };
@stage(compute) @workgroup_size(1) @compute @workgroup_size(1)
fn main(in : Builtins) { fn main(in : Builtins) {
let groups_x = in.num_wgs.x; let groups_x = in.num_wgs.x;
let groups_y = in.num_wgs.y; let groups_y = in.num_wgs.y;
@ -126,7 +126,7 @@ fn main_inner(in : Builtins) {
let groups_z = in.num_wgs.z; let groups_z = in.num_wgs.z;
} }
@stage(compute) @workgroup_size(1) @compute @workgroup_size(1)
fn main() { fn main() {
main_inner(Builtins(tint_symbol_3.num_workgroups)); main_inner(Builtins(tint_symbol_3.num_workgroups));
} }
@ -141,7 +141,7 @@ fn main() {
TEST_F(NumWorkgroupsFromUniformTest, StructOnlyMember_OutOfOrder) { TEST_F(NumWorkgroupsFromUniformTest, StructOnlyMember_OutOfOrder) {
auto* src = R"( auto* src = R"(
@stage(compute) @workgroup_size(1) @compute @workgroup_size(1)
fn main(in : Builtins) { fn main(in : Builtins) {
let groups_x = in.num_wgs.x; let groups_x = in.num_wgs.x;
let groups_y = in.num_wgs.y; let groups_y = in.num_wgs.y;
@ -166,7 +166,7 @@ fn main_inner(in : Builtins) {
let groups_z = in.num_wgs.z; let groups_z = in.num_wgs.z;
} }
@stage(compute) @workgroup_size(1) @compute @workgroup_size(1)
fn main() { fn main() {
main_inner(Builtins(tint_symbol_3.num_workgroups)); main_inner(Builtins(tint_symbol_3.num_workgroups));
} }
@ -191,7 +191,7 @@ struct Builtins {
@builtin(workgroup_id) wgid : vec3<u32>, @builtin(workgroup_id) wgid : vec3<u32>,
}; };
@stage(compute) @workgroup_size(1) @compute @workgroup_size(1)
fn main(in : Builtins) { fn main(in : Builtins) {
let groups_x = in.num_wgs.x; let groups_x = in.num_wgs.x;
let groups_y = in.num_wgs.y; let groups_y = in.num_wgs.y;
@ -225,7 +225,7 @@ fn main_inner(in : Builtins) {
let groups_z = in.num_wgs.z; let groups_z = in.num_wgs.z;
} }
@stage(compute) @workgroup_size(1) @compute @workgroup_size(1)
fn main(tint_symbol : tint_symbol_1) { fn main(tint_symbol : tint_symbol_1) {
main_inner(Builtins(tint_symbol.gid, tint_symbol_3.num_workgroups, tint_symbol.wgid)); 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) { TEST_F(NumWorkgroupsFromUniformTest, StructMultipleMembers_OutOfOrder) {
auto* src = R"( auto* src = R"(
@stage(compute) @workgroup_size(1) @compute @workgroup_size(1)
fn main(in : Builtins) { fn main(in : Builtins) {
let groups_x = in.num_wgs.x; let groups_x = in.num_wgs.x;
let groups_y = in.num_wgs.y; let groups_y = in.num_wgs.y;
@ -275,7 +275,7 @@ fn main_inner(in : Builtins) {
let groups_z = in.num_wgs.z; let groups_z = in.num_wgs.z;
} }
@stage(compute) @workgroup_size(1) @compute @workgroup_size(1)
fn main(tint_symbol : tint_symbol_1) { fn main(tint_symbol : tint_symbol_1) {
main_inner(Builtins(tint_symbol.gid, tint_symbol_3.num_workgroups, tint_symbol.wgid)); 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>, @builtin(workgroup_id) wgid : vec3<u32>,
}; };
@stage(compute) @workgroup_size(1) @compute @workgroup_size(1)
fn main1(in : Builtins1) { fn main1(in : Builtins1) {
let groups_x = in.num_wgs.x; let groups_x = in.num_wgs.x;
let groups_y = in.num_wgs.y; let groups_y = in.num_wgs.y;
let groups_z = in.num_wgs.z; let groups_z = in.num_wgs.z;
} }
@stage(compute) @workgroup_size(1) @compute @workgroup_size(1)
fn main2(in : Builtins2) { fn main2(in : Builtins2) {
let groups_x = in.num_wgs.x; let groups_x = in.num_wgs.x;
let groups_y = in.num_wgs.y; let groups_y = in.num_wgs.y;
let groups_z = in.num_wgs.z; 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>) { fn main3(@builtin(num_workgroups) num_wgs : vec3<u32>) {
let groups_x = num_wgs.x; let groups_x = num_wgs.x;
let groups_y = num_wgs.y; let groups_y = num_wgs.y;
@ -351,7 +351,7 @@ fn main1_inner(in : Builtins1) {
let groups_z = in.num_wgs.z; let groups_z = in.num_wgs.z;
} }
@stage(compute) @workgroup_size(1) @compute @workgroup_size(1)
fn main1() { fn main1() {
main1_inner(Builtins1(tint_symbol_7.num_workgroups)); main1_inner(Builtins1(tint_symbol_7.num_workgroups));
} }
@ -369,7 +369,7 @@ fn main2_inner(in : Builtins2) {
let groups_z = in.num_wgs.z; let groups_z = in.num_wgs.z;
} }
@stage(compute) @workgroup_size(1) @compute @workgroup_size(1)
fn main2(tint_symbol_2 : tint_symbol_3) { fn main2(tint_symbol_2 : tint_symbol_3) {
main2_inner(Builtins2(tint_symbol_2.gid, tint_symbol_7.num_workgroups, tint_symbol_2.wgid)); 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; let groups_z = num_wgs.z;
} }
@stage(compute) @workgroup_size(1) @compute @workgroup_size(1)
fn main3() { fn main3() {
main3_inner(tint_symbol_7.num_workgroups); main3_inner(tint_symbol_7.num_workgroups);
} }
@ -400,7 +400,7 @@ struct Builtins {
@builtin(workgroup_id) wgid : vec3<u32>, @builtin(workgroup_id) wgid : vec3<u32>,
}; };
@stage(compute) @workgroup_size(1) @compute @workgroup_size(1)
fn main(in : Builtins) { fn main(in : Builtins) {
} }
)"; )";
@ -421,7 +421,7 @@ struct tint_symbol_1 {
fn main_inner(in : Builtins) { fn main_inner(in : Builtins) {
} }
@stage(compute) @workgroup_size(1) @compute @workgroup_size(1)
fn main(tint_symbol : tint_symbol_1) { fn main(tint_symbol : tint_symbol_1) {
main_inner(Builtins(tint_symbol.gid, tint_symbol.wgid)); main_inner(Builtins(tint_symbol.gid, tint_symbol.wgid));
} }
@ -448,21 +448,21 @@ struct Builtins2 {
@builtin(workgroup_id) wgid : vec3<u32>, @builtin(workgroup_id) wgid : vec3<u32>,
}; };
@stage(compute) @workgroup_size(1) @compute @workgroup_size(1)
fn main1(in : Builtins1) { fn main1(in : Builtins1) {
let groups_x = in.num_wgs.x; let groups_x = in.num_wgs.x;
let groups_y = in.num_wgs.y; let groups_y = in.num_wgs.y;
let groups_z = in.num_wgs.z; let groups_z = in.num_wgs.z;
} }
@stage(compute) @workgroup_size(1) @compute @workgroup_size(1)
fn main2(in : Builtins2) { fn main2(in : Builtins2) {
let groups_x = in.num_wgs.x; let groups_x = in.num_wgs.x;
let groups_y = in.num_wgs.y; let groups_y = in.num_wgs.y;
let groups_z = in.num_wgs.z; 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>) { fn main3(@builtin(num_workgroups) num_wgs : vec3<u32>) {
let groups_x = num_wgs.x; let groups_x = num_wgs.x;
let groups_y = num_wgs.y; let groups_y = num_wgs.y;
@ -493,7 +493,7 @@ fn main1_inner(in : Builtins1) {
let groups_z = in.num_wgs.z; let groups_z = in.num_wgs.z;
} }
@stage(compute) @workgroup_size(1) @compute @workgroup_size(1)
fn main1() { fn main1() {
main1_inner(Builtins1(tint_symbol_7.num_workgroups)); main1_inner(Builtins1(tint_symbol_7.num_workgroups));
} }
@ -511,7 +511,7 @@ fn main2_inner(in : Builtins2) {
let groups_z = in.num_wgs.z; let groups_z = in.num_wgs.z;
} }
@stage(compute) @workgroup_size(1) @compute @workgroup_size(1)
fn main2(tint_symbol_2 : tint_symbol_3) { fn main2(tint_symbol_2 : tint_symbol_3) {
main2_inner(Builtins2(tint_symbol_2.gid, tint_symbol_7.num_workgroups, tint_symbol_2.wgid)); 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; let groups_z = num_wgs.z;
} }
@stage(compute) @workgroup_size(1) @compute @workgroup_size(1)
fn main3() { fn main3() {
main3_inner(tint_symbol_7.num_workgroups); main3_inner(tint_symbol_7.num_workgroups);
} }
@ -572,7 +572,7 @@ struct S1 {
@group(1) @binding(3) var<storage, read> g9 : S0; @group(1) @binding(3) var<storage, read> g9 : S0;
@group(3) @binding(2) var<storage, read_write> g10 : S0; @group(3) @binding(2) var<storage, read_write> g10 : S0;
@stage(compute) @workgroup_size(1) @compute @workgroup_size(1)
fn main1(in : Builtins1) { fn main1(in : Builtins1) {
let groups_x = in.num_wgs.x; let groups_x = in.num_wgs.x;
let groups_y = in.num_wgs.y; let groups_y = in.num_wgs.y;
@ -580,14 +580,14 @@ fn main1(in : Builtins1) {
g8.m0 = 1u; g8.m0 = 1u;
} }
@stage(compute) @workgroup_size(1) @compute @workgroup_size(1)
fn main2(in : Builtins2) { fn main2(in : Builtins2) {
let groups_x = in.num_wgs.x; let groups_x = in.num_wgs.x;
let groups_y = in.num_wgs.y; let groups_y = in.num_wgs.y;
let groups_z = in.num_wgs.z; 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>) { fn main3(@builtin(num_workgroups) num_wgs : vec3<u32>) {
let groups_x = num_wgs.x; let groups_x = num_wgs.x;
let groups_y = num_wgs.y; let groups_y = num_wgs.y;
@ -647,7 +647,7 @@ fn main1_inner(in : Builtins1) {
g8.m0 = 1u; g8.m0 = 1u;
} }
@stage(compute) @workgroup_size(1) @compute @workgroup_size(1)
fn main1() { fn main1() {
main1_inner(Builtins1(tint_symbol_7.num_workgroups)); main1_inner(Builtins1(tint_symbol_7.num_workgroups));
} }
@ -665,7 +665,7 @@ fn main2_inner(in : Builtins2) {
let groups_z = in.num_wgs.z; let groups_z = in.num_wgs.z;
} }
@stage(compute) @workgroup_size(1) @compute @workgroup_size(1)
fn main2(tint_symbol_2 : tint_symbol_3) { fn main2(tint_symbol_2 : tint_symbol_3) {
main2_inner(Builtins2(tint_symbol_2.gid, tint_symbol_7.num_workgroups, tint_symbol_2.wgid)); 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; let groups_z = num_wgs.z;
} }
@stage(compute) @workgroup_size(1) @compute @workgroup_size(1)
fn main3() { fn main3() {
main3_inner(tint_symbol_7.num_workgroups); main3_inner(tint_symbol_7.num_workgroups);
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -73,7 +73,7 @@ TEST_F(WgslGeneratorImplTest, Emit_Function_WithAttribute_WorkgroupSize) {
gen.increment_indent(); gen.increment_indent();
ASSERT_TRUE(gen.EmitFunction(func)); 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() { fn my_func() {
return; return;
} }
@ -93,7 +93,7 @@ TEST_F(WgslGeneratorImplTest, Emit_Function_WithAttribute_WorkgroupSize_WithIden
gen.increment_indent(); gen.increment_indent();
ASSERT_TRUE(gen.EmitFunction(func)); 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() { fn my_func() {
return; return;
} }
@ -114,7 +114,7 @@ TEST_F(WgslGeneratorImplTest, Emit_Function_EntryPoint_Parameters) {
gen.increment_indent(); gen.increment_indent();
ASSERT_TRUE(gen.EmitFunction(func)); 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) { 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(); gen.increment_indent();
ASSERT_TRUE(gen.EmitFunction(func)); ASSERT_TRUE(gen.EmitFunction(func));
EXPECT_EQ(gen.result(), R"( @stage(fragment) EXPECT_EQ(gen.result(), R"( @fragment
fn frag_main() -> @location(1) f32 { fn frag_main() -> @location(1) f32 {
return 1.0f; 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; // @binding(0) @group(0) var<storage> data : Data;
// //
// @stage(compute) @workgroup_size(1) // @compute @workgroup_size(1)
// fn a() { // fn a() {
// return; // return;
// } // }
// //
// @stage(compute) @workgroup_size(1) // @compute @workgroup_size(1)
// fn b() { // fn b() {
// return; // 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; @binding(0) @group(0) var<storage, read_write> data : Data;
@stage(compute) @workgroup_size(1i) @compute @workgroup_size(1i)
fn a() { fn a() {
var v : f32 = data.d; var v : f32 = data.d;
return; return;
} }
@stage(compute) @workgroup_size(1i) @compute @workgroup_size(1i)
fn b() { fn b() {
var v : f32 = data.d; var v : f32 = data.d;
return; return;

View File

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

View File

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

View File

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

View File

@ -1,4 +1,4 @@
@stage(compute) @workgroup_size(1) @compute @workgroup_size(1)
fn main() { 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 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]; let v : vec3<f32> = m[1];

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,4 +1,4 @@
@stage(compute) @workgroup_size(1) @compute @workgroup_size(1)
fn main() { fn main() {
var v : vec3<f32>; var v : vec3<f32>;
let scalar : f32 = v.y; 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]; return a[1][2][3];
} }
@stage(compute) @workgroup_size(1) @compute @workgroup_size(1)
fn main() { fn main() {
let a1 : array<f32, 4> = array<f32, 4>(); let a1 : array<f32, 4> = array<f32, 4>();
let a2 : array<array<f32, 4>, 3> = array<array<f32, 4>, 3>(); 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]; return a[1][2][3];
} }
@stage(compute) @workgroup_size(1) @compute @workgroup_size(1)
fn main() { fn main() {
let a1 : array<f32, 4> = array<f32, 4>(); let a1 : array<f32, 4> = array<f32, 4>();
let a2 : array<array<f32, 4>, 3> = array<array<f32, 4>, 3>(); 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()); return array<array<array<f32, 4>, 3>, 2>(f2(), f2());
} }
@stage(compute) @workgroup_size(1) @compute @workgroup_size(1)
fn main() { fn main() {
let a1 : array<f32, 4> = f1(); let a1 : array<f32, 4> = f1();
let a2 : array<array<f32, 4>, 3> = f2(); 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()); return array<array<array<f32, 4>, 3>, 2>(f2(), f2());
} }
@stage(compute) @workgroup_size(1) @compute @workgroup_size(1)
fn main() { fn main() {
let a1 : array<f32, 4> = f1(); let a1 : array<f32, 4> = f1();
let a2 : array<array<f32, 4>, 3> = f2(); let a2 : array<array<f32, 4>, 3> = f2();

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -21,7 +21,7 @@ struct VertexOutput {
v_color : vec4<f32>, v_color : vec4<f32>,
} }
@stage(vertex) @vertex
fn vert_main(@location(0) position : vec4<f32>, @location(1) color : vec4<f32>) -> VertexOutput { 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); var fade : f32 = ((uniforms.scalarOffset + ((time.value * uniforms.scalar) / 10.0)) % 1.0);
if ((fade < 0.5)) { if ((fade < 0.5)) {
@ -42,7 +42,7 @@ fn vert_main(@location(0) position : vec4<f32>, @location(1) color : vec4<f32>)
return output; return output;
} }
@stage(fragment) @fragment
fn frag_main(@location(0) v_color : vec4<f32>) -> @location(0) vec4<f32> { fn frag_main(@location(0) v_color : vec4<f32>) -> @location(0) vec4<f32> {
return v_color; 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>; @group(0) @binding(3) var prevTexture : texture_2d<f32>;
@stage(fragment) @fragment
fn fragmentMain(input : FragmentInput) -> @location(0) vec4<f32> { fn fragmentMain(input : FragmentInput) -> @location(0) vec4<f32> {
let blurColor = getGaussianBlur(input.texCoord); let blurColor = getGaussianBlur(input.texCoord);
let dimColor = (textureSample(prevTexture, bloomSampler, input.texCoord) * bloom.dim); 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; 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>) { 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)); let tileIndex = ((global_id.x + (global_id.y * tileCount.x)) + ((global_id.z * tileCount.x) * tileCount.y));
var clusterLightCount = 0u; var clusterLightCount = 0u;

View File

@ -102,7 +102,7 @@ fn interpZ(index : u32, i : vec3<u32>, va : f32, vb : f32) {
cubeVerts = (cubeVerts + 1u); 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>) { fn computeMain(@builtin(global_invocation_id) global_id : vec3<u32>) {
let i0 = global_id; let i0 = global_id;
let i1 = (global_id + vec3<u32>(1u, 0u, 0u)); 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 @location(1) quad_pos : vec2<f32>, // -1..+1
}; };
@stage(vertex) @vertex
fn vs_main(in : VertexInput) -> VertexOutput { fn vs_main(in : VertexInput) -> VertexOutput {
var quad_pos = mat2x3<f32>(render_params.right, render_params.up) * in.quad_pos; var quad_pos = mat2x3<f32>(render_params.right, render_params.up) * in.quad_pos;
var position = in.position + quad_pos * 0.01; var position = in.position + quad_pos * 0.01;
@ -45,7 +45,7 @@ fn vs_main(in : VertexInput) -> VertexOutput {
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// Fragment shader // Fragment shader
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@stage(fragment) @fragment
fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> { fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
var color = in.color; var color = in.color;
// Apply a circular particle alpha mask // Apply a circular particle alpha mask
@ -76,7 +76,7 @@ struct Particles {
@binding(1) @group(0) var<storage, read_write> data : Particles; @binding(1) @group(0) var<storage, read_write> data : Particles;
@binding(2) @group(0) var texture : texture_2d<f32>; @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>) { fn simulate(@builtin(global_invocation_id) GlobalInvocationID : vec3<u32>) {
rand_seed = (sim_params.seed.xy + vec2<f32>(GlobalInvocationID.xy)) * sim_params.seed.zw; 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 // Loads the alpha channel from a texel of the source image, and writes it to
// the buf_out.weights. // the buf_out.weights.
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@stage(compute) @workgroup_size(64) @compute @workgroup_size(64)
fn import_level(@builtin(global_invocation_id) coord : vec3<u32>) { fn import_level(@builtin(global_invocation_id) coord : vec3<u32>) {
_ = &buf_in; _ = &buf_in;
let offset = coord.x + coord.y * ubo.width; 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 // mip level of tex_out. See simulate() in particle.wgsl to understand the
// probability logic. // probability logic.
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@stage(compute) @workgroup_size(64) @compute @workgroup_size(64)
fn export_level(@builtin(global_invocation_id) coord : vec3<u32>) { fn export_level(@builtin(global_invocation_id) coord : vec3<u32>) {
if (all(coord.xy < vec2<u32>(textureDimensions(tex_out)))) { if (all(coord.xy < vec2<u32>(textureDimensions(tex_out)))) {
let dst_offset = coord.x + coord.y * ubo.width; 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; let ambientFactor : f32 = 0.200000003;
@stage(fragment) @fragment
fn main(input : FragmentInput) -> @location(0) vec4<f32> { fn main(input : FragmentInput) -> @location(0) vec4<f32> {
var visibility : f32 = 0.0; var visibility : f32 = 0.0;
let oneOverShadowDepthTextureSize = (1.0 / shadowDepthTextureSize); let oneOverShadowDepthTextureSize = (1.0 / shadowDepthTextureSize);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -2,7 +2,7 @@
@group(0) @binding(1) var<storage, read_write> out : 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() { fn main() {
out = in; out = in;
} }

View File

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

View File

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

View File

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

View File

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

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