mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-09 13:38:00 +00:00
writer/hlsl: Zero initialize with (T) 0
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>
This commit is contained in:
@@ -4,7 +4,7 @@ struct tint_array_wrapper {
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void main() {
|
||||
tint_array_wrapper v = {{0, 0, 0}};
|
||||
tint_array_wrapper v = (tint_array_wrapper)0;
|
||||
v;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ struct S {
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void main() {
|
||||
S v = {0, 0.0f};
|
||||
S v = (S)0;
|
||||
v;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ struct tint_array_wrapper {
|
||||
int arr[3];
|
||||
};
|
||||
|
||||
static tint_array_wrapper v = {{0, 0, 0}};
|
||||
static tint_array_wrapper v = (tint_array_wrapper)0;
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void main() {
|
||||
|
||||
@@ -3,7 +3,7 @@ struct S {
|
||||
float b;
|
||||
};
|
||||
|
||||
static S v = {0, 0.0f};
|
||||
static S v = (S)0;
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void main() {
|
||||
|
||||
@@ -12,7 +12,7 @@ struct tint_symbol_1 {
|
||||
void main(tint_symbol_1 tint_symbol) {
|
||||
const uint local_invocation_index = tint_symbol.local_invocation_index;
|
||||
if ((local_invocation_index == 0u)) {
|
||||
const tint_array_wrapper tint_symbol_2 = {{0, 0, 0}};
|
||||
const tint_array_wrapper tint_symbol_2 = {(int[3])0};
|
||||
v = tint_symbol_2;
|
||||
}
|
||||
GroupMemoryBarrierWithGroupSync();
|
||||
|
||||
@@ -13,7 +13,7 @@ struct tint_symbol_1 {
|
||||
void main(tint_symbol_1 tint_symbol) {
|
||||
const uint local_invocation_index = tint_symbol.local_invocation_index;
|
||||
if ((local_invocation_index == 0u)) {
|
||||
const S tint_symbol_2 = {0, 0.0f};
|
||||
const S tint_symbol_2 = (S)0;
|
||||
v = tint_symbol_2;
|
||||
}
|
||||
GroupMemoryBarrierWithGroupSync();
|
||||
|
||||
Reference in New Issue
Block a user