writer/hlsl: Use unsigned indices for UBOs These indices were a mix of signed and unsigned. Modulus on the signed integers was producing FXC warnings about performance. Change-Id: Ib82f4296199a09d2f03be8b06314feefce0022e2 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/56765 Auto-Submit: Ben Clayton <bclayton@google.com> Reviewed-by: David Neto <dneto@google.com> Kokoro: Kokoro <noreply+kokoro@google.com>
diff --git a/test/array/assign_to_function_var.wgsl.expected.hlsl b/test/array/assign_to_function_var.wgsl.expected.hlsl index a52de60..e40aa79 100644 --- a/test/array/assign_to_function_var.wgsl.expected.hlsl +++ b/test/array/assign_to_function_var.wgsl.expected.hlsl
@@ -14,10 +14,10 @@ }; tint_array_wrapper tint_symbol_2(uint4 buffer[4], uint offset) { - const int scalar_offset = ((offset + 0u)) / 4; - const int scalar_offset_1 = ((offset + 16u)) / 4; - const int scalar_offset_2 = ((offset + 32u)) / 4; - const int scalar_offset_3 = ((offset + 48u)) / 4; + 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])}}}; return tint_symbol_5; }
diff --git a/test/array/assign_to_private_var.wgsl.expected.hlsl b/test/array/assign_to_private_var.wgsl.expected.hlsl index 52cf9b8..060ef83 100644 --- a/test/array/assign_to_private_var.wgsl.expected.hlsl +++ b/test/array/assign_to_private_var.wgsl.expected.hlsl
@@ -14,10 +14,10 @@ }; tint_array_wrapper tint_symbol_2(uint4 buffer[4], uint offset) { - const int scalar_offset = ((offset + 0u)) / 4; - const int scalar_offset_1 = ((offset + 16u)) / 4; - const int scalar_offset_2 = ((offset + 32u)) / 4; - const int scalar_offset_3 = ((offset + 48u)) / 4; + 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])}}}; return tint_symbol_5; }
diff --git a/test/array/assign_to_storage_var.wgsl.expected.hlsl b/test/array/assign_to_storage_var.wgsl.expected.hlsl index 2cf8195..0730f24 100644 --- a/test/array/assign_to_storage_var.wgsl.expected.hlsl +++ b/test/array/assign_to_storage_var.wgsl.expected.hlsl
@@ -14,10 +14,10 @@ }; tint_array_wrapper tint_symbol_2(uint4 buffer[4], uint offset) { - const int scalar_offset = ((offset + 0u)) / 4; - const int scalar_offset_1 = ((offset + 16u)) / 4; - const int scalar_offset_2 = ((offset + 32u)) / 4; - const int scalar_offset_3 = ((offset + 48u)) / 4; + 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_11 = {{{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_11; }
diff --git a/test/array/assign_to_workgroup_var.wgsl.expected.hlsl b/test/array/assign_to_workgroup_var.wgsl.expected.hlsl index 14443ac..52d8984 100644 --- a/test/array/assign_to_workgroup_var.wgsl.expected.hlsl +++ b/test/array/assign_to_workgroup_var.wgsl.expected.hlsl
@@ -14,10 +14,10 @@ }; tint_array_wrapper tint_symbol_2(uint4 buffer[4], uint offset) { - const int scalar_offset = ((offset + 0u)) / 4; - const int scalar_offset_1 = ((offset + 16u)) / 4; - const int scalar_offset_2 = ((offset + 32u)) / 4; - const int scalar_offset_3 = ((offset + 48u)) / 4; + 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])}}}; return tint_symbol_5; }