mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-18 17:35:30 +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:
@@ -27,7 +27,7 @@ tint_array_wrapper tint_symbol_4(RWByteAddressBuffer buffer, uint offset) {
|
||||
return tint_symbol_6;
|
||||
}
|
||||
|
||||
static tint_array_wrapper src_private = {{{0}, {0}, {0}, {0}}};
|
||||
static tint_array_wrapper src_private = (tint_array_wrapper)0;
|
||||
groupshared tint_array_wrapper src_workgroup;
|
||||
cbuffer cbuffer_src_uniform : register(b0, space0) {
|
||||
uint4 src_uniform[4];
|
||||
@@ -35,12 +35,12 @@ cbuffer cbuffer_src_uniform : register(b0, space0) {
|
||||
RWByteAddressBuffer src_storage : register(u1, space0);
|
||||
|
||||
tint_array_wrapper ret_arr() {
|
||||
const tint_array_wrapper tint_symbol_7 = {{{0}, {0}, {0}, {0}}};
|
||||
const tint_array_wrapper tint_symbol_7 = {(tint_padded_array_element[4])0};
|
||||
return tint_symbol_7;
|
||||
}
|
||||
|
||||
S ret_struct_arr() {
|
||||
const S tint_symbol_8 = {{{{0}, {0}, {0}, {0}}}};
|
||||
const S tint_symbol_8 = (S)0;
|
||||
return tint_symbol_8;
|
||||
}
|
||||
|
||||
@@ -55,13 +55,13 @@ struct tint_array_wrapper_1 {
|
||||
};
|
||||
|
||||
void foo(tint_array_wrapper src_param) {
|
||||
tint_array_wrapper src_function = {{{0}, {0}, {0}, {0}}};
|
||||
tint_array_wrapper tint_symbol = {{{0}, {0}, {0}, {0}}};
|
||||
tint_array_wrapper src_function = (tint_array_wrapper)0;
|
||||
tint_array_wrapper tint_symbol = (tint_array_wrapper)0;
|
||||
const tint_array_wrapper tint_symbol_9 = {{{1}, {2}, {3}, {3}}};
|
||||
tint_symbol = tint_symbol_9;
|
||||
tint_symbol = src_param;
|
||||
tint_symbol = ret_arr();
|
||||
const tint_array_wrapper src_let = {{{0}, {0}, {0}, {0}}};
|
||||
const tint_array_wrapper src_let = {(tint_padded_array_element[4])0};
|
||||
tint_symbol = src_let;
|
||||
tint_symbol = src_function;
|
||||
tint_symbol = src_private;
|
||||
@@ -69,7 +69,7 @@ void foo(tint_array_wrapper src_param) {
|
||||
tint_symbol = ret_struct_arr().arr;
|
||||
tint_symbol = tint_symbol_2(src_uniform, 0u);
|
||||
tint_symbol = tint_symbol_4(src_storage, 0u);
|
||||
tint_array_wrapper_1 dst_nested = {{{{{{0, 0}}, {{0, 0}}, {{0, 0}}}}, {{{{0, 0}}, {{0, 0}}, {{0, 0}}}}, {{{{0, 0}}, {{0, 0}}, {{0, 0}}}}, {{{{0, 0}}, {{0, 0}}, {{0, 0}}}}}};
|
||||
tint_array_wrapper_1 src_nested = {{{{{{0, 0}}, {{0, 0}}, {{0, 0}}}}, {{{{0, 0}}, {{0, 0}}, {{0, 0}}}}, {{{{0, 0}}, {{0, 0}}, {{0, 0}}}}, {{{{0, 0}}, {{0, 0}}, {{0, 0}}}}}};
|
||||
tint_array_wrapper_1 dst_nested = (tint_array_wrapper_1)0;
|
||||
tint_array_wrapper_1 src_nested = (tint_array_wrapper_1)0;
|
||||
dst_nested = src_nested;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user