dawn-cmake/test/bug/tint/870.spvasm.expected.wgsl
James Price 4cc4315d6c Allow array size to be a module-scope constant
Change ast::Array to use an ast::Expression for its `size` field. The
WGSL frontend now parses the array size as an `primary_expression`,
and the Resolver is responsible for validating the expression is a
signed or unsigned integer, and either a literal or a non-overridable
module-scope constant.

The Resolver evaluates the constant value of the size expression, and
so the resolved sem::Array type still has a constant size as before.

Fixed: tint:1068
Fixed: tint:1117

Change-Id: Icfa141482ea1e47ea8c21a25e9eb48221f176e9a
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/63061
Auto-Submit: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: James Price <jrprice@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2021-09-02 13:49:59 +00:00

33 lines
715 B
WebGPU Shading Language

type Arr = [[stride(4)]] array<i32, 6u>;
struct sspp962805860buildInformationS {
footprint : vec4<f32>;
offset : vec4<f32>;
essence : i32;
orientation : Arr;
};
[[block]]
struct x_B4_BuildInformation {
passthru : sspp962805860buildInformationS;
};
[[group(0), binding(2)]] var<storage, read> sspp962805860buildInformation : x_B4_BuildInformation;
fn main_1() {
var orientation : array<i32, 6u>;
let x_23 : Arr = sspp962805860buildInformation.passthru.orientation;
orientation[0] = x_23[0u];
orientation[1] = x_23[1u];
orientation[2] = x_23[2u];
orientation[3] = x_23[3u];
orientation[4] = x_23[4u];
orientation[5] = x_23[5u];
return;
}
[[stage(fragment)]]
fn main() {
main_1();
}