dawn-cmake/test/array/strides.spvasm.expected.wgsl
Ben Clayton 009d129103 reader/spirv: Decompose arrays with strides
Transform any SPIR-V that has an array with a custom stride:

  @stride(S) array<T, N>

into:

  struct strided_arr {
    @size(S) er : T;
  };
  array<strided_arr, N>

Also remove any @stride decorations that match the default array stride.

Bug: tint:1394
Bug: tint:1381
Change-Id: I8be8f3a76c5335fdb2bc5183388366091dbc7642
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/78781
Reviewed-by: David Neto <dneto@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-02-04 15:39:34 +00:00

37 lines
567 B
WebGPU Shading Language

struct strided_arr {
@size(8)
el : f32;
}
type Arr = array<strided_arr, 2u>;
type Arr_1 = array<Arr, 3u>;
struct strided_arr_1 {
@size(128)
el : Arr_1;
}
type Arr_2 = array<strided_arr_1, 4u>;
struct S {
a : Arr_2;
}
@group(0) @binding(0) var<storage, read_write> s : S;
fn f_1() {
let x_19 : Arr_2 = s.a;
let x_24 : Arr_1 = s.a[3].el;
let x_28 : Arr = s.a[3].el[2];
let x_32 : f32 = s.a[3].el[2][1].el;
s.a = array<strided_arr_1, 4u>();
s.a[3].el[2][1].el = 5.0;
return;
}
@stage(compute) @workgroup_size(1, 1, 1)
fn f() {
f_1();
}