mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-07-01 10:53:33 +00:00
For structures and arrays. This behaves identically to the per-element zero-initialization, but can be significantly less verbose. Change-Id: I380ef86f16c2b3f37a9de2820e707f368955b761 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/56764 Auto-Submit: Ben Clayton <bclayton@google.com> Reviewed-by: David Neto <dneto@google.com> Kokoro: Kokoro <noreply+kokoro@google.com>
35 lines
668 B
HLSL
35 lines
668 B
HLSL
struct tint_array_wrapper {
|
|
float arr[4];
|
|
};
|
|
|
|
float f1(tint_array_wrapper a) {
|
|
return a.arr[3];
|
|
}
|
|
|
|
struct tint_array_wrapper_1 {
|
|
tint_array_wrapper arr[3];
|
|
};
|
|
|
|
float f2(tint_array_wrapper_1 a) {
|
|
return a.arr[2].arr[3];
|
|
}
|
|
|
|
struct tint_array_wrapper_2 {
|
|
tint_array_wrapper_1 arr[2];
|
|
};
|
|
|
|
float f3(tint_array_wrapper_2 a) {
|
|
return a.arr[1].arr[2].arr[3];
|
|
}
|
|
|
|
[numthreads(1, 1, 1)]
|
|
void main() {
|
|
const tint_array_wrapper a1 = {(float[4])0};
|
|
const tint_array_wrapper_1 a2 = {(tint_array_wrapper[3])0};
|
|
const tint_array_wrapper_2 a3 = {(tint_array_wrapper_1[2])0};
|
|
const float v1 = f1(a1);
|
|
const float v2 = f2(a2);
|
|
const float v3 = f3(a3);
|
|
return;
|
|
}
|