mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-09 21:47:47 +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:
@@ -8,5 +8,5 @@ struct tint_array_wrapper {
|
||||
};
|
||||
|
||||
void f() {
|
||||
tint_array_wrapper v = {{false, false, false, false}};
|
||||
tint_array_wrapper v = {(bool[4])0};
|
||||
}
|
||||
|
||||
@@ -8,5 +8,5 @@ struct tint_array_wrapper {
|
||||
};
|
||||
|
||||
void f() {
|
||||
tint_array_wrapper v = {{0.0f, 0.0f, 0.0f, 0.0f}};
|
||||
tint_array_wrapper v = {(float[4])0};
|
||||
}
|
||||
|
||||
@@ -8,5 +8,5 @@ struct tint_array_wrapper {
|
||||
};
|
||||
|
||||
void f() {
|
||||
tint_array_wrapper v = {{0, 0, 0, 0}};
|
||||
tint_array_wrapper v = {(int[4])0};
|
||||
}
|
||||
|
||||
@@ -14,5 +14,5 @@ struct tint_array_wrapper {
|
||||
};
|
||||
|
||||
void f() {
|
||||
tint_array_wrapper v = {{{0, 0u, 0.0f, false}, {0, 0u, 0.0f, false}, {0, 0u, 0.0f, false}, {0, 0u, 0.0f, false}}};
|
||||
tint_array_wrapper v = {(S[4])0};
|
||||
}
|
||||
|
||||
@@ -8,5 +8,5 @@ struct tint_array_wrapper {
|
||||
};
|
||||
|
||||
void f() {
|
||||
tint_array_wrapper v = {{0u, 0u, 0u, 0u}};
|
||||
tint_array_wrapper v = {(uint[4])0};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user