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:
@@ -2,7 +2,7 @@ struct S {
|
||||
int i;
|
||||
};
|
||||
|
||||
static S V = {0};
|
||||
static S V = (S)0;
|
||||
|
||||
void main_1() {
|
||||
int i = 0;
|
||||
|
||||
@@ -2,7 +2,7 @@ struct S {
|
||||
int i;
|
||||
};
|
||||
|
||||
static S V = {0};
|
||||
static S V = (S)0;
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void main() {
|
||||
|
||||
@@ -4,7 +4,7 @@ struct S {
|
||||
|
||||
void main_1() {
|
||||
int i = 0;
|
||||
S V = {0};
|
||||
S V = (S)0;
|
||||
const int x_14 = V.i;
|
||||
i = x_14;
|
||||
return;
|
||||
|
||||
@@ -4,7 +4,7 @@ struct S {
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void main() {
|
||||
S V = {0};
|
||||
S V = (S)0;
|
||||
int i = V.i;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ struct S {
|
||||
int i;
|
||||
};
|
||||
|
||||
static S V = {0};
|
||||
static S V = (S)0;
|
||||
|
||||
void main_1() {
|
||||
V.i = 5;
|
||||
|
||||
@@ -3,7 +3,7 @@ struct S {
|
||||
};
|
||||
|
||||
void main_1() {
|
||||
S V = {0};
|
||||
S V = (S)0;
|
||||
V.i = 5;
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user