mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-18 17:35:30 +00:00
writer/hlsl: Don't wrap arrays in structures
FXC has trouble dealing with these. This was originally added to handle returning arrays as structures. HLSL supports typedefs, which is a much simpiler solution, and doesn't upset FXC. Bug: tint:848 Bug: tint:904 Change-Id: Ie841c9c454461a885a35c41476fd4d05d3f34cbf Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/56774 Kokoro: Kokoro <noreply+kokoro@google.com> Reviewed-by: Antonio Maiorano <amaiorano@google.com> Commit-Queue: Ben Clayton <bclayton@google.com>
This commit is contained in:
committed by
Tint LUCI CQ
parent
106ac290e6
commit
4135ea55eb
@@ -6,36 +6,36 @@ void unused_entry_point() {
|
||||
struct tint_padded_array_element {
|
||||
int el;
|
||||
};
|
||||
struct tint_array_wrapper {
|
||||
struct S {
|
||||
tint_padded_array_element arr[4];
|
||||
};
|
||||
struct S {
|
||||
tint_array_wrapper arr;
|
||||
};
|
||||
|
||||
tint_array_wrapper tint_symbol_2(uint4 buffer[4], uint offset) {
|
||||
typedef tint_padded_array_element tint_symbol_2_ret[4];
|
||||
tint_symbol_2_ret tint_symbol_2(uint4 buffer[4], uint offset) {
|
||||
const uint scalar_offset = ((offset + 0u)) / 4;
|
||||
const uint scalar_offset_1 = ((offset + 16u)) / 4;
|
||||
const uint scalar_offset_2 = ((offset + 32u)) / 4;
|
||||
const uint scalar_offset_3 = ((offset + 48u)) / 4;
|
||||
const tint_array_wrapper tint_symbol_5 = {{{asint(buffer[scalar_offset / 4][scalar_offset % 4])}, {asint(buffer[scalar_offset_1 / 4][scalar_offset_1 % 4])}, {asint(buffer[scalar_offset_2 / 4][scalar_offset_2 % 4])}, {asint(buffer[scalar_offset_3 / 4][scalar_offset_3 % 4])}}};
|
||||
const tint_padded_array_element tint_symbol_5[4] = {{asint(buffer[scalar_offset / 4][scalar_offset % 4])}, {asint(buffer[scalar_offset_1 / 4][scalar_offset_1 % 4])}, {asint(buffer[scalar_offset_2 / 4][scalar_offset_2 % 4])}, {asint(buffer[scalar_offset_3 / 4][scalar_offset_3 % 4])}};
|
||||
return tint_symbol_5;
|
||||
}
|
||||
|
||||
tint_array_wrapper tint_symbol_4(RWByteAddressBuffer buffer, uint offset) {
|
||||
const tint_array_wrapper tint_symbol_6 = {{{asint(buffer.Load((offset + 0u)))}, {asint(buffer.Load((offset + 16u)))}, {asint(buffer.Load((offset + 32u)))}, {asint(buffer.Load((offset + 48u)))}}};
|
||||
typedef tint_padded_array_element tint_symbol_4_ret[4];
|
||||
tint_symbol_4_ret tint_symbol_4(RWByteAddressBuffer buffer, uint offset) {
|
||||
const tint_padded_array_element tint_symbol_6[4] = {{asint(buffer.Load((offset + 0u)))}, {asint(buffer.Load((offset + 16u)))}, {asint(buffer.Load((offset + 32u)))}, {asint(buffer.Load((offset + 48u)))}};
|
||||
return tint_symbol_6;
|
||||
}
|
||||
|
||||
static tint_array_wrapper src_private = (tint_array_wrapper)0;
|
||||
groupshared tint_array_wrapper src_workgroup;
|
||||
static tint_padded_array_element src_private[4] = (tint_padded_array_element[4])0;
|
||||
groupshared tint_padded_array_element src_workgroup[4];
|
||||
cbuffer cbuffer_src_uniform : register(b0, space0) {
|
||||
uint4 src_uniform[4];
|
||||
};
|
||||
RWByteAddressBuffer src_storage : register(u1, space0);
|
||||
|
||||
tint_array_wrapper ret_arr() {
|
||||
const tint_array_wrapper tint_symbol_7 = {(tint_padded_array_element[4])0};
|
||||
typedef tint_padded_array_element ret_arr_ret[4];
|
||||
ret_arr_ret ret_arr() {
|
||||
const tint_padded_array_element tint_symbol_7[4] = (tint_padded_array_element[4])0;
|
||||
return tint_symbol_7;
|
||||
}
|
||||
|
||||
@@ -44,24 +44,14 @@ S ret_struct_arr() {
|
||||
return tint_symbol_8;
|
||||
}
|
||||
|
||||
struct tint_array_wrapper_3 {
|
||||
int arr[2];
|
||||
};
|
||||
struct tint_array_wrapper_2 {
|
||||
tint_array_wrapper_3 arr[3];
|
||||
};
|
||||
struct tint_array_wrapper_1 {
|
||||
tint_array_wrapper_2 arr[4];
|
||||
};
|
||||
|
||||
void foo(tint_array_wrapper src_param) {
|
||||
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}}};
|
||||
void foo(tint_padded_array_element src_param[4]) {
|
||||
tint_padded_array_element src_function[4] = (tint_padded_array_element[4])0;
|
||||
tint_padded_array_element tint_symbol[4] = (tint_padded_array_element[4])0;
|
||||
const tint_padded_array_element tint_symbol_9[4] = {{1}, {2}, {3}, {3}};
|
||||
tint_symbol = tint_symbol_9;
|
||||
tint_symbol = src_param;
|
||||
tint_symbol = ret_arr();
|
||||
const tint_array_wrapper src_let = {(tint_padded_array_element[4])0};
|
||||
const tint_padded_array_element src_let[4] = (tint_padded_array_element[4])0;
|
||||
tint_symbol = src_let;
|
||||
tint_symbol = src_function;
|
||||
tint_symbol = src_private;
|
||||
@@ -69,7 +59,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 = (tint_array_wrapper_1)0;
|
||||
tint_array_wrapper_1 src_nested = (tint_array_wrapper_1)0;
|
||||
int dst_nested[4][3][2] = (int[4][3][2])0;
|
||||
int src_nested[4][3][2] = (int[4][3][2])0;
|
||||
dst_nested = src_nested;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user