From a1ee8834aa497fabe95386e5bd7a88f950975c92 Mon Sep 17 00:00:00 2001 From: dan sinclair Date: Tue, 19 Nov 2024 16:51:17 +0000 Subject: [PATCH] [hlsl] Update DecomposeStorageAccess to conditionalize Convert creation. When generating the decomposed indices we only need to create a `Convert` instruction if the types don't match. Bug: 379684039 Change-Id: Iac61a657c55239387b37528327bb76a2d3690a87 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/215634 Commit-Queue: James Price Reviewed-by: James Price --- src/tint/lang/hlsl/writer/access_test.cc | 9 +- src/tint/lang/hlsl/writer/arraylength_test.cc | 4 +- .../writer/raise/decompose_storage_access.cc | 7 +- .../raise/decompose_storage_access_test.cc | 134 ++++++++---------- .../read.wgsl.expected.ir.dxc.hlsl | 44 +++--- .../read.wgsl.expected.ir.fxc.hlsl | 44 +++--- .../read_f16.wgsl.expected.ir.dxc.hlsl | 72 +++++----- .../write.wgsl.expected.ir.dxc.hlsl | 49 +++---- .../write.wgsl.expected.ir.fxc.hlsl | 49 +++---- .../write_f16.wgsl.expected.ir.dxc.hlsl | 79 +++++------ .../1273230.wgsl.expected.ir.dxc.hlsl | 28 ++-- .../1273230.wgsl.expected.ir.fxc.hlsl | 28 ++-- .../1434271.wgsl.expected.ir.dxc.hlsl | 38 +++-- .../storage_var.wgsl.expected.ir.dxc.hlsl | 2 +- .../storage_var.wgsl.expected.ir.fxc.hlsl | 2 +- .../bug/tint/1113.wgsl.expected.ir.dxc.hlsl | 61 ++++---- .../bug/tint/1113.wgsl.expected.ir.fxc.hlsl | 61 ++++---- .../bug/tint/1121.wgsl.expected.ir.dxc.hlsl | 74 +++++----- .../bug/tint/1121.wgsl.expected.ir.fxc.hlsl | 74 +++++----- .../bug/tint/1725.wgsl.expected.ir.dxc.hlsl | 2 +- .../bug/tint/1725.wgsl.expected.ir.fxc.hlsl | 2 +- .../bug/tint/1875.wgsl.expected.ir.dxc.hlsl | 2 +- .../bug/tint/1875.wgsl.expected.ir.fxc.hlsl | 2 +- .../bug/tint/221.wgsl.expected.ir.dxc.hlsl | 2 +- .../bug/tint/221.wgsl.expected.ir.fxc.hlsl | 2 +- .../tint/379127084.wgsl.expected.ir.dxc.hlsl | 55 ++++--- .../tint/379127084.wgsl.expected.ir.fxc.hlsl | 61 ++++---- test/tint/bug/tint/379684039-2.wgsl | 19 +++ .../tint/379684039-2.wgsl.expected.dxc.hlsl | 17 +++ .../tint/379684039-2.wgsl.expected.fxc.hlsl | 17 +++ .../bug/tint/379684039-2.wgsl.expected.glsl | 33 +++++ .../379684039-2.wgsl.expected.ir.dxc.hlsl | 21 +++ .../379684039-2.wgsl.expected.ir.fxc.hlsl | 21 +++ .../bug/tint/379684039-2.wgsl.expected.ir.msl | 46 ++++++ .../bug/tint/379684039-2.wgsl.expected.msl | 43 ++++++ .../bug/tint/379684039-2.wgsl.expected.spvasm | 84 +++++++++++ .../bug/tint/379684039-2.wgsl.expected.wgsl | 21 +++ .../bug/tint/534.wgsl.expected.ir.dxc.hlsl | 4 +- .../bug/tint/534.wgsl.expected.ir.fxc.hlsl | 4 +- .../bug/tint/744.wgsl.expected.ir.dxc.hlsl | 7 +- .../bug/tint/744.wgsl.expected.ir.fxc.hlsl | 7 +- .../bug/tint/757.wgsl.expected.ir.dxc.hlsl | 3 +- .../bug/tint/757.wgsl.expected.ir.fxc.hlsl | 3 +- .../bug/tint/827.wgsl.expected.ir.dxc.hlsl | 7 +- .../bug/tint/827.wgsl.expected.ir.fxc.hlsl | 7 +- .../bug/tint/913.wgsl.expected.ir.dxc.hlsl | 4 +- .../bug/tint/913.wgsl.expected.ir.fxc.hlsl | 4 +- .../bug/tint/914.wgsl.expected.ir.dxc.hlsl | 6 +- .../bug/tint/914.wgsl.expected.ir.fxc.hlsl | 6 +- .../bug/tint/993.wgsl.expected.ir.dxc.hlsl | 2 +- .../bug/tint/993.wgsl.expected.ir.fxc.hlsl | 2 +- .../struct_in_array.wgsl.expected.ir.dxc.hlsl | 2 +- .../struct_in_array.wgsl.expected.ir.fxc.hlsl | 2 +- ...c2_f32_in_mat2x2.wgsl.expected.ir.dxc.hlsl | 2 +- ...c2_f32_in_mat2x2.wgsl.expected.ir.fxc.hlsl | 2 +- ...c4_f32_in_mat2x4.wgsl.expected.ir.dxc.hlsl | 2 +- ...c4_f32_in_mat2x4.wgsl.expected.ir.fxc.hlsl | 2 +- .../struct_in_array.wgsl.expected.ir.dxc.hlsl | 2 +- .../struct_in_array.wgsl.expected.ir.fxc.hlsl | 2 +- ...c2_f32_in_mat2x2.wgsl.expected.ir.dxc.hlsl | 2 +- ...c2_f32_in_mat2x2.wgsl.expected.ir.fxc.hlsl | 2 +- ...c4_f32_in_mat2x4.wgsl.expected.ir.dxc.hlsl | 2 +- ...c4_f32_in_mat2x4.wgsl.expected.ir.fxc.hlsl | 2 +- .../compute_boids.wgsl.expected.ir.dxc.hlsl | 22 ++- .../compute_boids.wgsl.expected.ir.fxc.hlsl | 22 ++- ...ct_dynamic_array.wgsl.expected.ir.dxc.hlsl | 5 +- ...ct_dynamic_array.wgsl.expected.ir.fxc.hlsl | 5 +- ...ray_struct_array.wgsl.expected.ir.dxc.hlsl | 7 +- ...ray_struct_array.wgsl.expected.ir.fxc.hlsl | 7 +- ...ubgroup_builtins.wgsl.expected.ir.dxc.hlsl | 2 +- ..._builtins_struct.wgsl.expected.ir.dxc.hlsl | 2 +- ...ubgroup_builtins.wgsl.expected.ir.dxc.hlsl | 2 +- ..._builtins_struct.wgsl.expected.ir.dxc.hlsl | 2 +- 73 files changed, 866 insertions(+), 609 deletions(-) create mode 100644 test/tint/bug/tint/379684039-2.wgsl create mode 100644 test/tint/bug/tint/379684039-2.wgsl.expected.dxc.hlsl create mode 100644 test/tint/bug/tint/379684039-2.wgsl.expected.fxc.hlsl create mode 100644 test/tint/bug/tint/379684039-2.wgsl.expected.glsl create mode 100644 test/tint/bug/tint/379684039-2.wgsl.expected.ir.dxc.hlsl create mode 100644 test/tint/bug/tint/379684039-2.wgsl.expected.ir.fxc.hlsl create mode 100644 test/tint/bug/tint/379684039-2.wgsl.expected.ir.msl create mode 100644 test/tint/bug/tint/379684039-2.wgsl.expected.msl create mode 100644 test/tint/bug/tint/379684039-2.wgsl.expected.spvasm create mode 100644 test/tint/bug/tint/379684039-2.wgsl.expected.wgsl diff --git a/src/tint/lang/hlsl/writer/access_test.cc b/src/tint/lang/hlsl/writer/access_test.cc index 147d96e4fe4..1c38b5b3c0c 100644 --- a/src/tint/lang/hlsl/writer/access_test.cc +++ b/src/tint/lang/hlsl/writer/access_test.cc @@ -718,9 +718,8 @@ void foo() { uint v_2 = 0u; sb.GetDimensions(v_2); uint v_3 = (((v_2 - 16u) / 128u) - 1u); - uint v_4 = (uint(min(uint(i), v_3)) * 128u); - uint v_5 = (uint(min(v, 2u)) * 32u); - float x = asfloat(sb.Load((((48u + v_4) + v_5) + (uint(min(uint(v_1), 2u)) * 4u)))); + uint v_4 = (min(uint(i), v_3) * 128u); + float x = asfloat(sb.Load((((48u + v_4) + (min(v, 2u) * 32u)) + (min(uint(v_1), 2u) * 4u)))); } )"); @@ -763,9 +762,7 @@ void foo() { uint j = 1u; uint v = 0u; sb.GetDimensions(v); - uint v_1 = min(j, 2u); - uint v_2 = (uint(min(4u, (((v - 16u) / 128u) - 1u))) * 128u); - float x = asfloat(sb.Load(((56u + v_2) + (uint(v_1) * 32u)))); + float x = asfloat(sb.Load(((56u + (min(4u, (((v - 16u) / 128u) - 1u)) * 128u)) + (min(j, 2u) * 32u)))); } )"); diff --git a/src/tint/lang/hlsl/writer/arraylength_test.cc b/src/tint/lang/hlsl/writer/arraylength_test.cc index ed6031f8f47..1f4c7c49da0 100644 --- a/src/tint/lang/hlsl/writer/arraylength_test.cc +++ b/src/tint/lang/hlsl/writer/arraylength_test.cc @@ -247,7 +247,7 @@ RWByteAddressBuffer dst : register(u1); void foo() { uint v = 0u; dst.GetDimensions(v); - dst.Store((0u + (uint(min(0u, ((v / 4u) - 1u))) * 4u)), 123u); + dst.Store((0u + (min(0u, ((v / 4u) - 1u)) * 4u)), 123u); } )"); @@ -275,7 +275,7 @@ cbuffer cbuffer_tint_storage_buffer_sizes : register(b0, space30) { uint4 tint_storage_buffer_sizes[1]; }; void foo() { - dst.Store((0u + (uint(min(0u, ((tint_storage_buffer_sizes[0u].x / 4u) - 1u))) * 4u)), 123u); + dst.Store((0u + (min(0u, ((tint_storage_buffer_sizes[0u].x / 4u) - 1u)) * 4u)), 123u); } )"); diff --git a/src/tint/lang/hlsl/writer/raise/decompose_storage_access.cc b/src/tint/lang/hlsl/writer/raise/decompose_storage_access.cc index e744c22b88b..f5e60f91307 100644 --- a/src/tint/lang/hlsl/writer/raise/decompose_storage_access.cc +++ b/src/tint/lang/hlsl/writer/raise/decompose_storage_access.cc @@ -359,8 +359,11 @@ struct State { offset->byte_offset += idx_value->Value()->ValueAs() * elm_size; }, [&](core::ir::Value* val) { - offset->expr.Push( - b.Multiply(ty.u32(), b.Convert(ty.u32(), val), u32(elm_size))->Result(0)); + auto* idx = val; + if (val->Type() != ty.u32()) { + idx = b.Convert(ty.u32(), val)->Result(0); + } + offset->expr.Push(b.Multiply(ty.u32(), idx, u32(elm_size))->Result(0)); }, TINT_ICE_ON_NO_MATCH); } diff --git a/src/tint/lang/hlsl/writer/raise/decompose_storage_access_test.cc b/src/tint/lang/hlsl/writer/raise/decompose_storage_access_test.cc index 8c4476d8a79..1d2db45b2d7 100644 --- a/src/tint/lang/hlsl/writer/raise/decompose_storage_access_test.cc +++ b/src/tint/lang/hlsl/writer/raise/decompose_storage_access_test.cc @@ -1183,16 +1183,15 @@ SB = struct @align(16) { %8:i32 = load %k %9:u32 = convert %4 %10:u32 = mul %9, 128u - %11:u32 = convert %6 - %12:u32 = mul %11, 32u - %13:u32 = convert %8 - %14:u32 = mul %13, 4u - %15:u32 = add 48u, %10 - %16:u32 = add %15, %12 - %17:u32 = add %16, %14 - %18:u32 = %sb.Load %17 - %19:f32 = bitcast %18 - %x:f32 = let %19 + %11:u32 = mul %6, 32u + %12:u32 = convert %8 + %13:u32 = mul %12, 4u + %14:u32 = add 48u, %10 + %15:u32 = add %14, %11 + %16:u32 = add %15, %13 + %17:u32 = %sb.Load %16 + %18:f32 = bitcast %17 + %x:f32 = let %18 ret } } @@ -1294,12 +1293,11 @@ SB = struct @align(16) { $B2: { %j:ptr = var, 1u %4:u32 = load %j - %5:u32 = convert %4 - %6:u32 = mul %5, 32u - %7:u32 = add 568u, %6 - %8:u32 = %sb.Load %7 - %9:f32 = bitcast %8 - %x:f32 = let %9 + %5:u32 = mul %4, 32u + %6:u32 = add 568u, %5 + %7:u32 = %sb.Load %6 + %8:f32 = bitcast %7 + %x:f32 = let %8 ret } } @@ -1436,15 +1434,13 @@ S2 = struct @align(16) { %foo = @fragment func(%3:u32):void { $B2: { - %4:u32 = convert %3 - %5:u32 = mul %4, 32u - %6:u32 = convert %3 - %7:u32 = mul %6, 4u - %8:ptr = var, 0i - %9:u32 = add 16u, %5 - %10:u32 = add %9, %7 - %11:i32 = convert %10 - %12:void = %v.InterlockedExchange %11, 123i, %8 + %4:u32 = mul %3, 32u + %5:u32 = mul %3, 4u + %6:ptr = var, 0i + %7:u32 = add 16u, %4 + %8:u32 = add %7, %5 + %9:i32 = convert %8 + %10:void = %v.InterlockedExchange %9, 123i, %6 ret } } @@ -1629,17 +1625,15 @@ S2 = struct @align(16) { %foo = @fragment func(%3:u32):void { $B2: { - %4:u32 = convert %3 - %5:u32 = mul %4, 32u - %6:u32 = convert %3 - %7:u32 = mul %6, 4u - %8:ptr = var, 0i - %9:u32 = add 16u, %5 - %10:u32 = add %9, %7 - %11:i32 = convert %10 - %12:void = %v.InterlockedOr %11, 0i, %8 - %13:i32 = load %8 - %x:i32 = let %13 + %4:u32 = mul %3, 32u + %5:u32 = mul %3, 4u + %6:ptr = var, 0i + %7:u32 = add 16u, %4 + %8:u32 = add %7, %5 + %9:i32 = convert %8 + %10:void = %v.InterlockedOr %9, 0i, %6 + %11:i32 = load %6 + %x:i32 = let %11 ret } } @@ -1828,18 +1822,16 @@ S2 = struct @align(16) { %foo = @fragment func(%3:u32):void { $B2: { - %4:u32 = convert %3 - %5:u32 = mul %4, 32u - %6:u32 = convert %3 - %7:u32 = mul %6, 4u - %8:ptr = var, 0i - %9:i32 = sub 0i, 123i - %10:u32 = add 16u, %5 - %11:u32 = add %10, %7 - %12:i32 = convert %11 - %13:void = %v.InterlockedAdd %12, %9, %8 - %14:i32 = load %8 - %x:i32 = let %14 + %4:u32 = mul %3, 32u + %5:u32 = mul %3, 4u + %6:ptr = var, 0i + %7:i32 = sub 0i, 123i + %8:u32 = add 16u, %4 + %9:u32 = add %8, %5 + %10:i32 = convert %9 + %11:void = %v.InterlockedAdd %10, %7, %6 + %12:i32 = load %6 + %x:i32 = let %12 ret } } @@ -2053,19 +2045,17 @@ __atomic_compare_exchange_result_i32 = struct @align(4) { %foo = @fragment func(%3:u32):void { $B2: { - %4:u32 = convert %3 - %5:u32 = mul %4, 32u - %6:u32 = convert %3 - %7:u32 = mul %6, 4u - %8:ptr = var, 0i - %9:u32 = add 16u, %5 - %10:u32 = add %9, %7 - %11:i32 = convert %10 - %12:void = %v.InterlockedCompareExchange %11, 123i, 345i, %8 - %13:i32 = load %8 - %14:bool = eq %13, 123i - %15:__atomic_compare_exchange_result_i32 = construct %13, %14 - %x:__atomic_compare_exchange_result_i32 = let %15 + %4:u32 = mul %3, 32u + %5:u32 = mul %3, 4u + %6:ptr = var, 0i + %7:u32 = add 16u, %4 + %8:u32 = add %7, %5 + %9:i32 = convert %8 + %10:void = %v.InterlockedCompareExchange %9, 123i, 345i, %6 + %11:i32 = load %6 + %12:bool = eq %11, 123i + %13:__atomic_compare_exchange_result_i32 = construct %11, %12 + %x:__atomic_compare_exchange_result_i32 = let %13 ret } } @@ -2331,18 +2321,16 @@ S2 = struct @align(4) { %foo = @fragment func(%3:u32):void { $B2: { - %4:u32 = convert %3 - %5:u32 = mul %4, 12u - %6:u32 = convert %3 - %7:u32 = mul %6, 4u - %8:ptr = var, 0u - %9:u32 = add 0u, %5 - %10:u32 = add %9, %7 - %11:u32 = convert %10 - %12:void = %v.)" + - std::string(param.interlock) + R"( %11, 123u, %8 - %13:u32 = load %8 - %x:u32 = let %13 + %4:u32 = mul %3, 12u + %5:u32 = mul %3, 4u + %6:ptr = var, 0u + %7:u32 = add 0u, %4 + %8:u32 = add %7, %5 + %9:u32 = convert %8 + %10:void = %v.)" + + std::string(param.interlock) + R"( %9, 123u, %6 + %11:u32 = load %6 + %x:u32 = let %11 ret } } diff --git a/test/tint/buffer/storage/dynamic_index/read.wgsl.expected.ir.dxc.hlsl b/test/tint/buffer/storage/dynamic_index/read.wgsl.expected.ir.dxc.hlsl index 27ec962b340..233aa7c976b 100644 --- a/test/tint/buffer/storage/dynamic_index/read.wgsl.expected.ir.dxc.hlsl +++ b/test/tint/buffer/storage/dynamic_index/read.wgsl.expected.ir.dxc.hlsl @@ -68,28 +68,28 @@ float2x2 v_12(uint offset) { } void main_inner(uint idx) { - float scalar_f32 = asfloat(sb.Load((0u + (uint(idx) * 544u)))); - int scalar_i32 = asint(sb.Load((4u + (uint(idx) * 544u)))); - uint scalar_u32 = sb.Load((8u + (uint(idx) * 544u))); - float2 vec2_f32 = asfloat(sb.Load2((16u + (uint(idx) * 544u)))); - int2 vec2_i32 = asint(sb.Load2((24u + (uint(idx) * 544u)))); - uint2 vec2_u32 = sb.Load2((32u + (uint(idx) * 544u))); - float3 vec3_f32 = asfloat(sb.Load3((48u + (uint(idx) * 544u)))); - int3 vec3_i32 = asint(sb.Load3((64u + (uint(idx) * 544u)))); - uint3 vec3_u32 = sb.Load3((80u + (uint(idx) * 544u))); - float4 vec4_f32 = asfloat(sb.Load4((96u + (uint(idx) * 544u)))); - int4 vec4_i32 = asint(sb.Load4((112u + (uint(idx) * 544u)))); - uint4 vec4_u32 = sb.Load4((128u + (uint(idx) * 544u))); - float2x2 mat2x2_f32 = v_12((144u + (uint(idx) * 544u))); - float2x3 mat2x3_f32 = v_11((160u + (uint(idx) * 544u))); - float2x4 mat2x4_f32 = v_10((192u + (uint(idx) * 544u))); - float3x2 mat3x2_f32 = v_9((224u + (uint(idx) * 544u))); - float3x3 mat3x3_f32 = v_8((256u + (uint(idx) * 544u))); - float3x4 mat3x4_f32 = v_7((304u + (uint(idx) * 544u))); - float4x2 mat4x2_f32 = v_6((352u + (uint(idx) * 544u))); - float4x3 mat4x3_f32 = v_5((384u + (uint(idx) * 544u))); - float4x4 mat4x4_f32 = v_4((448u + (uint(idx) * 544u))); - float3 arr2_vec3_f32[2] = v((512u + (uint(idx) * 544u))); + float scalar_f32 = asfloat(sb.Load((0u + (idx * 544u)))); + int scalar_i32 = asint(sb.Load((4u + (idx * 544u)))); + uint scalar_u32 = sb.Load((8u + (idx * 544u))); + float2 vec2_f32 = asfloat(sb.Load2((16u + (idx * 544u)))); + int2 vec2_i32 = asint(sb.Load2((24u + (idx * 544u)))); + uint2 vec2_u32 = sb.Load2((32u + (idx * 544u))); + float3 vec3_f32 = asfloat(sb.Load3((48u + (idx * 544u)))); + int3 vec3_i32 = asint(sb.Load3((64u + (idx * 544u)))); + uint3 vec3_u32 = sb.Load3((80u + (idx * 544u))); + float4 vec4_f32 = asfloat(sb.Load4((96u + (idx * 544u)))); + int4 vec4_i32 = asint(sb.Load4((112u + (idx * 544u)))); + uint4 vec4_u32 = sb.Load4((128u + (idx * 544u))); + float2x2 mat2x2_f32 = v_12((144u + (idx * 544u))); + float2x3 mat2x3_f32 = v_11((160u + (idx * 544u))); + float2x4 mat2x4_f32 = v_10((192u + (idx * 544u))); + float3x2 mat3x2_f32 = v_9((224u + (idx * 544u))); + float3x3 mat3x3_f32 = v_8((256u + (idx * 544u))); + float3x4 mat3x4_f32 = v_7((304u + (idx * 544u))); + float4x2 mat4x2_f32 = v_6((352u + (idx * 544u))); + float4x3 mat4x3_f32 = v_5((384u + (idx * 544u))); + float4x4 mat4x4_f32 = v_4((448u + (idx * 544u))); + float3 arr2_vec3_f32[2] = v((512u + (idx * 544u))); int v_13 = (tint_f32_to_i32(scalar_f32) + scalar_i32); int v_14 = (v_13 + int(scalar_u32)); int v_15 = ((v_14 + tint_f32_to_i32(vec2_f32.x)) + vec2_i32.x); diff --git a/test/tint/buffer/storage/dynamic_index/read.wgsl.expected.ir.fxc.hlsl b/test/tint/buffer/storage/dynamic_index/read.wgsl.expected.ir.fxc.hlsl index 27ec962b340..233aa7c976b 100644 --- a/test/tint/buffer/storage/dynamic_index/read.wgsl.expected.ir.fxc.hlsl +++ b/test/tint/buffer/storage/dynamic_index/read.wgsl.expected.ir.fxc.hlsl @@ -68,28 +68,28 @@ float2x2 v_12(uint offset) { } void main_inner(uint idx) { - float scalar_f32 = asfloat(sb.Load((0u + (uint(idx) * 544u)))); - int scalar_i32 = asint(sb.Load((4u + (uint(idx) * 544u)))); - uint scalar_u32 = sb.Load((8u + (uint(idx) * 544u))); - float2 vec2_f32 = asfloat(sb.Load2((16u + (uint(idx) * 544u)))); - int2 vec2_i32 = asint(sb.Load2((24u + (uint(idx) * 544u)))); - uint2 vec2_u32 = sb.Load2((32u + (uint(idx) * 544u))); - float3 vec3_f32 = asfloat(sb.Load3((48u + (uint(idx) * 544u)))); - int3 vec3_i32 = asint(sb.Load3((64u + (uint(idx) * 544u)))); - uint3 vec3_u32 = sb.Load3((80u + (uint(idx) * 544u))); - float4 vec4_f32 = asfloat(sb.Load4((96u + (uint(idx) * 544u)))); - int4 vec4_i32 = asint(sb.Load4((112u + (uint(idx) * 544u)))); - uint4 vec4_u32 = sb.Load4((128u + (uint(idx) * 544u))); - float2x2 mat2x2_f32 = v_12((144u + (uint(idx) * 544u))); - float2x3 mat2x3_f32 = v_11((160u + (uint(idx) * 544u))); - float2x4 mat2x4_f32 = v_10((192u + (uint(idx) * 544u))); - float3x2 mat3x2_f32 = v_9((224u + (uint(idx) * 544u))); - float3x3 mat3x3_f32 = v_8((256u + (uint(idx) * 544u))); - float3x4 mat3x4_f32 = v_7((304u + (uint(idx) * 544u))); - float4x2 mat4x2_f32 = v_6((352u + (uint(idx) * 544u))); - float4x3 mat4x3_f32 = v_5((384u + (uint(idx) * 544u))); - float4x4 mat4x4_f32 = v_4((448u + (uint(idx) * 544u))); - float3 arr2_vec3_f32[2] = v((512u + (uint(idx) * 544u))); + float scalar_f32 = asfloat(sb.Load((0u + (idx * 544u)))); + int scalar_i32 = asint(sb.Load((4u + (idx * 544u)))); + uint scalar_u32 = sb.Load((8u + (idx * 544u))); + float2 vec2_f32 = asfloat(sb.Load2((16u + (idx * 544u)))); + int2 vec2_i32 = asint(sb.Load2((24u + (idx * 544u)))); + uint2 vec2_u32 = sb.Load2((32u + (idx * 544u))); + float3 vec3_f32 = asfloat(sb.Load3((48u + (idx * 544u)))); + int3 vec3_i32 = asint(sb.Load3((64u + (idx * 544u)))); + uint3 vec3_u32 = sb.Load3((80u + (idx * 544u))); + float4 vec4_f32 = asfloat(sb.Load4((96u + (idx * 544u)))); + int4 vec4_i32 = asint(sb.Load4((112u + (idx * 544u)))); + uint4 vec4_u32 = sb.Load4((128u + (idx * 544u))); + float2x2 mat2x2_f32 = v_12((144u + (idx * 544u))); + float2x3 mat2x3_f32 = v_11((160u + (idx * 544u))); + float2x4 mat2x4_f32 = v_10((192u + (idx * 544u))); + float3x2 mat3x2_f32 = v_9((224u + (idx * 544u))); + float3x3 mat3x3_f32 = v_8((256u + (idx * 544u))); + float3x4 mat3x4_f32 = v_7((304u + (idx * 544u))); + float4x2 mat4x2_f32 = v_6((352u + (idx * 544u))); + float4x3 mat4x3_f32 = v_5((384u + (idx * 544u))); + float4x4 mat4x4_f32 = v_4((448u + (idx * 544u))); + float3 arr2_vec3_f32[2] = v((512u + (idx * 544u))); int v_13 = (tint_f32_to_i32(scalar_f32) + scalar_i32); int v_14 = (v_13 + int(scalar_u32)); int v_15 = ((v_14 + tint_f32_to_i32(vec2_f32.x)) + vec2_i32.x); diff --git a/test/tint/buffer/storage/dynamic_index/read_f16.wgsl.expected.ir.dxc.hlsl b/test/tint/buffer/storage/dynamic_index/read_f16.wgsl.expected.ir.dxc.hlsl index 16ce66f96c5..fe5f9bd0cd6 100644 --- a/test/tint/buffer/storage/dynamic_index/read_f16.wgsl.expected.ir.dxc.hlsl +++ b/test/tint/buffer/storage/dynamic_index/read_f16.wgsl.expected.ir.dxc.hlsl @@ -130,42 +130,42 @@ float2x2 v_25(uint offset) { } void main_inner(uint idx) { - float scalar_f32 = asfloat(sb.Load((0u + (uint(idx) * 800u)))); - int scalar_i32 = asint(sb.Load((4u + (uint(idx) * 800u)))); - uint scalar_u32 = sb.Load((8u + (uint(idx) * 800u))); - float16_t scalar_f16 = sb.Load((12u + (uint(idx) * 800u))); - float2 vec2_f32 = asfloat(sb.Load2((16u + (uint(idx) * 800u)))); - int2 vec2_i32 = asint(sb.Load2((24u + (uint(idx) * 800u)))); - uint2 vec2_u32 = sb.Load2((32u + (uint(idx) * 800u))); - vector vec2_f16 = sb.Load >((40u + (uint(idx) * 800u))); - float3 vec3_f32 = asfloat(sb.Load3((48u + (uint(idx) * 800u)))); - int3 vec3_i32 = asint(sb.Load3((64u + (uint(idx) * 800u)))); - uint3 vec3_u32 = sb.Load3((80u + (uint(idx) * 800u))); - vector vec3_f16 = sb.Load >((96u + (uint(idx) * 800u))); - float4 vec4_f32 = asfloat(sb.Load4((112u + (uint(idx) * 800u)))); - int4 vec4_i32 = asint(sb.Load4((128u + (uint(idx) * 800u)))); - uint4 vec4_u32 = sb.Load4((144u + (uint(idx) * 800u))); - vector vec4_f16 = sb.Load >((160u + (uint(idx) * 800u))); - float2x2 mat2x2_f32 = v_25((168u + (uint(idx) * 800u))); - float2x3 mat2x3_f32 = v_24((192u + (uint(idx) * 800u))); - float2x4 mat2x4_f32 = v_23((224u + (uint(idx) * 800u))); - float3x2 mat3x2_f32 = v_22((256u + (uint(idx) * 800u))); - float3x3 mat3x3_f32 = v_21((288u + (uint(idx) * 800u))); - float3x4 mat3x4_f32 = v_20((336u + (uint(idx) * 800u))); - float4x2 mat4x2_f32 = v_19((384u + (uint(idx) * 800u))); - float4x3 mat4x3_f32 = v_18((416u + (uint(idx) * 800u))); - float4x4 mat4x4_f32 = v_17((480u + (uint(idx) * 800u))); - matrix mat2x2_f16 = v_16((544u + (uint(idx) * 800u))); - matrix mat2x3_f16 = v_15((552u + (uint(idx) * 800u))); - matrix mat2x4_f16 = v_14((568u + (uint(idx) * 800u))); - matrix mat3x2_f16 = v_13((584u + (uint(idx) * 800u))); - matrix mat3x3_f16 = v_12((600u + (uint(idx) * 800u))); - matrix mat3x4_f16 = v_11((624u + (uint(idx) * 800u))); - matrix mat4x2_f16 = v((648u + (uint(idx) * 800u))); - matrix mat4x3_f16 = v_10((664u + (uint(idx) * 800u))); - matrix mat4x4_f16 = v_9((696u + (uint(idx) * 800u))); - float3 arr2_vec3_f32[2] = v_5((736u + (uint(idx) * 800u))); - matrix arr2_mat4x2_f16[2] = v_1((768u + (uint(idx) * 800u))); + float scalar_f32 = asfloat(sb.Load((0u + (idx * 800u)))); + int scalar_i32 = asint(sb.Load((4u + (idx * 800u)))); + uint scalar_u32 = sb.Load((8u + (idx * 800u))); + float16_t scalar_f16 = sb.Load((12u + (idx * 800u))); + float2 vec2_f32 = asfloat(sb.Load2((16u + (idx * 800u)))); + int2 vec2_i32 = asint(sb.Load2((24u + (idx * 800u)))); + uint2 vec2_u32 = sb.Load2((32u + (idx * 800u))); + vector vec2_f16 = sb.Load >((40u + (idx * 800u))); + float3 vec3_f32 = asfloat(sb.Load3((48u + (idx * 800u)))); + int3 vec3_i32 = asint(sb.Load3((64u + (idx * 800u)))); + uint3 vec3_u32 = sb.Load3((80u + (idx * 800u))); + vector vec3_f16 = sb.Load >((96u + (idx * 800u))); + float4 vec4_f32 = asfloat(sb.Load4((112u + (idx * 800u)))); + int4 vec4_i32 = asint(sb.Load4((128u + (idx * 800u)))); + uint4 vec4_u32 = sb.Load4((144u + (idx * 800u))); + vector vec4_f16 = sb.Load >((160u + (idx * 800u))); + float2x2 mat2x2_f32 = v_25((168u + (idx * 800u))); + float2x3 mat2x3_f32 = v_24((192u + (idx * 800u))); + float2x4 mat2x4_f32 = v_23((224u + (idx * 800u))); + float3x2 mat3x2_f32 = v_22((256u + (idx * 800u))); + float3x3 mat3x3_f32 = v_21((288u + (idx * 800u))); + float3x4 mat3x4_f32 = v_20((336u + (idx * 800u))); + float4x2 mat4x2_f32 = v_19((384u + (idx * 800u))); + float4x3 mat4x3_f32 = v_18((416u + (idx * 800u))); + float4x4 mat4x4_f32 = v_17((480u + (idx * 800u))); + matrix mat2x2_f16 = v_16((544u + (idx * 800u))); + matrix mat2x3_f16 = v_15((552u + (idx * 800u))); + matrix mat2x4_f16 = v_14((568u + (idx * 800u))); + matrix mat3x2_f16 = v_13((584u + (idx * 800u))); + matrix mat3x3_f16 = v_12((600u + (idx * 800u))); + matrix mat3x4_f16 = v_11((624u + (idx * 800u))); + matrix mat4x2_f16 = v((648u + (idx * 800u))); + matrix mat4x3_f16 = v_10((664u + (idx * 800u))); + matrix mat4x4_f16 = v_9((696u + (idx * 800u))); + float3 arr2_vec3_f32[2] = v_5((736u + (idx * 800u))); + matrix arr2_mat4x2_f16[2] = v_1((768u + (idx * 800u))); int v_26 = (tint_f32_to_i32(scalar_f32) + scalar_i32); int v_27 = (v_26 + int(scalar_u32)); int v_28 = (v_27 + tint_f16_to_i32(scalar_f16)); diff --git a/test/tint/buffer/storage/dynamic_index/write.wgsl.expected.ir.dxc.hlsl b/test/tint/buffer/storage/dynamic_index/write.wgsl.expected.ir.dxc.hlsl index 87817374a52..7b4c9e18d91 100644 --- a/test/tint/buffer/storage/dynamic_index/write.wgsl.expected.ir.dxc.hlsl +++ b/test/tint/buffer/storage/dynamic_index/write.wgsl.expected.ir.dxc.hlsl @@ -77,32 +77,29 @@ void v_11(uint offset, float2x2 obj) { } void main_inner(uint idx) { - sb.Store((0u + (uint(idx) * 544u)), asuint(0.0f)); - sb.Store((4u + (uint(idx) * 544u)), asuint(int(0))); - sb.Store((8u + (uint(idx) * 544u)), 0u); - sb.Store2((16u + (uint(idx) * 544u)), asuint((0.0f).xx)); - uint v_12 = (24u + (uint(idx) * 544u)); - sb.Store2(v_12, asuint(int2((int(0)).xx))); - sb.Store2((32u + (uint(idx) * 544u)), (0u).xx); - sb.Store3((48u + (uint(idx) * 544u)), asuint((0.0f).xxx)); - uint v_13 = (64u + (uint(idx) * 544u)); - sb.Store3(v_13, asuint(int3((int(0)).xxx))); - sb.Store3((80u + (uint(idx) * 544u)), (0u).xxx); - sb.Store4((96u + (uint(idx) * 544u)), asuint((0.0f).xxxx)); - uint v_14 = (112u + (uint(idx) * 544u)); - sb.Store4(v_14, asuint(int4((int(0)).xxxx))); - sb.Store4((128u + (uint(idx) * 544u)), (0u).xxxx); - v_11((144u + (uint(idx) * 544u)), float2x2((0.0f).xx, (0.0f).xx)); - v_10((160u + (uint(idx) * 544u)), float2x3((0.0f).xxx, (0.0f).xxx)); - v_9((192u + (uint(idx) * 544u)), float2x4((0.0f).xxxx, (0.0f).xxxx)); - v_8((224u + (uint(idx) * 544u)), float3x2((0.0f).xx, (0.0f).xx, (0.0f).xx)); - v_7((256u + (uint(idx) * 544u)), float3x3((0.0f).xxx, (0.0f).xxx, (0.0f).xxx)); - v_6((304u + (uint(idx) * 544u)), float3x4((0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx)); - v_5((352u + (uint(idx) * 544u)), float4x2((0.0f).xx, (0.0f).xx, (0.0f).xx, (0.0f).xx)); - v_4((384u + (uint(idx) * 544u)), float4x3((0.0f).xxx, (0.0f).xxx, (0.0f).xxx, (0.0f).xxx)); - v_3((448u + (uint(idx) * 544u)), float4x4((0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx)); - float3 v_15[2] = (float3[2])0; - v((512u + (uint(idx) * 544u)), v_15); + sb.Store((0u + (idx * 544u)), asuint(0.0f)); + sb.Store((4u + (idx * 544u)), asuint(int(0))); + sb.Store((8u + (idx * 544u)), 0u); + sb.Store2((16u + (idx * 544u)), asuint((0.0f).xx)); + sb.Store2((24u + (idx * 544u)), asuint(int2((int(0)).xx))); + sb.Store2((32u + (idx * 544u)), (0u).xx); + sb.Store3((48u + (idx * 544u)), asuint((0.0f).xxx)); + sb.Store3((64u + (idx * 544u)), asuint(int3((int(0)).xxx))); + sb.Store3((80u + (idx * 544u)), (0u).xxx); + sb.Store4((96u + (idx * 544u)), asuint((0.0f).xxxx)); + sb.Store4((112u + (idx * 544u)), asuint(int4((int(0)).xxxx))); + sb.Store4((128u + (idx * 544u)), (0u).xxxx); + v_11((144u + (idx * 544u)), float2x2((0.0f).xx, (0.0f).xx)); + v_10((160u + (idx * 544u)), float2x3((0.0f).xxx, (0.0f).xxx)); + v_9((192u + (idx * 544u)), float2x4((0.0f).xxxx, (0.0f).xxxx)); + v_8((224u + (idx * 544u)), float3x2((0.0f).xx, (0.0f).xx, (0.0f).xx)); + v_7((256u + (idx * 544u)), float3x3((0.0f).xxx, (0.0f).xxx, (0.0f).xxx)); + v_6((304u + (idx * 544u)), float3x4((0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx)); + v_5((352u + (idx * 544u)), float4x2((0.0f).xx, (0.0f).xx, (0.0f).xx, (0.0f).xx)); + v_4((384u + (idx * 544u)), float4x3((0.0f).xxx, (0.0f).xxx, (0.0f).xxx, (0.0f).xxx)); + v_3((448u + (idx * 544u)), float4x4((0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx)); + float3 v_12[2] = (float3[2])0; + v((512u + (idx * 544u)), v_12); } [numthreads(1, 1, 1)] diff --git a/test/tint/buffer/storage/dynamic_index/write.wgsl.expected.ir.fxc.hlsl b/test/tint/buffer/storage/dynamic_index/write.wgsl.expected.ir.fxc.hlsl index 87817374a52..7b4c9e18d91 100644 --- a/test/tint/buffer/storage/dynamic_index/write.wgsl.expected.ir.fxc.hlsl +++ b/test/tint/buffer/storage/dynamic_index/write.wgsl.expected.ir.fxc.hlsl @@ -77,32 +77,29 @@ void v_11(uint offset, float2x2 obj) { } void main_inner(uint idx) { - sb.Store((0u + (uint(idx) * 544u)), asuint(0.0f)); - sb.Store((4u + (uint(idx) * 544u)), asuint(int(0))); - sb.Store((8u + (uint(idx) * 544u)), 0u); - sb.Store2((16u + (uint(idx) * 544u)), asuint((0.0f).xx)); - uint v_12 = (24u + (uint(idx) * 544u)); - sb.Store2(v_12, asuint(int2((int(0)).xx))); - sb.Store2((32u + (uint(idx) * 544u)), (0u).xx); - sb.Store3((48u + (uint(idx) * 544u)), asuint((0.0f).xxx)); - uint v_13 = (64u + (uint(idx) * 544u)); - sb.Store3(v_13, asuint(int3((int(0)).xxx))); - sb.Store3((80u + (uint(idx) * 544u)), (0u).xxx); - sb.Store4((96u + (uint(idx) * 544u)), asuint((0.0f).xxxx)); - uint v_14 = (112u + (uint(idx) * 544u)); - sb.Store4(v_14, asuint(int4((int(0)).xxxx))); - sb.Store4((128u + (uint(idx) * 544u)), (0u).xxxx); - v_11((144u + (uint(idx) * 544u)), float2x2((0.0f).xx, (0.0f).xx)); - v_10((160u + (uint(idx) * 544u)), float2x3((0.0f).xxx, (0.0f).xxx)); - v_9((192u + (uint(idx) * 544u)), float2x4((0.0f).xxxx, (0.0f).xxxx)); - v_8((224u + (uint(idx) * 544u)), float3x2((0.0f).xx, (0.0f).xx, (0.0f).xx)); - v_7((256u + (uint(idx) * 544u)), float3x3((0.0f).xxx, (0.0f).xxx, (0.0f).xxx)); - v_6((304u + (uint(idx) * 544u)), float3x4((0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx)); - v_5((352u + (uint(idx) * 544u)), float4x2((0.0f).xx, (0.0f).xx, (0.0f).xx, (0.0f).xx)); - v_4((384u + (uint(idx) * 544u)), float4x3((0.0f).xxx, (0.0f).xxx, (0.0f).xxx, (0.0f).xxx)); - v_3((448u + (uint(idx) * 544u)), float4x4((0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx)); - float3 v_15[2] = (float3[2])0; - v((512u + (uint(idx) * 544u)), v_15); + sb.Store((0u + (idx * 544u)), asuint(0.0f)); + sb.Store((4u + (idx * 544u)), asuint(int(0))); + sb.Store((8u + (idx * 544u)), 0u); + sb.Store2((16u + (idx * 544u)), asuint((0.0f).xx)); + sb.Store2((24u + (idx * 544u)), asuint(int2((int(0)).xx))); + sb.Store2((32u + (idx * 544u)), (0u).xx); + sb.Store3((48u + (idx * 544u)), asuint((0.0f).xxx)); + sb.Store3((64u + (idx * 544u)), asuint(int3((int(0)).xxx))); + sb.Store3((80u + (idx * 544u)), (0u).xxx); + sb.Store4((96u + (idx * 544u)), asuint((0.0f).xxxx)); + sb.Store4((112u + (idx * 544u)), asuint(int4((int(0)).xxxx))); + sb.Store4((128u + (idx * 544u)), (0u).xxxx); + v_11((144u + (idx * 544u)), float2x2((0.0f).xx, (0.0f).xx)); + v_10((160u + (idx * 544u)), float2x3((0.0f).xxx, (0.0f).xxx)); + v_9((192u + (idx * 544u)), float2x4((0.0f).xxxx, (0.0f).xxxx)); + v_8((224u + (idx * 544u)), float3x2((0.0f).xx, (0.0f).xx, (0.0f).xx)); + v_7((256u + (idx * 544u)), float3x3((0.0f).xxx, (0.0f).xxx, (0.0f).xxx)); + v_6((304u + (idx * 544u)), float3x4((0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx)); + v_5((352u + (idx * 544u)), float4x2((0.0f).xx, (0.0f).xx, (0.0f).xx, (0.0f).xx)); + v_4((384u + (idx * 544u)), float4x3((0.0f).xxx, (0.0f).xxx, (0.0f).xxx, (0.0f).xxx)); + v_3((448u + (idx * 544u)), float4x4((0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx)); + float3 v_12[2] = (float3[2])0; + v((512u + (idx * 544u)), v_12); } [numthreads(1, 1, 1)] diff --git a/test/tint/buffer/storage/dynamic_index/write_f16.wgsl.expected.ir.dxc.hlsl b/test/tint/buffer/storage/dynamic_index/write_f16.wgsl.expected.ir.dxc.hlsl index 1e2a82a0727..18469faac46 100644 --- a/test/tint/buffer/storage/dynamic_index/write_f16.wgsl.expected.ir.dxc.hlsl +++ b/test/tint/buffer/storage/dynamic_index/write_f16.wgsl.expected.ir.dxc.hlsl @@ -149,47 +149,44 @@ void v_23(uint offset, float2x2 obj) { } void main_inner(uint idx) { - sb.Store((0u + (uint(idx) * 800u)), asuint(0.0f)); - sb.Store((4u + (uint(idx) * 800u)), asuint(int(0))); - sb.Store((8u + (uint(idx) * 800u)), 0u); - sb.Store((12u + (uint(idx) * 800u)), float16_t(0.0h)); - sb.Store2((16u + (uint(idx) * 800u)), asuint((0.0f).xx)); - uint v_24 = (24u + (uint(idx) * 800u)); - sb.Store2(v_24, asuint(int2((int(0)).xx))); - sb.Store2((32u + (uint(idx) * 800u)), (0u).xx); - sb.Store >((40u + (uint(idx) * 800u)), (float16_t(0.0h)).xx); - sb.Store3((48u + (uint(idx) * 800u)), asuint((0.0f).xxx)); - uint v_25 = (64u + (uint(idx) * 800u)); - sb.Store3(v_25, asuint(int3((int(0)).xxx))); - sb.Store3((80u + (uint(idx) * 800u)), (0u).xxx); - sb.Store >((96u + (uint(idx) * 800u)), (float16_t(0.0h)).xxx); - sb.Store4((112u + (uint(idx) * 800u)), asuint((0.0f).xxxx)); - uint v_26 = (128u + (uint(idx) * 800u)); - sb.Store4(v_26, asuint(int4((int(0)).xxxx))); - sb.Store4((144u + (uint(idx) * 800u)), (0u).xxxx); - sb.Store >((160u + (uint(idx) * 800u)), (float16_t(0.0h)).xxxx); - v_23((168u + (uint(idx) * 800u)), float2x2((0.0f).xx, (0.0f).xx)); - v_22((192u + (uint(idx) * 800u)), float2x3((0.0f).xxx, (0.0f).xxx)); - v_21((224u + (uint(idx) * 800u)), float2x4((0.0f).xxxx, (0.0f).xxxx)); - v_20((256u + (uint(idx) * 800u)), float3x2((0.0f).xx, (0.0f).xx, (0.0f).xx)); - v_19((288u + (uint(idx) * 800u)), float3x3((0.0f).xxx, (0.0f).xxx, (0.0f).xxx)); - v_18((336u + (uint(idx) * 800u)), float3x4((0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx)); - v_17((384u + (uint(idx) * 800u)), float4x2((0.0f).xx, (0.0f).xx, (0.0f).xx, (0.0f).xx)); - v_16((416u + (uint(idx) * 800u)), float4x3((0.0f).xxx, (0.0f).xxx, (0.0f).xxx, (0.0f).xxx)); - v_15((480u + (uint(idx) * 800u)), float4x4((0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx)); - v_14((544u + (uint(idx) * 800u)), matrix((float16_t(0.0h)).xx, (float16_t(0.0h)).xx)); - v_13((552u + (uint(idx) * 800u)), matrix((float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx)); - v_12((568u + (uint(idx) * 800u)), matrix((float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx)); - v_11((584u + (uint(idx) * 800u)), matrix((float16_t(0.0h)).xx, (float16_t(0.0h)).xx, (float16_t(0.0h)).xx)); - v_10((600u + (uint(idx) * 800u)), matrix((float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx)); - v_9((624u + (uint(idx) * 800u)), matrix((float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx)); - v((648u + (uint(idx) * 800u)), matrix((float16_t(0.0h)).xx, (float16_t(0.0h)).xx, (float16_t(0.0h)).xx, (float16_t(0.0h)).xx)); - v_8((664u + (uint(idx) * 800u)), matrix((float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx)); - v_7((696u + (uint(idx) * 800u)), matrix((float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx)); - float3 v_27[2] = (float3[2])0; - v_4((736u + (uint(idx) * 800u)), v_27); - matrix v_28[2] = (matrix[2])0; - v_1((768u + (uint(idx) * 800u)), v_28); + sb.Store((0u + (idx * 800u)), asuint(0.0f)); + sb.Store((4u + (idx * 800u)), asuint(int(0))); + sb.Store((8u + (idx * 800u)), 0u); + sb.Store((12u + (idx * 800u)), float16_t(0.0h)); + sb.Store2((16u + (idx * 800u)), asuint((0.0f).xx)); + sb.Store2((24u + (idx * 800u)), asuint(int2((int(0)).xx))); + sb.Store2((32u + (idx * 800u)), (0u).xx); + sb.Store >((40u + (idx * 800u)), (float16_t(0.0h)).xx); + sb.Store3((48u + (idx * 800u)), asuint((0.0f).xxx)); + sb.Store3((64u + (idx * 800u)), asuint(int3((int(0)).xxx))); + sb.Store3((80u + (idx * 800u)), (0u).xxx); + sb.Store >((96u + (idx * 800u)), (float16_t(0.0h)).xxx); + sb.Store4((112u + (idx * 800u)), asuint((0.0f).xxxx)); + sb.Store4((128u + (idx * 800u)), asuint(int4((int(0)).xxxx))); + sb.Store4((144u + (idx * 800u)), (0u).xxxx); + sb.Store >((160u + (idx * 800u)), (float16_t(0.0h)).xxxx); + v_23((168u + (idx * 800u)), float2x2((0.0f).xx, (0.0f).xx)); + v_22((192u + (idx * 800u)), float2x3((0.0f).xxx, (0.0f).xxx)); + v_21((224u + (idx * 800u)), float2x4((0.0f).xxxx, (0.0f).xxxx)); + v_20((256u + (idx * 800u)), float3x2((0.0f).xx, (0.0f).xx, (0.0f).xx)); + v_19((288u + (idx * 800u)), float3x3((0.0f).xxx, (0.0f).xxx, (0.0f).xxx)); + v_18((336u + (idx * 800u)), float3x4((0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx)); + v_17((384u + (idx * 800u)), float4x2((0.0f).xx, (0.0f).xx, (0.0f).xx, (0.0f).xx)); + v_16((416u + (idx * 800u)), float4x3((0.0f).xxx, (0.0f).xxx, (0.0f).xxx, (0.0f).xxx)); + v_15((480u + (idx * 800u)), float4x4((0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx)); + v_14((544u + (idx * 800u)), matrix((float16_t(0.0h)).xx, (float16_t(0.0h)).xx)); + v_13((552u + (idx * 800u)), matrix((float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx)); + v_12((568u + (idx * 800u)), matrix((float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx)); + v_11((584u + (idx * 800u)), matrix((float16_t(0.0h)).xx, (float16_t(0.0h)).xx, (float16_t(0.0h)).xx)); + v_10((600u + (idx * 800u)), matrix((float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx)); + v_9((624u + (idx * 800u)), matrix((float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx)); + v((648u + (idx * 800u)), matrix((float16_t(0.0h)).xx, (float16_t(0.0h)).xx, (float16_t(0.0h)).xx, (float16_t(0.0h)).xx)); + v_8((664u + (idx * 800u)), matrix((float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx)); + v_7((696u + (idx * 800u)), matrix((float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx)); + float3 v_24[2] = (float3[2])0; + v_4((736u + (idx * 800u)), v_24); + matrix v_25[2] = (matrix[2])0; + v_1((768u + (idx * 800u)), v_25); } [numthreads(1, 1, 1)] diff --git a/test/tint/bug/chromium/1273230.wgsl.expected.ir.dxc.hlsl b/test/tint/bug/chromium/1273230.wgsl.expected.ir.dxc.hlsl index 6bfefb735a9..74902a5df51 100644 --- a/test/tint/bug/chromium/1273230.wgsl.expected.ir.dxc.hlsl +++ b/test/tint/bug/chromium/1273230.wgsl.expected.ir.dxc.hlsl @@ -52,23 +52,21 @@ uint3 toIndex4D(uint gridSize, uint index) { } float3 loadPosition(uint vertexIndex) { - float v_1 = asfloat(positions.Load((0u + (uint(((3u * vertexIndex) + 0u)) * 4u)))); - float v_2 = asfloat(positions.Load((0u + (uint(((3u * vertexIndex) + 1u)) * 4u)))); - float3 position = float3(v_1, v_2, asfloat(positions.Load((0u + (uint(((3u * vertexIndex) + 2u)) * 4u))))); + float3 position = float3(asfloat(positions.Load((0u + (((3u * vertexIndex) + 0u) * 4u)))), asfloat(positions.Load((0u + (((3u * vertexIndex) + 1u) * 4u)))), asfloat(positions.Load((0u + (((3u * vertexIndex) + 2u) * 4u))))); return position; } void doIgnore() { uint g43 = uniforms[0u].x; uint kj6 = dbg.Load(20u); - uint v_3 = 0u; - counters.InterlockedOr(uint(0u), 0u, v_3); - uint b53 = v_3; + uint v_1 = 0u; + counters.InterlockedOr(uint(0u), 0u, v_1); + uint b53 = v_1; uint rwg = indices.Load(0u); float rb5 = asfloat(positions.Load(0u)); - int v_4 = int(0); - LUT.InterlockedOr(int(0u), int(0), v_4); - int g55 = v_4; + int v_2 = int(0); + LUT.InterlockedOr(int(0u), int(0), v_2); + int g55 = v_2; } void main_count_inner(uint3 GlobalInvocationID) { @@ -77,18 +75,18 @@ void main_count_inner(uint3 GlobalInvocationID) { return; } doIgnore(); - uint i0 = indices.Load((0u + (uint(((3u * triangleIndex) + 0u)) * 4u))); - uint i1 = indices.Load((0u + (uint(((3u * i0) + 1u)) * 4u))); - uint i2 = indices.Load((0u + (uint(((3u * i0) + 2u)) * 4u))); + uint i0 = indices.Load((0u + (((3u * triangleIndex) + 0u) * 4u))); + uint i1 = indices.Load((0u + (((3u * i0) + 1u) * 4u))); + uint i2 = indices.Load((0u + (((3u * i0) + 2u) * 4u))); float3 p0 = loadPosition(i0); float3 p1 = loadPosition(i0); float3 p2 = loadPosition(i2); float3 center = (((p0 + p2) + p1) / 3.0f); float3 voxelPos = toVoxelPos(p1); uint lIndex = toIndex1D(uniforms[0u].y, p0); - int v_5 = int(0); - LUT.InterlockedAdd(int((0u + (uint(i1) * 4u))), int(1), v_5); - int triangleOffset = v_5; + int v_3 = int(0); + LUT.InterlockedAdd(int((0u + (i1 * 4u))), int(1), v_3); + int triangleOffset = v_3; } [numthreads(128, 1, 1)] diff --git a/test/tint/bug/chromium/1273230.wgsl.expected.ir.fxc.hlsl b/test/tint/bug/chromium/1273230.wgsl.expected.ir.fxc.hlsl index 6bfefb735a9..74902a5df51 100644 --- a/test/tint/bug/chromium/1273230.wgsl.expected.ir.fxc.hlsl +++ b/test/tint/bug/chromium/1273230.wgsl.expected.ir.fxc.hlsl @@ -52,23 +52,21 @@ uint3 toIndex4D(uint gridSize, uint index) { } float3 loadPosition(uint vertexIndex) { - float v_1 = asfloat(positions.Load((0u + (uint(((3u * vertexIndex) + 0u)) * 4u)))); - float v_2 = asfloat(positions.Load((0u + (uint(((3u * vertexIndex) + 1u)) * 4u)))); - float3 position = float3(v_1, v_2, asfloat(positions.Load((0u + (uint(((3u * vertexIndex) + 2u)) * 4u))))); + float3 position = float3(asfloat(positions.Load((0u + (((3u * vertexIndex) + 0u) * 4u)))), asfloat(positions.Load((0u + (((3u * vertexIndex) + 1u) * 4u)))), asfloat(positions.Load((0u + (((3u * vertexIndex) + 2u) * 4u))))); return position; } void doIgnore() { uint g43 = uniforms[0u].x; uint kj6 = dbg.Load(20u); - uint v_3 = 0u; - counters.InterlockedOr(uint(0u), 0u, v_3); - uint b53 = v_3; + uint v_1 = 0u; + counters.InterlockedOr(uint(0u), 0u, v_1); + uint b53 = v_1; uint rwg = indices.Load(0u); float rb5 = asfloat(positions.Load(0u)); - int v_4 = int(0); - LUT.InterlockedOr(int(0u), int(0), v_4); - int g55 = v_4; + int v_2 = int(0); + LUT.InterlockedOr(int(0u), int(0), v_2); + int g55 = v_2; } void main_count_inner(uint3 GlobalInvocationID) { @@ -77,18 +75,18 @@ void main_count_inner(uint3 GlobalInvocationID) { return; } doIgnore(); - uint i0 = indices.Load((0u + (uint(((3u * triangleIndex) + 0u)) * 4u))); - uint i1 = indices.Load((0u + (uint(((3u * i0) + 1u)) * 4u))); - uint i2 = indices.Load((0u + (uint(((3u * i0) + 2u)) * 4u))); + uint i0 = indices.Load((0u + (((3u * triangleIndex) + 0u) * 4u))); + uint i1 = indices.Load((0u + (((3u * i0) + 1u) * 4u))); + uint i2 = indices.Load((0u + (((3u * i0) + 2u) * 4u))); float3 p0 = loadPosition(i0); float3 p1 = loadPosition(i0); float3 p2 = loadPosition(i2); float3 center = (((p0 + p2) + p1) / 3.0f); float3 voxelPos = toVoxelPos(p1); uint lIndex = toIndex1D(uniforms[0u].y, p0); - int v_5 = int(0); - LUT.InterlockedAdd(int((0u + (uint(i1) * 4u))), int(1), v_5); - int triangleOffset = v_5; + int v_3 = int(0); + LUT.InterlockedAdd(int((0u + (i1 * 4u))), int(1), v_3); + int triangleOffset = v_3; } [numthreads(128, 1, 1)] diff --git a/test/tint/bug/chromium/1434271.wgsl.expected.ir.dxc.hlsl b/test/tint/bug/chromium/1434271.wgsl.expected.ir.dxc.hlsl index e99d442e1ca..ad1d8c77e23 100644 --- a/test/tint/bug/chromium/1434271.wgsl.expected.ir.dxc.hlsl +++ b/test/tint/bug/chromium/1434271.wgsl.expected.ir.dxc.hlsl @@ -111,41 +111,39 @@ void simulate_inner(uint3 GlobalInvocationID) { float2 v_8 = (v_7 * float2(GlobalInvocationID.xy)); rand_seed = (v_8 * asfloat(sim_params[1u]).zw); uint idx = GlobalInvocationID.x; - Particle particle = v_5((0u + (uint(idx) * 48u))); - uint v_9 = (uint(idx) * 48u); - Particle v_10 = particle; - v_4((0u + v_9), v_10); + Particle particle = v_5((0u + (idx * 48u))); + Particle v_9 = particle; + v_4((0u + (idx * 48u)), v_9); } void export_level_inner(uint3 coord) { - uint2 v_11 = (0u).xx; - tex_out.GetDimensions(v_11.x, v_11.y); - if (all((coord.xy < uint2(v_11)))) { + uint2 v_10 = (0u).xx; + tex_out.GetDimensions(v_10.x, v_10.y); + if (all((coord.xy < uint2(v_10)))) { uint dst_offset = (coord.x << ((coord.y * ubo[0u].x) & 31u)); uint src_offset = ((coord.x - 2u) + ((coord.y >> (2u & 31u)) * ubo[0u].x)); - float a = asfloat(buf_in.Load((0u + (uint((src_offset << (0u & 31u))) * 4u)))); - float b = asfloat(buf_in.Load((0u + (uint((src_offset + 1u)) * 4u)))); - float c = asfloat(buf_in.Load((0u + (uint(((src_offset + 1u) + ubo[0u].x)) * 4u)))); - float d = asfloat(buf_in.Load((0u + (uint(((src_offset + 1u) + ubo[0u].x)) * 4u)))); + float a = asfloat(buf_in.Load((0u + ((src_offset << (0u & 31u)) * 4u)))); + float b = asfloat(buf_in.Load((0u + ((src_offset + 1u) * 4u)))); + float c = asfloat(buf_in.Load((0u + (((src_offset + 1u) + ubo[0u].x) * 4u)))); + float d = asfloat(buf_in.Load((0u + (((src_offset + 1u) + ubo[0u].x) * 4u)))); float sum = dot(float4(a, b, c, d), (1.0f).xxxx); - uint v_12 = (uint(dst_offset) * 4u); - float v_13 = (sum / 4.0f); - buf_out.Store((0u + v_12), asuint((sum - ((((v_13 < 0.0f)) ? (ceil(v_13)) : (floor(v_13))) * 4.0f)))); + float v_11 = (sum / 4.0f); + buf_out.Store((0u + (dst_offset * 4u)), asuint((sum - ((((v_11 < 0.0f)) ? (ceil(v_11)) : (floor(v_11))) * 4.0f)))); float4 probabilities = (float4(a, (a * b), ((a / b) + c), sum) + max(sum, 0.0f)); tex_out[int2(coord.xy)] = probabilities; } } vertex_main_outputs vertex_main() { - vertex_main_outputs v_14 = {vertex_main_inner()}; - return v_14; + vertex_main_outputs v_12 = {vertex_main_inner()}; + return v_12; } vs_main_outputs vs_main(vs_main_inputs inputs) { - VertexInput v_15 = {inputs.VertexInput_position, inputs.VertexInput_color, inputs.VertexInput_quad_pos}; - VertexOutput v_16 = vs_main_inner(v_15); - vs_main_outputs v_17 = {v_16.color, v_16.quad_pos, v_16.position}; - return v_17; + VertexInput v_13 = {inputs.VertexInput_position, inputs.VertexInput_color, inputs.VertexInput_quad_pos}; + VertexOutput v_14 = vs_main_inner(v_13); + vs_main_outputs v_15 = {v_14.color, v_14.quad_pos, v_14.position}; + return v_15; } [numthreads(64, 1, 1)] diff --git a/test/tint/bug/fxc/vector_assignment_dynamic_index/storage_var.wgsl.expected.ir.dxc.hlsl b/test/tint/bug/fxc/vector_assignment_dynamic_index/storage_var.wgsl.expected.ir.dxc.hlsl index b301a6610f7..ad136e37f67 100644 --- a/test/tint/bug/fxc/vector_assignment_dynamic_index/storage_var.wgsl.expected.ir.dxc.hlsl +++ b/test/tint/bug/fxc/vector_assignment_dynamic_index/storage_var.wgsl.expected.ir.dxc.hlsl @@ -5,6 +5,6 @@ cbuffer cbuffer_i : register(b0) { RWByteAddressBuffer v1 : register(u1); [numthreads(1, 1, 1)] void main() { - v1.Store((0u + (uint(i[0u].x) * 4u)), asuint(1.0f)); + v1.Store((0u + (i[0u].x * 4u)), asuint(1.0f)); } diff --git a/test/tint/bug/fxc/vector_assignment_dynamic_index/storage_var.wgsl.expected.ir.fxc.hlsl b/test/tint/bug/fxc/vector_assignment_dynamic_index/storage_var.wgsl.expected.ir.fxc.hlsl index b301a6610f7..ad136e37f67 100644 --- a/test/tint/bug/fxc/vector_assignment_dynamic_index/storage_var.wgsl.expected.ir.fxc.hlsl +++ b/test/tint/bug/fxc/vector_assignment_dynamic_index/storage_var.wgsl.expected.ir.fxc.hlsl @@ -5,6 +5,6 @@ cbuffer cbuffer_i : register(b0) { RWByteAddressBuffer v1 : register(u1); [numthreads(1, 1, 1)] void main() { - v1.Store((0u + (uint(i[0u].x) * 4u)), asuint(1.0f)); + v1.Store((0u + (i[0u].x * 4u)), asuint(1.0f)); } diff --git a/test/tint/bug/tint/1113.wgsl.expected.ir.dxc.hlsl b/test/tint/bug/tint/1113.wgsl.expected.ir.dxc.hlsl index 3fc28addb35..1b8a4e29dd2 100644 --- a/test/tint/bug/tint/1113.wgsl.expected.ir.dxc.hlsl +++ b/test/tint/bug/tint/1113.wgsl.expected.ir.dxc.hlsl @@ -57,23 +57,21 @@ uint3 toIndex3D(uint gridSize, uint index) { } float3 loadPosition(uint vertexIndex) { - float v_1 = asfloat(positions.Load((0u + (uint(((3u * vertexIndex) + 0u)) * 4u)))); - float v_2 = asfloat(positions.Load((0u + (uint(((3u * vertexIndex) + 1u)) * 4u)))); - float3 position = float3(v_1, v_2, asfloat(positions.Load((0u + (uint(((3u * vertexIndex) + 2u)) * 4u))))); + float3 position = float3(asfloat(positions.Load((0u + (((3u * vertexIndex) + 0u) * 4u)))), asfloat(positions.Load((0u + (((3u * vertexIndex) + 1u) * 4u)))), asfloat(positions.Load((0u + (((3u * vertexIndex) + 2u) * 4u))))); return position; } void doIgnore() { uint g42 = uniforms[0u].x; uint kj6 = dbg.Load(20u); - uint v_3 = 0u; - counters.InterlockedOr(uint(0u), 0u, v_3); - uint b53 = v_3; + uint v_1 = 0u; + counters.InterlockedOr(uint(0u), 0u, v_1); + uint b53 = v_1; uint rwg = indices.Load(0u); float rb5 = asfloat(positions.Load(0u)); - int v_4 = int(0); - LUT.InterlockedOr(int(0u), int(0), v_4); - int g55 = v_4; + int v_2 = int(0); + LUT.InterlockedOr(int(0u), int(0), v_2); + int g55 = v_2; } void main_count_inner(uint3 GlobalInvocationID) { @@ -82,18 +80,18 @@ void main_count_inner(uint3 GlobalInvocationID) { return; } doIgnore(); - uint i0 = indices.Load((0u + (uint(((3u * triangleIndex) + 0u)) * 4u))); - uint i1 = indices.Load((0u + (uint(((3u * triangleIndex) + 1u)) * 4u))); - uint i2 = indices.Load((0u + (uint(((3u * triangleIndex) + 2u)) * 4u))); + uint i0 = indices.Load((0u + (((3u * triangleIndex) + 0u) * 4u))); + uint i1 = indices.Load((0u + (((3u * triangleIndex) + 1u) * 4u))); + uint i2 = indices.Load((0u + (((3u * triangleIndex) + 2u) * 4u))); float3 p0 = loadPosition(i0); float3 p1 = loadPosition(i1); float3 p2 = loadPosition(i2); float3 center = (((p0 + p1) + p2) / 3.0f); float3 voxelPos = toVoxelPos(center); uint voxelIndex = toIndex1D(uniforms[0u].y, voxelPos); - uint v_5 = 0u; - counters.InterlockedAdd(uint((0u + (uint(voxelIndex) * 4u))), 1u, v_5); - uint acefg = v_5; + uint v_3 = 0u; + counters.InterlockedAdd(uint((0u + (voxelIndex * 4u))), 1u, v_3); + uint acefg = v_3; if ((triangleIndex == 0u)) { dbg.Store(16u, uniforms[0u].y); dbg.Store(32u, asuint(center.x)); @@ -109,20 +107,19 @@ void main_create_lut_inner(uint3 GlobalInvocationID) { if ((voxelIndex >= maxVoxels)) { return; } - uint v_6 = 0u; - counters.InterlockedOr(uint((0u + (uint(voxelIndex) * 4u))), 0u, v_6); - uint numTriangles = v_6; + uint v_4 = 0u; + counters.InterlockedOr(uint((0u + (voxelIndex * 4u))), 0u, v_4); + uint numTriangles = v_4; int offset = int(-1); if ((numTriangles > 0u)) { - uint v_7 = numTriangles; - uint v_8 = 0u; - dbg.InterlockedAdd(uint(0u), v_7, v_8); - offset = int(v_8); + uint v_5 = numTriangles; + uint v_6 = 0u; + dbg.InterlockedAdd(uint(0u), v_5, v_6); + offset = int(v_6); } - uint v_9 = (uint(voxelIndex) * 4u); - int v_10 = offset; - int v_11 = int(0); - LUT.InterlockedExchange(int((0u + v_9)), v_10, v_11); + int v_7 = offset; + int v_8 = int(0); + LUT.InterlockedExchange(int((0u + (voxelIndex * 4u))), v_7, v_8); } void main_sort_triangles_inner(uint3 GlobalInvocationID) { @@ -131,18 +128,18 @@ void main_sort_triangles_inner(uint3 GlobalInvocationID) { if ((triangleIndex >= uniforms[0u].x)) { return; } - uint i0 = indices.Load((0u + (uint(((3u * triangleIndex) + 0u)) * 4u))); - uint i1 = indices.Load((0u + (uint(((3u * triangleIndex) + 1u)) * 4u))); - uint i2 = indices.Load((0u + (uint(((3u * triangleIndex) + 2u)) * 4u))); + uint i0 = indices.Load((0u + (((3u * triangleIndex) + 0u) * 4u))); + uint i1 = indices.Load((0u + (((3u * triangleIndex) + 1u) * 4u))); + uint i2 = indices.Load((0u + (((3u * triangleIndex) + 2u) * 4u))); float3 p0 = loadPosition(i0); float3 p1 = loadPosition(i1); float3 p2 = loadPosition(i2); float3 center = (((p0 + p1) + p2) / 3.0f); float3 voxelPos = toVoxelPos(center); uint voxelIndex = toIndex1D(uniforms[0u].y, voxelPos); - int v_12 = int(0); - LUT.InterlockedAdd(int((0u + (uint(voxelIndex) * 4u))), int(1), v_12); - int triangleOffset = v_12; + int v_9 = int(0); + LUT.InterlockedAdd(int((0u + (voxelIndex * 4u))), int(1), v_9); + int triangleOffset = v_9; } [numthreads(128, 1, 1)] diff --git a/test/tint/bug/tint/1113.wgsl.expected.ir.fxc.hlsl b/test/tint/bug/tint/1113.wgsl.expected.ir.fxc.hlsl index 3fc28addb35..1b8a4e29dd2 100644 --- a/test/tint/bug/tint/1113.wgsl.expected.ir.fxc.hlsl +++ b/test/tint/bug/tint/1113.wgsl.expected.ir.fxc.hlsl @@ -57,23 +57,21 @@ uint3 toIndex3D(uint gridSize, uint index) { } float3 loadPosition(uint vertexIndex) { - float v_1 = asfloat(positions.Load((0u + (uint(((3u * vertexIndex) + 0u)) * 4u)))); - float v_2 = asfloat(positions.Load((0u + (uint(((3u * vertexIndex) + 1u)) * 4u)))); - float3 position = float3(v_1, v_2, asfloat(positions.Load((0u + (uint(((3u * vertexIndex) + 2u)) * 4u))))); + float3 position = float3(asfloat(positions.Load((0u + (((3u * vertexIndex) + 0u) * 4u)))), asfloat(positions.Load((0u + (((3u * vertexIndex) + 1u) * 4u)))), asfloat(positions.Load((0u + (((3u * vertexIndex) + 2u) * 4u))))); return position; } void doIgnore() { uint g42 = uniforms[0u].x; uint kj6 = dbg.Load(20u); - uint v_3 = 0u; - counters.InterlockedOr(uint(0u), 0u, v_3); - uint b53 = v_3; + uint v_1 = 0u; + counters.InterlockedOr(uint(0u), 0u, v_1); + uint b53 = v_1; uint rwg = indices.Load(0u); float rb5 = asfloat(positions.Load(0u)); - int v_4 = int(0); - LUT.InterlockedOr(int(0u), int(0), v_4); - int g55 = v_4; + int v_2 = int(0); + LUT.InterlockedOr(int(0u), int(0), v_2); + int g55 = v_2; } void main_count_inner(uint3 GlobalInvocationID) { @@ -82,18 +80,18 @@ void main_count_inner(uint3 GlobalInvocationID) { return; } doIgnore(); - uint i0 = indices.Load((0u + (uint(((3u * triangleIndex) + 0u)) * 4u))); - uint i1 = indices.Load((0u + (uint(((3u * triangleIndex) + 1u)) * 4u))); - uint i2 = indices.Load((0u + (uint(((3u * triangleIndex) + 2u)) * 4u))); + uint i0 = indices.Load((0u + (((3u * triangleIndex) + 0u) * 4u))); + uint i1 = indices.Load((0u + (((3u * triangleIndex) + 1u) * 4u))); + uint i2 = indices.Load((0u + (((3u * triangleIndex) + 2u) * 4u))); float3 p0 = loadPosition(i0); float3 p1 = loadPosition(i1); float3 p2 = loadPosition(i2); float3 center = (((p0 + p1) + p2) / 3.0f); float3 voxelPos = toVoxelPos(center); uint voxelIndex = toIndex1D(uniforms[0u].y, voxelPos); - uint v_5 = 0u; - counters.InterlockedAdd(uint((0u + (uint(voxelIndex) * 4u))), 1u, v_5); - uint acefg = v_5; + uint v_3 = 0u; + counters.InterlockedAdd(uint((0u + (voxelIndex * 4u))), 1u, v_3); + uint acefg = v_3; if ((triangleIndex == 0u)) { dbg.Store(16u, uniforms[0u].y); dbg.Store(32u, asuint(center.x)); @@ -109,20 +107,19 @@ void main_create_lut_inner(uint3 GlobalInvocationID) { if ((voxelIndex >= maxVoxels)) { return; } - uint v_6 = 0u; - counters.InterlockedOr(uint((0u + (uint(voxelIndex) * 4u))), 0u, v_6); - uint numTriangles = v_6; + uint v_4 = 0u; + counters.InterlockedOr(uint((0u + (voxelIndex * 4u))), 0u, v_4); + uint numTriangles = v_4; int offset = int(-1); if ((numTriangles > 0u)) { - uint v_7 = numTriangles; - uint v_8 = 0u; - dbg.InterlockedAdd(uint(0u), v_7, v_8); - offset = int(v_8); + uint v_5 = numTriangles; + uint v_6 = 0u; + dbg.InterlockedAdd(uint(0u), v_5, v_6); + offset = int(v_6); } - uint v_9 = (uint(voxelIndex) * 4u); - int v_10 = offset; - int v_11 = int(0); - LUT.InterlockedExchange(int((0u + v_9)), v_10, v_11); + int v_7 = offset; + int v_8 = int(0); + LUT.InterlockedExchange(int((0u + (voxelIndex * 4u))), v_7, v_8); } void main_sort_triangles_inner(uint3 GlobalInvocationID) { @@ -131,18 +128,18 @@ void main_sort_triangles_inner(uint3 GlobalInvocationID) { if ((triangleIndex >= uniforms[0u].x)) { return; } - uint i0 = indices.Load((0u + (uint(((3u * triangleIndex) + 0u)) * 4u))); - uint i1 = indices.Load((0u + (uint(((3u * triangleIndex) + 1u)) * 4u))); - uint i2 = indices.Load((0u + (uint(((3u * triangleIndex) + 2u)) * 4u))); + uint i0 = indices.Load((0u + (((3u * triangleIndex) + 0u) * 4u))); + uint i1 = indices.Load((0u + (((3u * triangleIndex) + 1u) * 4u))); + uint i2 = indices.Load((0u + (((3u * triangleIndex) + 2u) * 4u))); float3 p0 = loadPosition(i0); float3 p1 = loadPosition(i1); float3 p2 = loadPosition(i2); float3 center = (((p0 + p1) + p2) / 3.0f); float3 voxelPos = toVoxelPos(center); uint voxelIndex = toIndex1D(uniforms[0u].y, voxelPos); - int v_12 = int(0); - LUT.InterlockedAdd(int((0u + (uint(voxelIndex) * 4u))), int(1), v_12); - int triangleOffset = v_12; + int v_9 = int(0); + LUT.InterlockedAdd(int((0u + (voxelIndex * 4u))), int(1), v_9); + int triangleOffset = v_9; } [numthreads(128, 1, 1)] diff --git a/test/tint/bug/tint/1121.wgsl.expected.ir.dxc.hlsl b/test/tint/bug/tint/1121.wgsl.expected.ir.dxc.hlsl index 4c3ac9e8cc3..a3239905cd9 100644 --- a/test/tint/bug/tint/1121.wgsl.expected.ir.dxc.hlsl +++ b/test/tint/bug/tint/1121.wgsl.expected.ir.dxc.hlsl @@ -20,27 +20,25 @@ void main_inner(uint3 GlobalInvocationID) { if ((index >= config[0u].x)) { return; } - uint v_1 = (uint(index) * 32u); - float v_2 = (asfloat(lightsBuffer.Load((4u + (uint(index) * 32u)))) - 0.10000000149011611938f); + uint v_1 = (index * 32u); + float v_2 = (asfloat(lightsBuffer.Load((4u + (index * 32u)))) - 0.10000000149011611938f); float v_3 = float(index); lightsBuffer.Store((4u + v_1), asuint((v_2 + (0.00100000004749745131f * (v_3 - (64.0f * floor((float(index) / 64.0f)))))))); - float v_4 = asfloat(lightsBuffer.Load((4u + (uint(index) * 32u)))); - if ((v_4 < asfloat(uniforms[0u].y))) { - uint v_5 = (uint(index) * 32u); - lightsBuffer.Store((4u + v_5), asuint(asfloat(uniforms[1u].y))); + if ((asfloat(lightsBuffer.Load((4u + (index * 32u)))) < asfloat(uniforms[0u].y))) { + lightsBuffer.Store((4u + (index * 32u)), asuint(asfloat(uniforms[1u].y))); } float4x4 M = v(96u); float viewNear = (-(M[int(3)].z) / (-1.0f + M[int(2)].z)); float viewFar = (-(M[int(3)].z) / (1.0f + M[int(2)].z)); - float4 lightPos = asfloat(lightsBuffer.Load4((0u + (uint(index) * 32u)))); - float4x4 v_6 = v(32u); - lightPos = mul(lightPos, v_6); + float4 lightPos = asfloat(lightsBuffer.Load4((0u + (index * 32u)))); + float4x4 v_4 = v(32u); + lightPos = mul(lightPos, v_4); lightPos = (lightPos / lightPos.w); - float lightRadius = asfloat(lightsBuffer.Load((28u + (uint(index) * 32u)))); - float4 v_7 = lightPos; - float4 boxMin = (v_7 - float4(float3((lightRadius).xxx), 0.0f)); - float4 v_8 = lightPos; - float4 boxMax = (v_8 + float4(float3((lightRadius).xxx), 0.0f)); + float lightRadius = asfloat(lightsBuffer.Load((28u + (index * 32u)))); + float4 v_5 = lightPos; + float4 boxMin = (v_5 - float4(float3((lightRadius).xxx), 0.0f)); + float4 v_6 = lightPos; + float4 boxMax = (v_6 + float4(float3((lightRadius).xxx), 0.0f)); float4 frustumPlanes[6] = (float4[6])0; frustumPlanes[int(4)] = float4(0.0f, 0.0f, -1.0f, viewNear); frustumPlanes[int(5)] = float4(0.0f, 0.0f, 1.0f, -(viewFar)); @@ -62,11 +60,11 @@ void main_inner(uint3 GlobalInvocationID) { break; } int2 tilePixel0Idx = int2((x * TILE_SIZE), (y * TILE_SIZE)); - float2 v_9 = (2.0f * float2(tilePixel0Idx)); - float2 floorCoord = ((v_9 / asfloat(uniforms[10u]).xy) - (1.0f).xx); - int2 v_10 = tilePixel0Idx; - float2 v_11 = (2.0f * float2((v_10 + int2((TILE_SIZE).xx)))); - float2 ceilCoord = ((v_11 / asfloat(uniforms[10u]).xy) - (1.0f).xx); + float2 v_7 = (2.0f * float2(tilePixel0Idx)); + float2 floorCoord = ((v_7 / asfloat(uniforms[10u]).xy) - (1.0f).xx); + int2 v_8 = tilePixel0Idx; + float2 v_9 = (2.0f * float2((v_8 + int2((TILE_SIZE).xx)))); + float2 ceilCoord = ((v_9 / asfloat(uniforms[10u]).xy) - (1.0f).xx); float2 viewFloorCoord = float2((((-(viewNear) * floorCoord.x) - (M[int(2)].x * viewNear)) / M[int(0)].x), (((-(viewNear) * floorCoord.y) - (M[int(2)].y * viewNear)) / M[int(1)].y)); float2 viewCeilCoord = float2((((-(viewNear) * ceilCoord.x) - (M[int(2)].x * viewNear)) / M[int(0)].x), (((-(viewNear) * ceilCoord.y) - (M[int(2)].y * viewNear)) / M[int(1)].y)); frustumPlanes[int(0)] = float4(1.0f, 0.0f, (-(viewFloorCoord.x) / viewNear), 0.0f); @@ -82,29 +80,29 @@ void main_inner(uint3 GlobalInvocationID) { break; } float4 p = (0.0f).xxxx; - uint v_12 = i; - if ((frustumPlanes[v_12].x > 0.0f)) { + uint v_10 = i; + if ((frustumPlanes[v_10].x > 0.0f)) { p.x = boxMax.x; } else { p.x = boxMin.x; } - uint v_13 = i; - if ((frustumPlanes[v_13].y > 0.0f)) { + uint v_11 = i; + if ((frustumPlanes[v_11].y > 0.0f)) { p.y = boxMax.y; } else { p.y = boxMin.y; } - uint v_14 = i; - if ((frustumPlanes[v_14].z > 0.0f)) { + uint v_12 = i; + if ((frustumPlanes[v_12].z > 0.0f)) { p.z = boxMax.z; } else { p.z = boxMin.z; } p.w = 1.0f; - float v_15 = dp; - float4 v_16 = p; - uint v_17 = i; - dp = (v_15 + min(0.0f, dot(v_16, frustumPlanes[v_17]))); + float v_13 = dp; + float4 v_14 = p; + uint v_15 = i; + dp = (v_13 + min(0.0f, dot(v_14, frustumPlanes[v_15]))); { i = (i + 1u); } @@ -113,30 +111,28 @@ void main_inner(uint3 GlobalInvocationID) { } if ((dp >= 0.0f)) { uint tileId = uint((x + (y * TILE_COUNT_X))); - bool v_18 = false; + bool v_16 = false; if ((tileId < 0u)) { - v_18 = true; + v_16 = true; } else { - v_18 = (tileId >= config[0u].y); + v_16 = (tileId >= config[0u].y); } - if (v_18) { + if (v_16) { { x = (x + int(1)); } continue; } - uint v_19 = 0u; - tileLightId.InterlockedAdd(uint((0u + (uint(tileId) * 260u))), 1u, v_19); - uint offset = v_19; + uint v_17 = 0u; + tileLightId.InterlockedAdd(uint((0u + (tileId * 260u))), 1u, v_17); + uint offset = v_17; if ((offset >= config[1u].x)) { { x = (x + int(1)); } continue; } - uint v_20 = offset; - uint v_21 = (uint(tileId) * 260u); - tileLightId.Store(((4u + v_21) + (uint(v_20) * 4u)), GlobalInvocationID.x); + tileLightId.Store(((4u + (tileId * 260u)) + (offset * 4u)), GlobalInvocationID.x); } { x = (x + int(1)); diff --git a/test/tint/bug/tint/1121.wgsl.expected.ir.fxc.hlsl b/test/tint/bug/tint/1121.wgsl.expected.ir.fxc.hlsl index 4c3ac9e8cc3..a3239905cd9 100644 --- a/test/tint/bug/tint/1121.wgsl.expected.ir.fxc.hlsl +++ b/test/tint/bug/tint/1121.wgsl.expected.ir.fxc.hlsl @@ -20,27 +20,25 @@ void main_inner(uint3 GlobalInvocationID) { if ((index >= config[0u].x)) { return; } - uint v_1 = (uint(index) * 32u); - float v_2 = (asfloat(lightsBuffer.Load((4u + (uint(index) * 32u)))) - 0.10000000149011611938f); + uint v_1 = (index * 32u); + float v_2 = (asfloat(lightsBuffer.Load((4u + (index * 32u)))) - 0.10000000149011611938f); float v_3 = float(index); lightsBuffer.Store((4u + v_1), asuint((v_2 + (0.00100000004749745131f * (v_3 - (64.0f * floor((float(index) / 64.0f)))))))); - float v_4 = asfloat(lightsBuffer.Load((4u + (uint(index) * 32u)))); - if ((v_4 < asfloat(uniforms[0u].y))) { - uint v_5 = (uint(index) * 32u); - lightsBuffer.Store((4u + v_5), asuint(asfloat(uniforms[1u].y))); + if ((asfloat(lightsBuffer.Load((4u + (index * 32u)))) < asfloat(uniforms[0u].y))) { + lightsBuffer.Store((4u + (index * 32u)), asuint(asfloat(uniforms[1u].y))); } float4x4 M = v(96u); float viewNear = (-(M[int(3)].z) / (-1.0f + M[int(2)].z)); float viewFar = (-(M[int(3)].z) / (1.0f + M[int(2)].z)); - float4 lightPos = asfloat(lightsBuffer.Load4((0u + (uint(index) * 32u)))); - float4x4 v_6 = v(32u); - lightPos = mul(lightPos, v_6); + float4 lightPos = asfloat(lightsBuffer.Load4((0u + (index * 32u)))); + float4x4 v_4 = v(32u); + lightPos = mul(lightPos, v_4); lightPos = (lightPos / lightPos.w); - float lightRadius = asfloat(lightsBuffer.Load((28u + (uint(index) * 32u)))); - float4 v_7 = lightPos; - float4 boxMin = (v_7 - float4(float3((lightRadius).xxx), 0.0f)); - float4 v_8 = lightPos; - float4 boxMax = (v_8 + float4(float3((lightRadius).xxx), 0.0f)); + float lightRadius = asfloat(lightsBuffer.Load((28u + (index * 32u)))); + float4 v_5 = lightPos; + float4 boxMin = (v_5 - float4(float3((lightRadius).xxx), 0.0f)); + float4 v_6 = lightPos; + float4 boxMax = (v_6 + float4(float3((lightRadius).xxx), 0.0f)); float4 frustumPlanes[6] = (float4[6])0; frustumPlanes[int(4)] = float4(0.0f, 0.0f, -1.0f, viewNear); frustumPlanes[int(5)] = float4(0.0f, 0.0f, 1.0f, -(viewFar)); @@ -62,11 +60,11 @@ void main_inner(uint3 GlobalInvocationID) { break; } int2 tilePixel0Idx = int2((x * TILE_SIZE), (y * TILE_SIZE)); - float2 v_9 = (2.0f * float2(tilePixel0Idx)); - float2 floorCoord = ((v_9 / asfloat(uniforms[10u]).xy) - (1.0f).xx); - int2 v_10 = tilePixel0Idx; - float2 v_11 = (2.0f * float2((v_10 + int2((TILE_SIZE).xx)))); - float2 ceilCoord = ((v_11 / asfloat(uniforms[10u]).xy) - (1.0f).xx); + float2 v_7 = (2.0f * float2(tilePixel0Idx)); + float2 floorCoord = ((v_7 / asfloat(uniforms[10u]).xy) - (1.0f).xx); + int2 v_8 = tilePixel0Idx; + float2 v_9 = (2.0f * float2((v_8 + int2((TILE_SIZE).xx)))); + float2 ceilCoord = ((v_9 / asfloat(uniforms[10u]).xy) - (1.0f).xx); float2 viewFloorCoord = float2((((-(viewNear) * floorCoord.x) - (M[int(2)].x * viewNear)) / M[int(0)].x), (((-(viewNear) * floorCoord.y) - (M[int(2)].y * viewNear)) / M[int(1)].y)); float2 viewCeilCoord = float2((((-(viewNear) * ceilCoord.x) - (M[int(2)].x * viewNear)) / M[int(0)].x), (((-(viewNear) * ceilCoord.y) - (M[int(2)].y * viewNear)) / M[int(1)].y)); frustumPlanes[int(0)] = float4(1.0f, 0.0f, (-(viewFloorCoord.x) / viewNear), 0.0f); @@ -82,29 +80,29 @@ void main_inner(uint3 GlobalInvocationID) { break; } float4 p = (0.0f).xxxx; - uint v_12 = i; - if ((frustumPlanes[v_12].x > 0.0f)) { + uint v_10 = i; + if ((frustumPlanes[v_10].x > 0.0f)) { p.x = boxMax.x; } else { p.x = boxMin.x; } - uint v_13 = i; - if ((frustumPlanes[v_13].y > 0.0f)) { + uint v_11 = i; + if ((frustumPlanes[v_11].y > 0.0f)) { p.y = boxMax.y; } else { p.y = boxMin.y; } - uint v_14 = i; - if ((frustumPlanes[v_14].z > 0.0f)) { + uint v_12 = i; + if ((frustumPlanes[v_12].z > 0.0f)) { p.z = boxMax.z; } else { p.z = boxMin.z; } p.w = 1.0f; - float v_15 = dp; - float4 v_16 = p; - uint v_17 = i; - dp = (v_15 + min(0.0f, dot(v_16, frustumPlanes[v_17]))); + float v_13 = dp; + float4 v_14 = p; + uint v_15 = i; + dp = (v_13 + min(0.0f, dot(v_14, frustumPlanes[v_15]))); { i = (i + 1u); } @@ -113,30 +111,28 @@ void main_inner(uint3 GlobalInvocationID) { } if ((dp >= 0.0f)) { uint tileId = uint((x + (y * TILE_COUNT_X))); - bool v_18 = false; + bool v_16 = false; if ((tileId < 0u)) { - v_18 = true; + v_16 = true; } else { - v_18 = (tileId >= config[0u].y); + v_16 = (tileId >= config[0u].y); } - if (v_18) { + if (v_16) { { x = (x + int(1)); } continue; } - uint v_19 = 0u; - tileLightId.InterlockedAdd(uint((0u + (uint(tileId) * 260u))), 1u, v_19); - uint offset = v_19; + uint v_17 = 0u; + tileLightId.InterlockedAdd(uint((0u + (tileId * 260u))), 1u, v_17); + uint offset = v_17; if ((offset >= config[1u].x)) { { x = (x + int(1)); } continue; } - uint v_20 = offset; - uint v_21 = (uint(tileId) * 260u); - tileLightId.Store(((4u + v_21) + (uint(v_20) * 4u)), GlobalInvocationID.x); + tileLightId.Store(((4u + (tileId * 260u)) + (offset * 4u)), GlobalInvocationID.x); } { x = (x + int(1)); diff --git a/test/tint/bug/tint/1725.wgsl.expected.ir.dxc.hlsl b/test/tint/bug/tint/1725.wgsl.expected.ir.dxc.hlsl index 7cbfd109d19..9a6a05749b2 100644 --- a/test/tint/bug/tint/1725.wgsl.expected.ir.dxc.hlsl +++ b/test/tint/bug/tint/1725.wgsl.expected.ir.dxc.hlsl @@ -10,7 +10,7 @@ void tint_symbol_1_inner(uint tint_symbol_2) { int tint_symbol_5 = int(0); uint v = 0u; tint_symbol.GetDimensions(v); - uint tint_symbol_6 = tint_symbol.Load((0u + (uint(min(tint_symbol_2, ((v / 4u) - 1u))) * 4u))); + uint tint_symbol_6 = tint_symbol.Load((0u + (min(tint_symbol_2, ((v / 4u) - 1u)) * 4u))); } [numthreads(1, 1, 1)] diff --git a/test/tint/bug/tint/1725.wgsl.expected.ir.fxc.hlsl b/test/tint/bug/tint/1725.wgsl.expected.ir.fxc.hlsl index 7cbfd109d19..9a6a05749b2 100644 --- a/test/tint/bug/tint/1725.wgsl.expected.ir.fxc.hlsl +++ b/test/tint/bug/tint/1725.wgsl.expected.ir.fxc.hlsl @@ -10,7 +10,7 @@ void tint_symbol_1_inner(uint tint_symbol_2) { int tint_symbol_5 = int(0); uint v = 0u; tint_symbol.GetDimensions(v); - uint tint_symbol_6 = tint_symbol.Load((0u + (uint(min(tint_symbol_2, ((v / 4u) - 1u))) * 4u))); + uint tint_symbol_6 = tint_symbol.Load((0u + (min(tint_symbol_2, ((v / 4u) - 1u)) * 4u))); } [numthreads(1, 1, 1)] diff --git a/test/tint/bug/tint/1875.wgsl.expected.ir.dxc.hlsl b/test/tint/bug/tint/1875.wgsl.expected.ir.dxc.hlsl index 49601bbf65f..74a3dd026db 100644 --- a/test/tint/bug/tint/1875.wgsl.expected.ir.dxc.hlsl +++ b/test/tint/bug/tint/1875.wgsl.expected.ir.dxc.hlsl @@ -2,7 +2,7 @@ static uint count = 0u; RWByteAddressBuffer outputs : register(u1); void push_output(uint value) { - outputs.Store((0u + (uint(count) * 4u)), value); + outputs.Store((0u + (count * 4u)), value); count = (count + 1u); } diff --git a/test/tint/bug/tint/1875.wgsl.expected.ir.fxc.hlsl b/test/tint/bug/tint/1875.wgsl.expected.ir.fxc.hlsl index 49601bbf65f..74a3dd026db 100644 --- a/test/tint/bug/tint/1875.wgsl.expected.ir.fxc.hlsl +++ b/test/tint/bug/tint/1875.wgsl.expected.ir.fxc.hlsl @@ -2,7 +2,7 @@ static uint count = 0u; RWByteAddressBuffer outputs : register(u1); void push_output(uint value) { - outputs.Store((0u + (uint(count) * 4u)), value); + outputs.Store((0u + (count * 4u)), value); count = (count + 1u); } diff --git a/test/tint/bug/tint/221.wgsl.expected.ir.dxc.hlsl b/test/tint/bug/tint/221.wgsl.expected.ir.dxc.hlsl index f6f046e1776..67ffddd2e35 100644 --- a/test/tint/bug/tint/221.wgsl.expected.ir.dxc.hlsl +++ b/test/tint/bug/tint/221.wgsl.expected.ir.dxc.hlsl @@ -13,7 +13,7 @@ void main() { if ((i >= b.Load(0u))) { break; } - uint v_1 = (uint(i) * 4u); + uint v_1 = (i * 4u); if ((tint_mod_u32(i, 2u) == 0u)) { { b.Store((4u + v_1), (b.Load((4u + v_1)) * 2u)); diff --git a/test/tint/bug/tint/221.wgsl.expected.ir.fxc.hlsl b/test/tint/bug/tint/221.wgsl.expected.ir.fxc.hlsl index f6f046e1776..67ffddd2e35 100644 --- a/test/tint/bug/tint/221.wgsl.expected.ir.fxc.hlsl +++ b/test/tint/bug/tint/221.wgsl.expected.ir.fxc.hlsl @@ -13,7 +13,7 @@ void main() { if ((i >= b.Load(0u))) { break; } - uint v_1 = (uint(i) * 4u); + uint v_1 = (i * 4u); if ((tint_mod_u32(i, 2u) == 0u)) { { b.Store((4u + v_1), (b.Load((4u + v_1)) * 2u)); diff --git a/test/tint/bug/tint/379127084.wgsl.expected.ir.dxc.hlsl b/test/tint/bug/tint/379127084.wgsl.expected.ir.dxc.hlsl index 2dee3e0c513..df6121ea326 100644 --- a/test/tint/bug/tint/379127084.wgsl.expected.ir.dxc.hlsl +++ b/test/tint/bug/tint/379127084.wgsl.expected.ir.dxc.hlsl @@ -32,21 +32,20 @@ float4x4 v(uint offset) { void _skslMain(FSIn _stageIn, inout FSOut _stageOut) { shadingSsboIndex = _stageIn.ssboIndicesVar.y; - int _56_d = asint(_storage1.Load((16u + (uint(shadingSsboIndex) * 128u)))); - float2 _57_k = float2(((_stageIn.localCoordsVar + 0.5f) * asfloat(_storage1.Load2((0u + (uint(shadingSsboIndex) * 128u)))))); + int _56_d = asint(_storage1.Load((16u + (shadingSsboIndex * 128u)))); + float2 _57_k = float2(((_stageIn.localCoordsVar + 0.5f) * asfloat(_storage1.Load2((0u + (shadingSsboIndex * 128u)))))); float4 _58_l = (0.0f).xxxx; - float2 _59_m = float2(asfloat(_storage1.Load2((8u + (uint(shadingSsboIndex) * 128u))))); + float2 _59_m = float2(asfloat(_storage1.Load2((8u + (shadingSsboIndex * 128u))))); float _60_n = 1.0f; int _61_o = int(0); { while(true) { - int v_1 = _61_o; - if ((v_1 < asint(_storage1.Load((20u + (uint(shadingSsboIndex) * 128u)))))) { + if ((_61_o < asint(_storage1.Load((20u + (shadingSsboIndex * 128u)))))) { float4 _62_f = (0.0f).xxxx; float2 _skTemp2 = floor(_57_k); _62_f = float4(_skTemp2, _62_f.zw); _62_f = float4(_62_f.xy, (_62_f.xy + (1.0f).xx)); - if (bool(asint(_storage1.Load((24u + (uint(shadingSsboIndex) * 128u)))))) { + if (bool(asint(_storage1.Load((24u + (shadingSsboIndex * 128u)))))) { float4 _skTemp3 = step(_59_m.xyxy, _62_f); _62_f = (_62_f - (_skTemp3 * _59_m.xyxy)); } @@ -69,14 +68,14 @@ void _skslMain(FSIn _stageIn, inout FSOut _stageOut) { { while(true) { float _73_i = ((float(_72_h) + 0.5f) * 0.25f); - float v_2 = float(_67_p.x); - float4 _74_j = noiseSampler_1_Texture.SampleBias(noiseSampler_1_Sampler, float2(v_2, float(_73_i)), clamp(-0.47499999403953552246f, -16.0f, 15.9899997711181640625f)); - float v_3 = float(_67_p.y); - float4 _75_k = noiseSampler_1_Texture.SampleBias(noiseSampler_1_Sampler, float2(v_3, float(_73_i)), clamp(-0.47499999403953552246f, -16.0f, 15.9899997711181640625f)); - float v_4 = float(_67_p.w); - float4 _76_l = noiseSampler_1_Texture.SampleBias(noiseSampler_1_Sampler, float2(v_4, float(_73_i)), clamp(-0.47499999403953552246f, -16.0f, 15.9899997711181640625f)); - float v_5 = float(_67_p.z); - float4 _77_m = noiseSampler_1_Texture.SampleBias(noiseSampler_1_Sampler, float2(v_5, float(_73_i)), clamp(-0.47499999403953552246f, -16.0f, 15.9899997711181640625f)); + float v_1 = float(_67_p.x); + float4 _74_j = noiseSampler_1_Texture.SampleBias(noiseSampler_1_Sampler, float2(v_1, float(_73_i)), clamp(-0.47499999403953552246f, -16.0f, 15.9899997711181640625f)); + float v_2 = float(_67_p.y); + float4 _75_k = noiseSampler_1_Texture.SampleBias(noiseSampler_1_Sampler, float2(v_2, float(_73_i)), clamp(-0.47499999403953552246f, -16.0f, 15.9899997711181640625f)); + float v_3 = float(_67_p.w); + float4 _76_l = noiseSampler_1_Texture.SampleBias(noiseSampler_1_Sampler, float2(v_3, float(_73_i)), clamp(-0.47499999403953552246f, -16.0f, 15.9899997711181640625f)); + float v_4 = float(_67_p.z); + float4 _77_m = noiseSampler_1_Texture.SampleBias(noiseSampler_1_Sampler, float2(v_4, float(_73_i)), clamp(-0.47499999403953552246f, -16.0f, 15.9899997711181640625f)); float2 _78_n = _68_d; float _skTemp7 = dot((((_74_j.yw + (_74_j.xz * 0.00390625f)) * 2.0f) - 1.0f), _78_n); float _79_o = _skTemp7; @@ -125,12 +124,12 @@ void _skslMain(FSIn _stageIn, inout FSOut _stageOut) { } float4 _skTemp15 = saturate(_58_l); _58_l = _skTemp15; - float3 v_6 = float3(_58_l.xyz); - float3 v_7 = float3((v_6 * float(_58_l.w))); - float _skTemp16 = dot(float3(0.21259999275207519531f, 0.71520000696182250977f, 0.07220000028610229492f), float4(v_7, float(float(_58_l.w))).xyz); + float3 v_5 = float3(_58_l.xyz); + float3 v_6 = float3((v_5 * float(_58_l.w))); + float _skTemp16 = dot(float3(0.21259999275207519531f, 0.71520000696182250977f, 0.07220000028610229492f), float4(v_6, float(float(_58_l.w))).xyz); float _skTemp17 = saturate(_skTemp16); float4 _84_a = float4(0.0f, 0.0f, 0.0f, _skTemp17); - int _85_d = asint(_storage1.Load((112u + (uint(shadingSsboIndex) * 128u)))); + int _85_d = asint(_storage1.Load((112u + (shadingSsboIndex * 128u)))); if (bool(_85_d)) { float4 _skTemp18 = (0.0f).xxxx; if ((_84_a.y < _84_a.z)) { @@ -160,9 +159,9 @@ void _skslMain(FSIn _stageIn, inout FSOut _stageOut) { float _skTemp23 = max(_84_a.w, 0.00009999999747378752f); _84_a = float4((_84_a.xyz / _skTemp23), _84_a.w); } - float4x4 v_8 = v((32u + (uint(shadingSsboIndex) * 128u))); - float4 v_9 = mul(float4(_84_a), v_8); - float4 _94_f = float4((v_9 + asfloat(_storage1.Load4((96u + (uint(shadingSsboIndex) * 128u)))))); + float4x4 v_7 = v((32u + (shadingSsboIndex * 128u))); + float4 v_8 = mul(float4(_84_a), v_7); + float4 _94_f = float4((v_8 + asfloat(_storage1.Load4((96u + (shadingSsboIndex * 128u)))))); if (bool(_85_d)) { float _skTemp24 = abs(((2.0f * _94_f.z) - 1.0f)); float _95_b = ((1.0f - _skTemp24) * _94_f.y); @@ -174,7 +173,7 @@ void _skslMain(FSIn _stageIn, inout FSOut _stageOut) { float4 _skTemp28 = saturate(float4(((((_97_d - 0.5f) * _95_b) + _94_f.z) * _94_f.w), _94_f.w)); _94_f = _skTemp28; } else { - if (bool(asint(_storage1.Load((116u + (uint(shadingSsboIndex) * 128u)))))) { + if (bool(asint(_storage1.Load((116u + (shadingSsboIndex * 128u)))))) { float4 _skTemp29 = saturate(_94_f); _94_f = _skTemp29; } else { @@ -190,14 +189,14 @@ void _skslMain(FSIn _stageIn, inout FSOut _stageOut) { FSOut main_inner(FSIn _stageIn) { FSOut _stageOut = (FSOut)0; _skslMain(_stageIn, _stageOut); - FSOut v_10 = _stageOut; - return v_10; + FSOut v_9 = _stageOut; + return v_9; } main_outputs main(main_inputs inputs) { - FSIn v_11 = {inputs.FSIn_ssboIndicesVar, inputs.FSIn_localCoordsVar}; - FSOut v_12 = main_inner(v_11); - main_outputs v_13 = {v_12.sk_FragColor}; - return v_13; + FSIn v_10 = {inputs.FSIn_ssboIndicesVar, inputs.FSIn_localCoordsVar}; + FSOut v_11 = main_inner(v_10); + main_outputs v_12 = {v_11.sk_FragColor}; + return v_12; } diff --git a/test/tint/bug/tint/379127084.wgsl.expected.ir.fxc.hlsl b/test/tint/bug/tint/379127084.wgsl.expected.ir.fxc.hlsl index 2dd9723ad10..4453347484a 100644 --- a/test/tint/bug/tint/379127084.wgsl.expected.ir.fxc.hlsl +++ b/test/tint/bug/tint/379127084.wgsl.expected.ir.fxc.hlsl @@ -32,21 +32,20 @@ float4x4 v(uint offset) { void _skslMain(FSIn _stageIn, inout FSOut _stageOut) { shadingSsboIndex = _stageIn.ssboIndicesVar.y; - int _56_d = asint(_storage1.Load((16u + (uint(shadingSsboIndex) * 128u)))); - float2 _57_k = float2(((_stageIn.localCoordsVar + 0.5f) * asfloat(_storage1.Load2((0u + (uint(shadingSsboIndex) * 128u)))))); + int _56_d = asint(_storage1.Load((16u + (shadingSsboIndex * 128u)))); + float2 _57_k = float2(((_stageIn.localCoordsVar + 0.5f) * asfloat(_storage1.Load2((0u + (shadingSsboIndex * 128u)))))); float4 _58_l = (0.0f).xxxx; - float2 _59_m = float2(asfloat(_storage1.Load2((8u + (uint(shadingSsboIndex) * 128u))))); + float2 _59_m = float2(asfloat(_storage1.Load2((8u + (shadingSsboIndex * 128u))))); float _60_n = 1.0f; int _61_o = int(0); { while(true) { - int v_1 = _61_o; - if ((v_1 < asint(_storage1.Load((20u + (uint(shadingSsboIndex) * 128u)))))) { + if ((_61_o < asint(_storage1.Load((20u + (shadingSsboIndex * 128u)))))) { float4 _62_f = (0.0f).xxxx; float2 _skTemp2 = floor(_57_k); _62_f = float4(_skTemp2, _62_f.zw); _62_f = float4(_62_f.xy, (_62_f.xy + (1.0f).xx)); - if (bool(asint(_storage1.Load((24u + (uint(shadingSsboIndex) * 128u)))))) { + if (bool(asint(_storage1.Load((24u + (shadingSsboIndex * 128u)))))) { float4 _skTemp3 = step(_59_m.xyxy, _62_f); _62_f = (_62_f - (_skTemp3 * _59_m.xyxy)); } @@ -69,14 +68,14 @@ void _skslMain(FSIn _stageIn, inout FSOut _stageOut) { { while(true) { float _73_i = ((float(_72_h) + 0.5f) * 0.25f); - float v_2 = float(_67_p.x); - float4 _74_j = noiseSampler_1_Texture.SampleBias(noiseSampler_1_Sampler, float2(v_2, float(_73_i)), clamp(-0.47499999403953552246f, -16.0f, 15.9899997711181640625f)); - float v_3 = float(_67_p.y); - float4 _75_k = noiseSampler_1_Texture.SampleBias(noiseSampler_1_Sampler, float2(v_3, float(_73_i)), clamp(-0.47499999403953552246f, -16.0f, 15.9899997711181640625f)); - float v_4 = float(_67_p.w); - float4 _76_l = noiseSampler_1_Texture.SampleBias(noiseSampler_1_Sampler, float2(v_4, float(_73_i)), clamp(-0.47499999403953552246f, -16.0f, 15.9899997711181640625f)); - float v_5 = float(_67_p.z); - float4 _77_m = noiseSampler_1_Texture.SampleBias(noiseSampler_1_Sampler, float2(v_5, float(_73_i)), clamp(-0.47499999403953552246f, -16.0f, 15.9899997711181640625f)); + float v_1 = float(_67_p.x); + float4 _74_j = noiseSampler_1_Texture.SampleBias(noiseSampler_1_Sampler, float2(v_1, float(_73_i)), clamp(-0.47499999403953552246f, -16.0f, 15.9899997711181640625f)); + float v_2 = float(_67_p.y); + float4 _75_k = noiseSampler_1_Texture.SampleBias(noiseSampler_1_Sampler, float2(v_2, float(_73_i)), clamp(-0.47499999403953552246f, -16.0f, 15.9899997711181640625f)); + float v_3 = float(_67_p.w); + float4 _76_l = noiseSampler_1_Texture.SampleBias(noiseSampler_1_Sampler, float2(v_3, float(_73_i)), clamp(-0.47499999403953552246f, -16.0f, 15.9899997711181640625f)); + float v_4 = float(_67_p.z); + float4 _77_m = noiseSampler_1_Texture.SampleBias(noiseSampler_1_Sampler, float2(v_4, float(_73_i)), clamp(-0.47499999403953552246f, -16.0f, 15.9899997711181640625f)); float2 _78_n = _68_d; float _skTemp7 = dot((((_74_j.yw + (_74_j.xz * 0.00390625f)) * 2.0f) - 1.0f), _78_n); float _79_o = _skTemp7; @@ -94,9 +93,9 @@ void _skslMain(FSIn _stageIn, inout FSOut _stageOut) { float _skTemp12 = lerp(_79_o, _80_p, _69_e.x); float _82_r = _skTemp12; float _skTemp13 = lerp(_81_q, _82_r, _69_e.y); - float4 v_6 = _71_g; - float4 v_7 = _72_h.xxxx; - _71_g = (((v_7 == float4(int(0), int(1), int(2), int(3)))) ? (_skTemp13.xxxx) : (v_6)); + float4 v_5 = _71_g; + float4 v_6 = _72_h.xxxx; + _71_g = (((v_6 == float4(int(0), int(1), int(2), int(3)))) ? (_skTemp13.xxxx) : (v_5)); { _72_h = (_72_h + int(1)); if ((_72_h >= int(4))) { break; } @@ -127,12 +126,12 @@ void _skslMain(FSIn _stageIn, inout FSOut _stageOut) { } float4 _skTemp15 = saturate(_58_l); _58_l = _skTemp15; - float3 v_8 = float3(_58_l.xyz); - float3 v_9 = float3((v_8 * float(_58_l.w))); - float _skTemp16 = dot(float3(0.21259999275207519531f, 0.71520000696182250977f, 0.07220000028610229492f), float4(v_9, float(float(_58_l.w))).xyz); + float3 v_7 = float3(_58_l.xyz); + float3 v_8 = float3((v_7 * float(_58_l.w))); + float _skTemp16 = dot(float3(0.21259999275207519531f, 0.71520000696182250977f, 0.07220000028610229492f), float4(v_8, float(float(_58_l.w))).xyz); float _skTemp17 = saturate(_skTemp16); float4 _84_a = float4(0.0f, 0.0f, 0.0f, _skTemp17); - int _85_d = asint(_storage1.Load((112u + (uint(shadingSsboIndex) * 128u)))); + int _85_d = asint(_storage1.Load((112u + (shadingSsboIndex * 128u)))); if (bool(_85_d)) { float4 _skTemp18 = (0.0f).xxxx; if ((_84_a.y < _84_a.z)) { @@ -162,9 +161,9 @@ void _skslMain(FSIn _stageIn, inout FSOut _stageOut) { float _skTemp23 = max(_84_a.w, 0.00009999999747378752f); _84_a = float4((_84_a.xyz / _skTemp23), _84_a.w); } - float4x4 v_10 = v((32u + (uint(shadingSsboIndex) * 128u))); - float4 v_11 = mul(float4(_84_a), v_10); - float4 _94_f = float4((v_11 + asfloat(_storage1.Load4((96u + (uint(shadingSsboIndex) * 128u)))))); + float4x4 v_9 = v((32u + (shadingSsboIndex * 128u))); + float4 v_10 = mul(float4(_84_a), v_9); + float4 _94_f = float4((v_10 + asfloat(_storage1.Load4((96u + (shadingSsboIndex * 128u)))))); if (bool(_85_d)) { float _skTemp24 = abs(((2.0f * _94_f.z) - 1.0f)); float _95_b = ((1.0f - _skTemp24) * _94_f.y); @@ -176,7 +175,7 @@ void _skslMain(FSIn _stageIn, inout FSOut _stageOut) { float4 _skTemp28 = saturate(float4(((((_97_d - 0.5f) * _95_b) + _94_f.z) * _94_f.w), _94_f.w)); _94_f = _skTemp28; } else { - if (bool(asint(_storage1.Load((116u + (uint(shadingSsboIndex) * 128u)))))) { + if (bool(asint(_storage1.Load((116u + (shadingSsboIndex * 128u)))))) { float4 _skTemp29 = saturate(_94_f); _94_f = _skTemp29; } else { @@ -192,14 +191,14 @@ void _skslMain(FSIn _stageIn, inout FSOut _stageOut) { FSOut main_inner(FSIn _stageIn) { FSOut _stageOut = (FSOut)0; _skslMain(_stageIn, _stageOut); - FSOut v_12 = _stageOut; - return v_12; + FSOut v_11 = _stageOut; + return v_11; } main_outputs main(main_inputs inputs) { - FSIn v_13 = {inputs.FSIn_ssboIndicesVar, inputs.FSIn_localCoordsVar}; - FSOut v_14 = main_inner(v_13); - main_outputs v_15 = {v_14.sk_FragColor}; - return v_15; + FSIn v_12 = {inputs.FSIn_ssboIndicesVar, inputs.FSIn_localCoordsVar}; + FSOut v_13 = main_inner(v_12); + main_outputs v_14 = {v_13.sk_FragColor}; + return v_14; } diff --git a/test/tint/bug/tint/379684039-2.wgsl b/test/tint/bug/tint/379684039-2.wgsl new file mode 100644 index 00000000000..1de2b8fa2eb --- /dev/null +++ b/test/tint/bug/tint/379684039-2.wgsl @@ -0,0 +1,19 @@ +var idx: u32; + +struct FSUniformData { + k: array, + size: vec2i, +} +struct FSUniforms { + fsUniformData: array, +} + +@group(0) @binding(2) var _storage : FSUniforms; +fn main() { + var vec: vec2 = vec2(0); + loop { + if vec.y >= _storage.fsUniformData[idx].size.y { + break; + } + } +} diff --git a/test/tint/bug/tint/379684039-2.wgsl.expected.dxc.hlsl b/test/tint/bug/tint/379684039-2.wgsl.expected.dxc.hlsl new file mode 100644 index 00000000000..7f222beee1a --- /dev/null +++ b/test/tint/bug/tint/379684039-2.wgsl.expected.dxc.hlsl @@ -0,0 +1,17 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static uint idx = 0u; + +ByteAddressBuffer _storage : register(t2); + +void main() { + int2 vec = (0).xx; + while (true) { + if ((vec.y >= asint(_storage.Load((((128u * idx) + 112u) + 4u))))) { + break; + } + } +} diff --git a/test/tint/bug/tint/379684039-2.wgsl.expected.fxc.hlsl b/test/tint/bug/tint/379684039-2.wgsl.expected.fxc.hlsl new file mode 100644 index 00000000000..7f222beee1a --- /dev/null +++ b/test/tint/bug/tint/379684039-2.wgsl.expected.fxc.hlsl @@ -0,0 +1,17 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static uint idx = 0u; + +ByteAddressBuffer _storage : register(t2); + +void main() { + int2 vec = (0).xx; + while (true) { + if ((vec.y >= asint(_storage.Load((((128u * idx) + 112u) + 4u))))) { + break; + } + } +} diff --git a/test/tint/bug/tint/379684039-2.wgsl.expected.glsl b/test/tint/bug/tint/379684039-2.wgsl.expected.glsl new file mode 100644 index 00000000000..ee77df77d5b --- /dev/null +++ b/test/tint/bug/tint/379684039-2.wgsl.expected.glsl @@ -0,0 +1,33 @@ +#version 310 es + + +struct FSUniformData { + vec4 k[7]; + ivec2 size; + uint tint_pad_0; + uint tint_pad_1; +}; + +uint idx = 0u; +layout(binding = 2, std430) +buffer FSUniforms_1_ssbo { + FSUniformData fsUniformData[]; +} _storage; +void tint_symbol() { + ivec2 vec = ivec2(0); + { + while(true) { + int v = vec.y; + uint v_1 = idx; + if ((v >= _storage.fsUniformData[v_1].size.y)) { + break; + } + { + } + continue; + } + } +} +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { +} diff --git a/test/tint/bug/tint/379684039-2.wgsl.expected.ir.dxc.hlsl b/test/tint/bug/tint/379684039-2.wgsl.expected.ir.dxc.hlsl new file mode 100644 index 00000000000..6f322dcbd0d --- /dev/null +++ b/test/tint/bug/tint/379684039-2.wgsl.expected.ir.dxc.hlsl @@ -0,0 +1,21 @@ + +static uint idx = 0u; +ByteAddressBuffer _storage : register(t2); +void main() { + int2 vec = (int(0)).xx; + { + while(true) { + if ((vec.y >= asint(_storage.Load((116u + (idx * 128u)))))) { + break; + } + { + } + continue; + } + } +} + +[numthreads(1, 1, 1)] +void unused_entry_point() { +} + diff --git a/test/tint/bug/tint/379684039-2.wgsl.expected.ir.fxc.hlsl b/test/tint/bug/tint/379684039-2.wgsl.expected.ir.fxc.hlsl new file mode 100644 index 00000000000..6f322dcbd0d --- /dev/null +++ b/test/tint/bug/tint/379684039-2.wgsl.expected.ir.fxc.hlsl @@ -0,0 +1,21 @@ + +static uint idx = 0u; +ByteAddressBuffer _storage : register(t2); +void main() { + int2 vec = (int(0)).xx; + { + while(true) { + if ((vec.y >= asint(_storage.Load((116u + (idx * 128u)))))) { + break; + } + { + } + continue; + } + } +} + +[numthreads(1, 1, 1)] +void unused_entry_point() { +} + diff --git a/test/tint/bug/tint/379684039-2.wgsl.expected.ir.msl b/test/tint/bug/tint/379684039-2.wgsl.expected.ir.msl new file mode 100644 index 00000000000..6dac66ba315 --- /dev/null +++ b/test/tint/bug/tint/379684039-2.wgsl.expected.ir.msl @@ -0,0 +1,46 @@ +#include +using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + +struct FSUniformData { + tint_array k; + int2 size; +}; + +struct FSUniforms { + tint_array fsUniformData; +}; + +struct tint_module_vars_struct { + thread uint* idx; + const device FSUniforms* _storage; +}; + +#define TINT_ISOLATE_UB(VOLATILE_NAME) \ + {volatile bool VOLATILE_NAME = false; if (VOLATILE_NAME) break;} + +void tint_symbol(tint_module_vars_struct tint_module_vars) { + int2 tint_symbol_1 = int2(0); + { + while(true) { + TINT_ISOLATE_UB(tint_volatile_false) + if ((tint_symbol_1[1u] >= (*tint_module_vars._storage).fsUniformData[(*tint_module_vars.idx)].size[1u])) { + break; + } + { + } + continue; + } + } +} diff --git a/test/tint/bug/tint/379684039-2.wgsl.expected.msl b/test/tint/bug/tint/379684039-2.wgsl.expected.msl new file mode 100644 index 00000000000..8f868b9a1a8 --- /dev/null +++ b/test/tint/bug/tint/379684039-2.wgsl.expected.msl @@ -0,0 +1,43 @@ +#include + +using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + +#define TINT_ISOLATE_UB(VOLATILE_NAME) \ + {volatile bool VOLATILE_NAME = false; if (VOLATILE_NAME) break;} + +struct tint_private_vars_struct { + uint idx; +}; + +struct FSUniformData { + /* 0x0000 */ tint_array k; + /* 0x0070 */ int2 size; + /* 0x0078 */ tint_array tint_pad; +}; + +struct FSUniforms { + /* 0x0000 */ tint_array fsUniformData; +}; + +void tint_symbol(thread tint_private_vars_struct* const tint_private_vars, const device FSUniforms* const tint_symbol_2) { + int2 tint_symbol_1 = int2(0); + while(true) { + TINT_ISOLATE_UB(tint_volatile_false); + if ((tint_symbol_1[1] >= (*(tint_symbol_2)).fsUniformData[(*(tint_private_vars)).idx].size[1])) { + break; + } + } +} + diff --git a/test/tint/bug/tint/379684039-2.wgsl.expected.spvasm b/test/tint/bug/tint/379684039-2.wgsl.expected.spvasm new file mode 100644 index 00000000000..2c6614ebbcf --- /dev/null +++ b/test/tint/bug/tint/379684039-2.wgsl.expected.spvasm @@ -0,0 +1,84 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 1 +; Bound: 44 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %idx "idx" + OpMemberName %FSUniformData 0 "k" + OpMemberName %FSUniformData 1 "size" + OpName %FSUniformData "FSUniformData" + OpMemberName %FSUniforms 0 "fsUniformData" + OpName %FSUniforms "FSUniforms" + OpName %_storage "_storage" + OpName %main "main" + OpName %vec "vec" + OpName %unused_entry_point "unused_entry_point" + OpDecorate %_arr_v4float_uint_7 ArrayStride 16 + OpMemberDecorate %FSUniformData 0 Offset 0 + OpMemberDecorate %FSUniformData 1 Offset 112 + OpDecorate %_runtimearr_FSUniformData ArrayStride 128 + OpMemberDecorate %FSUniforms 0 Offset 0 + OpDecorate %FSUniforms Block + OpDecorate %_storage DescriptorSet 0 + OpDecorate %_storage Binding 2 + OpDecorate %_storage NonWritable + %uint = OpTypeInt 32 0 +%_ptr_Private_uint = OpTypePointer Private %uint + %4 = OpConstantNull %uint + %idx = OpVariable %_ptr_Private_uint Private %4 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %uint_7 = OpConstant %uint 7 +%_arr_v4float_uint_7 = OpTypeArray %v4float %uint_7 + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 +%FSUniformData = OpTypeStruct %_arr_v4float_uint_7 %v2int +%_runtimearr_FSUniformData = OpTypeRuntimeArray %FSUniformData + %FSUniforms = OpTypeStruct %_runtimearr_FSUniformData +%_ptr_StorageBuffer_FSUniforms = OpTypePointer StorageBuffer %FSUniforms + %_storage = OpVariable %_ptr_StorageBuffer_FSUniforms StorageBuffer + %void = OpTypeVoid + %18 = OpTypeFunction %void +%_ptr_Function_v2int = OpTypePointer Function %v2int + %22 = OpConstantNull %v2int +%_ptr_Function_int = OpTypePointer Function %int + %uint_1 = OpConstant %uint 1 +%_ptr_StorageBuffer_v2int = OpTypePointer StorageBuffer %v2int + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int + %bool = OpTypeBool + %main = OpFunction %void None %18 + %19 = OpLabel + %vec = OpVariable %_ptr_Function_v2int Function + OpStore %vec %22 + OpBranch %25 + %25 = OpLabel + OpLoopMerge %26 %24 None + OpBranch %23 + %23 = OpLabel + %27 = OpAccessChain %_ptr_Function_int %vec %uint_1 + %30 = OpLoad %int %27 None + %31 = OpLoad %uint %idx None + %32 = OpAccessChain %_ptr_StorageBuffer_v2int %_storage %uint_0 %31 %uint_1 + %35 = OpAccessChain %_ptr_StorageBuffer_int %32 %uint_1 + %37 = OpLoad %int %35 None + %38 = OpSGreaterThanEqual %bool %30 %37 + OpSelectionMerge %40 None + OpBranchConditional %38 %41 %40 + %41 = OpLabel + OpBranch %26 + %40 = OpLabel + OpBranch %24 + %24 = OpLabel + OpBranch %25 + %26 = OpLabel + OpReturn + OpFunctionEnd +%unused_entry_point = OpFunction %void None %18 + %43 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/bug/tint/379684039-2.wgsl.expected.wgsl b/test/tint/bug/tint/379684039-2.wgsl.expected.wgsl new file mode 100644 index 00000000000..ce7c06afd32 --- /dev/null +++ b/test/tint/bug/tint/379684039-2.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +var idx : u32; + +struct FSUniformData { + k : array, + size : vec2i, +} + +struct FSUniforms { + fsUniformData : array, +} + +@group(0) @binding(2) var _storage : FSUniforms; + +fn main() { + var vec : vec2 = vec2(0); + loop { + if ((vec.y >= _storage.fsUniformData[idx].size.y)) { + break; + } + } +} diff --git a/test/tint/bug/tint/534.wgsl.expected.ir.dxc.hlsl b/test/tint/bug/tint/534.wgsl.expected.ir.dxc.hlsl index 648e3b96f06..d244ca6ead9 100644 --- a/test/tint/bug/tint/534.wgsl.expected.ir.dxc.hlsl +++ b/test/tint/bug/tint/534.wgsl.expected.ir.dxc.hlsl @@ -57,9 +57,9 @@ void main_inner(uint3 GlobalInvocationID) { } uint outputIndex = ((GlobalInvocationID.y * uint(size.x)) + GlobalInvocationID.x); if (success) { - output.Store((0u + (uint(outputIndex) * 4u)), 1u); + output.Store((0u + (outputIndex * 4u)), 1u); } else { - output.Store((0u + (uint(outputIndex) * 4u)), 0u); + output.Store((0u + (outputIndex * 4u)), 0u); } } diff --git a/test/tint/bug/tint/534.wgsl.expected.ir.fxc.hlsl b/test/tint/bug/tint/534.wgsl.expected.ir.fxc.hlsl index 284e9629f5d..66b230b17f4 100644 --- a/test/tint/bug/tint/534.wgsl.expected.ir.fxc.hlsl +++ b/test/tint/bug/tint/534.wgsl.expected.ir.fxc.hlsl @@ -59,9 +59,9 @@ void main_inner(uint3 GlobalInvocationID) { } uint outputIndex = ((GlobalInvocationID.y * uint(size.x)) + GlobalInvocationID.x); if (success) { - output.Store((0u + (uint(outputIndex) * 4u)), 1u); + output.Store((0u + (outputIndex * 4u)), 1u); } else { - output.Store((0u + (uint(outputIndex) * 4u)), 0u); + output.Store((0u + (outputIndex * 4u)), 0u); } } diff --git a/test/tint/bug/tint/744.wgsl.expected.ir.dxc.hlsl b/test/tint/bug/tint/744.wgsl.expected.ir.dxc.hlsl index b82e738e860..6bdb2465495 100644 --- a/test/tint/bug/tint/744.wgsl.expected.ir.dxc.hlsl +++ b/test/tint/bug/tint/744.wgsl.expected.ir.dxc.hlsl @@ -23,9 +23,7 @@ void main_inner(uint3 global_id) { } uint a = (i + (resultCell.x * dimInner)); uint b = (resultCell.y + (i * dimOutter)); - uint v = result; - uint v_1 = firstMatrix.Load((0u + (uint(a) * 4u))); - result = (v + (v_1 * secondMatrix.Load((0u + (uint(b) * 4u))))); + result = (result + (firstMatrix.Load((0u + (a * 4u))) * secondMatrix.Load((0u + (b * 4u))))); { i = (i + 1u); } @@ -33,8 +31,7 @@ void main_inner(uint3 global_id) { } } uint index = (resultCell.y + (resultCell.x * dimOutter)); - uint v_2 = (uint(index) * 4u); - resultMatrix.Store((0u + v_2), result); + resultMatrix.Store((0u + (index * 4u)), result); } [numthreads(2, 2, 1)] diff --git a/test/tint/bug/tint/744.wgsl.expected.ir.fxc.hlsl b/test/tint/bug/tint/744.wgsl.expected.ir.fxc.hlsl index b82e738e860..6bdb2465495 100644 --- a/test/tint/bug/tint/744.wgsl.expected.ir.fxc.hlsl +++ b/test/tint/bug/tint/744.wgsl.expected.ir.fxc.hlsl @@ -23,9 +23,7 @@ void main_inner(uint3 global_id) { } uint a = (i + (resultCell.x * dimInner)); uint b = (resultCell.y + (i * dimOutter)); - uint v = result; - uint v_1 = firstMatrix.Load((0u + (uint(a) * 4u))); - result = (v + (v_1 * secondMatrix.Load((0u + (uint(b) * 4u))))); + result = (result + (firstMatrix.Load((0u + (a * 4u))) * secondMatrix.Load((0u + (b * 4u))))); { i = (i + 1u); } @@ -33,8 +31,7 @@ void main_inner(uint3 global_id) { } } uint index = (resultCell.y + (resultCell.x * dimOutter)); - uint v_2 = (uint(index) * 4u); - resultMatrix.Store((0u + v_2), result); + resultMatrix.Store((0u + (index * 4u)), result); } [numthreads(2, 2, 1)] diff --git a/test/tint/bug/tint/757.wgsl.expected.ir.dxc.hlsl b/test/tint/bug/tint/757.wgsl.expected.ir.dxc.hlsl index 738bd6409c3..584799bbd82 100644 --- a/test/tint/bug/tint/757.wgsl.expected.ir.dxc.hlsl +++ b/test/tint/bug/tint/757.wgsl.expected.ir.dxc.hlsl @@ -21,8 +21,7 @@ void main_inner(uint3 GlobalInvocationID) { } else { break; } - uint v_2 = (uint((flatIndex + i)) * 4u); - result.Store((0u + v_2), asuint(texel.x)); + result.Store((0u + ((flatIndex + i) * 4u)), asuint(texel.x)); { i = (i + 1u); } diff --git a/test/tint/bug/tint/757.wgsl.expected.ir.fxc.hlsl b/test/tint/bug/tint/757.wgsl.expected.ir.fxc.hlsl index 738bd6409c3..584799bbd82 100644 --- a/test/tint/bug/tint/757.wgsl.expected.ir.fxc.hlsl +++ b/test/tint/bug/tint/757.wgsl.expected.ir.fxc.hlsl @@ -21,8 +21,7 @@ void main_inner(uint3 GlobalInvocationID) { } else { break; } - uint v_2 = (uint((flatIndex + i)) * 4u); - result.Store((0u + v_2), asuint(texel.x)); + result.Store((0u + ((flatIndex + i) * 4u)), asuint(texel.x)); { i = (i + 1u); } diff --git a/test/tint/bug/tint/827.wgsl.expected.ir.dxc.hlsl b/test/tint/bug/tint/827.wgsl.expected.ir.dxc.hlsl index 379ded0d339..8030b095ef8 100644 --- a/test/tint/bug/tint/827.wgsl.expected.ir.dxc.hlsl +++ b/test/tint/bug/tint/827.wgsl.expected.ir.dxc.hlsl @@ -6,10 +6,9 @@ struct main_inputs { Texture2D tex : register(t0); RWByteAddressBuffer result : register(u1); void main_inner(uint3 GlobalInvocationId) { - uint v = (uint(((GlobalInvocationId.y * 128u) + GlobalInvocationId.x)) * 4u); - int v_1 = int(GlobalInvocationId.x); - int2 v_2 = int2(int2(v_1, int(GlobalInvocationId.y))); - result.Store((0u + v), asuint(tex.Load(int3(v_2, int(int(0)))).x)); + int v = int(GlobalInvocationId.x); + int2 v_1 = int2(int2(v, int(GlobalInvocationId.y))); + result.Store((0u + (((GlobalInvocationId.y * 128u) + GlobalInvocationId.x) * 4u)), asuint(tex.Load(int3(v_1, int(int(0)))).x)); } [numthreads(1, 1, 1)] diff --git a/test/tint/bug/tint/827.wgsl.expected.ir.fxc.hlsl b/test/tint/bug/tint/827.wgsl.expected.ir.fxc.hlsl index 379ded0d339..8030b095ef8 100644 --- a/test/tint/bug/tint/827.wgsl.expected.ir.fxc.hlsl +++ b/test/tint/bug/tint/827.wgsl.expected.ir.fxc.hlsl @@ -6,10 +6,9 @@ struct main_inputs { Texture2D tex : register(t0); RWByteAddressBuffer result : register(u1); void main_inner(uint3 GlobalInvocationId) { - uint v = (uint(((GlobalInvocationId.y * 128u) + GlobalInvocationId.x)) * 4u); - int v_1 = int(GlobalInvocationId.x); - int2 v_2 = int2(int2(v_1, int(GlobalInvocationId.y))); - result.Store((0u + v), asuint(tex.Load(int3(v_2, int(int(0)))).x)); + int v = int(GlobalInvocationId.x); + int2 v_1 = int2(int2(v, int(GlobalInvocationId.y))); + result.Store((0u + (((GlobalInvocationId.y * 128u) + GlobalInvocationId.x) * 4u)), asuint(tex.Load(int3(v_1, int(int(0)))).x)); } [numthreads(1, 1, 1)] diff --git a/test/tint/bug/tint/913.wgsl.expected.ir.dxc.hlsl b/test/tint/bug/tint/913.wgsl.expected.ir.dxc.hlsl index f2dfb96cdee..7100aeb386c 100644 --- a/test/tint/bug/tint/913.wgsl.expected.ir.dxc.hlsl +++ b/test/tint/bug/tint/913.wgsl.expected.ir.dxc.hlsl @@ -103,9 +103,9 @@ void main_inner(uint3 GlobalInvocationID) { } uint outputIndex = ((GlobalInvocationID.y * dstSize.x) + GlobalInvocationID.x); if (success) { - output.Store((0u + (uint(outputIndex) * 4u)), 1u); + output.Store((0u + (outputIndex * 4u)), 1u); } else { - output.Store((0u + (uint(outputIndex) * 4u)), 0u); + output.Store((0u + (outputIndex * 4u)), 0u); } } diff --git a/test/tint/bug/tint/913.wgsl.expected.ir.fxc.hlsl b/test/tint/bug/tint/913.wgsl.expected.ir.fxc.hlsl index f2dfb96cdee..7100aeb386c 100644 --- a/test/tint/bug/tint/913.wgsl.expected.ir.fxc.hlsl +++ b/test/tint/bug/tint/913.wgsl.expected.ir.fxc.hlsl @@ -103,9 +103,9 @@ void main_inner(uint3 GlobalInvocationID) { } uint outputIndex = ((GlobalInvocationID.y * dstSize.x) + GlobalInvocationID.x); if (success) { - output.Store((0u + (uint(outputIndex) * 4u)), 1u); + output.Store((0u + (outputIndex * 4u)), 1u); } else { - output.Store((0u + (uint(outputIndex) * 4u)), 0u); + output.Store((0u + (outputIndex * 4u)), 0u); } } diff --git a/test/tint/bug/tint/914.wgsl.expected.ir.dxc.hlsl b/test/tint/bug/tint/914.wgsl.expected.ir.dxc.hlsl index f6e006c4d55..d1d7ff9621f 100644 --- a/test/tint/bug/tint/914.wgsl.expected.ir.dxc.hlsl +++ b/test/tint/bug/tint/914.wgsl.expected.ir.dxc.hlsl @@ -21,7 +21,7 @@ float mm_readA(uint row, uint col) { v = false; } if (v) { - float result = asfloat(firstMatrix.Load((0u + (uint(((row * uniforms[0u].y) + col)) * 4u)))); + float result = asfloat(firstMatrix.Load((0u + (((row * uniforms[0u].y) + col) * 4u)))); return result; } return 0.0f; @@ -35,7 +35,7 @@ float mm_readB(uint row, uint col) { v_1 = false; } if (v_1) { - float result = asfloat(secondMatrix.Load((0u + (uint(((row * uniforms[0u].z) + col)) * 4u)))); + float result = asfloat(secondMatrix.Load((0u + (((row * uniforms[0u].z) + col) * 4u)))); return result; } return 0.0f; @@ -50,7 +50,7 @@ void mm_write(uint row, uint col, float value) { } if (v_2) { uint index = (col + (row * uniforms[0u].z)); - resultMatrix.Store((0u + (uint(index) * 4u)), asuint(value)); + resultMatrix.Store((0u + (index * 4u)), asuint(value)); } } diff --git a/test/tint/bug/tint/914.wgsl.expected.ir.fxc.hlsl b/test/tint/bug/tint/914.wgsl.expected.ir.fxc.hlsl index f6e006c4d55..d1d7ff9621f 100644 --- a/test/tint/bug/tint/914.wgsl.expected.ir.fxc.hlsl +++ b/test/tint/bug/tint/914.wgsl.expected.ir.fxc.hlsl @@ -21,7 +21,7 @@ float mm_readA(uint row, uint col) { v = false; } if (v) { - float result = asfloat(firstMatrix.Load((0u + (uint(((row * uniforms[0u].y) + col)) * 4u)))); + float result = asfloat(firstMatrix.Load((0u + (((row * uniforms[0u].y) + col) * 4u)))); return result; } return 0.0f; @@ -35,7 +35,7 @@ float mm_readB(uint row, uint col) { v_1 = false; } if (v_1) { - float result = asfloat(secondMatrix.Load((0u + (uint(((row * uniforms[0u].z) + col)) * 4u)))); + float result = asfloat(secondMatrix.Load((0u + (((row * uniforms[0u].z) + col) * 4u)))); return result; } return 0.0f; @@ -50,7 +50,7 @@ void mm_write(uint row, uint col, float value) { } if (v_2) { uint index = (col + (row * uniforms[0u].z)); - resultMatrix.Store((0u + (uint(index) * 4u)), asuint(value)); + resultMatrix.Store((0u + (index * 4u)), asuint(value)); } } diff --git a/test/tint/bug/tint/993.wgsl.expected.ir.dxc.hlsl b/test/tint/bug/tint/993.wgsl.expected.ir.dxc.hlsl index 4a9726de5c6..f5cf4d49e6c 100644 --- a/test/tint/bug/tint/993.wgsl.expected.ir.dxc.hlsl +++ b/test/tint/bug/tint/993.wgsl.expected.ir.dxc.hlsl @@ -6,7 +6,7 @@ RWByteAddressBuffer result : register(u1, space1); RWByteAddressBuffer s : register(u0); int runTest() { int v = int(0); - s.InterlockedOr(int((0u + (uint((0u + uint(constants[0u].x))) * 4u))), int(0), v); + s.InterlockedOr(int((0u + ((0u + uint(constants[0u].x)) * 4u))), int(0), v); return v; } diff --git a/test/tint/bug/tint/993.wgsl.expected.ir.fxc.hlsl b/test/tint/bug/tint/993.wgsl.expected.ir.fxc.hlsl index 4a9726de5c6..f5cf4d49e6c 100644 --- a/test/tint/bug/tint/993.wgsl.expected.ir.fxc.hlsl +++ b/test/tint/bug/tint/993.wgsl.expected.ir.fxc.hlsl @@ -6,7 +6,7 @@ RWByteAddressBuffer result : register(u1, space1); RWByteAddressBuffer s : register(u0); int runTest() { int v = int(0); - s.InterlockedOr(int((0u + (uint((0u + uint(constants[0u].x))) * 4u))), int(0), v); + s.InterlockedOr(int((0u + ((0u + uint(constants[0u].x)) * 4u))), int(0), v); return v; } diff --git a/test/tint/ptr_ref/load/param/storage/struct_in_array.wgsl.expected.ir.dxc.hlsl b/test/tint/ptr_ref/load/param/storage/struct_in_array.wgsl.expected.ir.dxc.hlsl index 38fdfdf1729..9b159eb7750 100644 --- a/test/tint/ptr_ref/load/param/storage/struct_in_array.wgsl.expected.ir.dxc.hlsl +++ b/test/tint/ptr_ref/load/param/storage/struct_in_array.wgsl.expected.ir.dxc.hlsl @@ -10,7 +10,7 @@ str v(uint offset) { } str func(uint pointer_indices[1]) { - str v_2 = v((0u + (uint(pointer_indices[0u]) * 4u))); + str v_2 = v((0u + (pointer_indices[0u] * 4u))); return v_2; } diff --git a/test/tint/ptr_ref/load/param/storage/struct_in_array.wgsl.expected.ir.fxc.hlsl b/test/tint/ptr_ref/load/param/storage/struct_in_array.wgsl.expected.ir.fxc.hlsl index 38fdfdf1729..9b159eb7750 100644 --- a/test/tint/ptr_ref/load/param/storage/struct_in_array.wgsl.expected.ir.fxc.hlsl +++ b/test/tint/ptr_ref/load/param/storage/struct_in_array.wgsl.expected.ir.fxc.hlsl @@ -10,7 +10,7 @@ str v(uint offset) { } str func(uint pointer_indices[1]) { - str v_2 = v((0u + (uint(pointer_indices[0u]) * 4u))); + str v_2 = v((0u + (pointer_indices[0u] * 4u))); return v_2; } diff --git a/test/tint/ptr_ref/load/param/storage/vec2_f32_in_mat2x2.wgsl.expected.ir.dxc.hlsl b/test/tint/ptr_ref/load/param/storage/vec2_f32_in_mat2x2.wgsl.expected.ir.dxc.hlsl index 7c519929d5e..cfb87845a3d 100644 --- a/test/tint/ptr_ref/load/param/storage/vec2_f32_in_mat2x2.wgsl.expected.ir.dxc.hlsl +++ b/test/tint/ptr_ref/load/param/storage/vec2_f32_in_mat2x2.wgsl.expected.ir.dxc.hlsl @@ -1,7 +1,7 @@ ByteAddressBuffer S : register(t0); float2 func(uint pointer_indices[1]) { - return asfloat(S.Load2((0u + (uint(pointer_indices[0u]) * 8u)))); + return asfloat(S.Load2((0u + (pointer_indices[0u] * 8u)))); } [numthreads(1, 1, 1)] diff --git a/test/tint/ptr_ref/load/param/storage/vec2_f32_in_mat2x2.wgsl.expected.ir.fxc.hlsl b/test/tint/ptr_ref/load/param/storage/vec2_f32_in_mat2x2.wgsl.expected.ir.fxc.hlsl index 7c519929d5e..cfb87845a3d 100644 --- a/test/tint/ptr_ref/load/param/storage/vec2_f32_in_mat2x2.wgsl.expected.ir.fxc.hlsl +++ b/test/tint/ptr_ref/load/param/storage/vec2_f32_in_mat2x2.wgsl.expected.ir.fxc.hlsl @@ -1,7 +1,7 @@ ByteAddressBuffer S : register(t0); float2 func(uint pointer_indices[1]) { - return asfloat(S.Load2((0u + (uint(pointer_indices[0u]) * 8u)))); + return asfloat(S.Load2((0u + (pointer_indices[0u] * 8u)))); } [numthreads(1, 1, 1)] diff --git a/test/tint/ptr_ref/load/param/storage/vec4_f32_in_mat2x4.wgsl.expected.ir.dxc.hlsl b/test/tint/ptr_ref/load/param/storage/vec4_f32_in_mat2x4.wgsl.expected.ir.dxc.hlsl index d102c40df4e..daafc369c31 100644 --- a/test/tint/ptr_ref/load/param/storage/vec4_f32_in_mat2x4.wgsl.expected.ir.dxc.hlsl +++ b/test/tint/ptr_ref/load/param/storage/vec4_f32_in_mat2x4.wgsl.expected.ir.dxc.hlsl @@ -1,7 +1,7 @@ ByteAddressBuffer S : register(t0); float4 func(uint pointer_indices[1]) { - return asfloat(S.Load4((0u + (uint(pointer_indices[0u]) * 16u)))); + return asfloat(S.Load4((0u + (pointer_indices[0u] * 16u)))); } [numthreads(1, 1, 1)] diff --git a/test/tint/ptr_ref/load/param/storage/vec4_f32_in_mat2x4.wgsl.expected.ir.fxc.hlsl b/test/tint/ptr_ref/load/param/storage/vec4_f32_in_mat2x4.wgsl.expected.ir.fxc.hlsl index d102c40df4e..daafc369c31 100644 --- a/test/tint/ptr_ref/load/param/storage/vec4_f32_in_mat2x4.wgsl.expected.ir.fxc.hlsl +++ b/test/tint/ptr_ref/load/param/storage/vec4_f32_in_mat2x4.wgsl.expected.ir.fxc.hlsl @@ -1,7 +1,7 @@ ByteAddressBuffer S : register(t0); float4 func(uint pointer_indices[1]) { - return asfloat(S.Load4((0u + (uint(pointer_indices[0u]) * 16u)))); + return asfloat(S.Load4((0u + (pointer_indices[0u] * 16u)))); } [numthreads(1, 1, 1)] diff --git a/test/tint/ptr_ref/store/param/storage/struct_in_array.wgsl.expected.ir.dxc.hlsl b/test/tint/ptr_ref/store/param/storage/struct_in_array.wgsl.expected.ir.dxc.hlsl index 6eca4ed7ed5..9be45eb2af0 100644 --- a/test/tint/ptr_ref/store/param/storage/struct_in_array.wgsl.expected.ir.dxc.hlsl +++ b/test/tint/ptr_ref/store/param/storage/struct_in_array.wgsl.expected.ir.dxc.hlsl @@ -10,7 +10,7 @@ void v(uint offset, str obj) { void func(uint pointer_indices[1]) { str v_1 = (str)0; - v((0u + (uint(pointer_indices[0u]) * 4u)), v_1); + v((0u + (pointer_indices[0u] * 4u)), v_1); } [numthreads(1, 1, 1)] diff --git a/test/tint/ptr_ref/store/param/storage/struct_in_array.wgsl.expected.ir.fxc.hlsl b/test/tint/ptr_ref/store/param/storage/struct_in_array.wgsl.expected.ir.fxc.hlsl index 6eca4ed7ed5..9be45eb2af0 100644 --- a/test/tint/ptr_ref/store/param/storage/struct_in_array.wgsl.expected.ir.fxc.hlsl +++ b/test/tint/ptr_ref/store/param/storage/struct_in_array.wgsl.expected.ir.fxc.hlsl @@ -10,7 +10,7 @@ void v(uint offset, str obj) { void func(uint pointer_indices[1]) { str v_1 = (str)0; - v((0u + (uint(pointer_indices[0u]) * 4u)), v_1); + v((0u + (pointer_indices[0u] * 4u)), v_1); } [numthreads(1, 1, 1)] diff --git a/test/tint/ptr_ref/store/param/storage/vec2_f32_in_mat2x2.wgsl.expected.ir.dxc.hlsl b/test/tint/ptr_ref/store/param/storage/vec2_f32_in_mat2x2.wgsl.expected.ir.dxc.hlsl index 104d2da810d..91a2ae93d3b 100644 --- a/test/tint/ptr_ref/store/param/storage/vec2_f32_in_mat2x2.wgsl.expected.ir.dxc.hlsl +++ b/test/tint/ptr_ref/store/param/storage/vec2_f32_in_mat2x2.wgsl.expected.ir.dxc.hlsl @@ -1,7 +1,7 @@ RWByteAddressBuffer S : register(u0); void func(uint pointer_indices[1]) { - S.Store2((0u + (uint(pointer_indices[0u]) * 8u)), asuint((0.0f).xx)); + S.Store2((0u + (pointer_indices[0u] * 8u)), asuint((0.0f).xx)); } [numthreads(1, 1, 1)] diff --git a/test/tint/ptr_ref/store/param/storage/vec2_f32_in_mat2x2.wgsl.expected.ir.fxc.hlsl b/test/tint/ptr_ref/store/param/storage/vec2_f32_in_mat2x2.wgsl.expected.ir.fxc.hlsl index 104d2da810d..91a2ae93d3b 100644 --- a/test/tint/ptr_ref/store/param/storage/vec2_f32_in_mat2x2.wgsl.expected.ir.fxc.hlsl +++ b/test/tint/ptr_ref/store/param/storage/vec2_f32_in_mat2x2.wgsl.expected.ir.fxc.hlsl @@ -1,7 +1,7 @@ RWByteAddressBuffer S : register(u0); void func(uint pointer_indices[1]) { - S.Store2((0u + (uint(pointer_indices[0u]) * 8u)), asuint((0.0f).xx)); + S.Store2((0u + (pointer_indices[0u] * 8u)), asuint((0.0f).xx)); } [numthreads(1, 1, 1)] diff --git a/test/tint/ptr_ref/store/param/storage/vec4_f32_in_mat2x4.wgsl.expected.ir.dxc.hlsl b/test/tint/ptr_ref/store/param/storage/vec4_f32_in_mat2x4.wgsl.expected.ir.dxc.hlsl index 114277b501a..0318dcc52f0 100644 --- a/test/tint/ptr_ref/store/param/storage/vec4_f32_in_mat2x4.wgsl.expected.ir.dxc.hlsl +++ b/test/tint/ptr_ref/store/param/storage/vec4_f32_in_mat2x4.wgsl.expected.ir.dxc.hlsl @@ -1,7 +1,7 @@ RWByteAddressBuffer S : register(u0); void func(uint pointer_indices[1]) { - S.Store4((0u + (uint(pointer_indices[0u]) * 16u)), asuint((0.0f).xxxx)); + S.Store4((0u + (pointer_indices[0u] * 16u)), asuint((0.0f).xxxx)); } [numthreads(1, 1, 1)] diff --git a/test/tint/ptr_ref/store/param/storage/vec4_f32_in_mat2x4.wgsl.expected.ir.fxc.hlsl b/test/tint/ptr_ref/store/param/storage/vec4_f32_in_mat2x4.wgsl.expected.ir.fxc.hlsl index 114277b501a..0318dcc52f0 100644 --- a/test/tint/ptr_ref/store/param/storage/vec4_f32_in_mat2x4.wgsl.expected.ir.fxc.hlsl +++ b/test/tint/ptr_ref/store/param/storage/vec4_f32_in_mat2x4.wgsl.expected.ir.fxc.hlsl @@ -1,7 +1,7 @@ RWByteAddressBuffer S : register(u0); void func(uint pointer_indices[1]) { - S.Store4((0u + (uint(pointer_indices[0u]) * 16u)), asuint((0.0f).xxxx)); + S.Store4((0u + (pointer_indices[0u] * 16u)), asuint((0.0f).xxxx)); } [numthreads(1, 1, 1)] diff --git a/test/tint/samples/compute_boids.wgsl.expected.ir.dxc.hlsl b/test/tint/samples/compute_boids.wgsl.expected.ir.dxc.hlsl index a9909fbe806..90ba35ab868 100644 --- a/test/tint/samples/compute_boids.wgsl.expected.ir.dxc.hlsl +++ b/test/tint/samples/compute_boids.wgsl.expected.ir.dxc.hlsl @@ -37,8 +37,8 @@ void comp_main_inner(uint3 gl_GlobalInvocationID) { if ((index >= 5u)) { return; } - float2 vPos = asfloat(particlesA.Load2((0u + (uint(index) * 16u)))); - float2 vVel = asfloat(particlesA.Load2((8u + (uint(index) * 16u)))); + float2 vPos = asfloat(particlesA.Load2((0u + (index * 16u)))); + float2 vVel = asfloat(particlesA.Load2((8u + (index * 16u)))); float2 cMass = (0.0f).xx; float2 cVel = (0.0f).xx; float2 colVel = (0.0f).xx; @@ -59,8 +59,8 @@ void comp_main_inner(uint3 gl_GlobalInvocationID) { } continue; } - pos = asfloat(particlesA.Load2((0u + (uint(i) * 16u)))).xy; - vel = asfloat(particlesA.Load2((8u + (uint(i) * 16u)))).xy; + pos = asfloat(particlesA.Load2((0u + (i * 16u)))).xy; + vel = asfloat(particlesA.Load2((8u + (i * 16u)))).xy; if ((distance(pos, vPos) < asfloat(params[0u].y))) { cMass = (cMass + pos); cMassCount = (cMassCount + int(1)); @@ -104,20 +104,18 @@ void comp_main_inner(uint3 gl_GlobalInvocationID) { if ((vPos.y > 1.0f)) { vPos.y = -1.0f; } - uint v_5 = (uint(index) * 16u); - particlesB.Store2((0u + v_5), asuint(vPos)); - uint v_6 = (uint(index) * 16u); - particlesB.Store2((8u + v_6), asuint(vVel)); + particlesB.Store2((0u + (index * 16u)), asuint(vPos)); + particlesB.Store2((8u + (index * 16u)), asuint(vVel)); } vert_main_outputs vert_main(vert_main_inputs inputs) { - vert_main_outputs v_7 = {vert_main_inner(inputs.a_particlePos, inputs.a_particleVel, inputs.a_pos)}; - return v_7; + vert_main_outputs v_5 = {vert_main_inner(inputs.a_particlePos, inputs.a_particleVel, inputs.a_pos)}; + return v_5; } frag_main_outputs frag_main() { - frag_main_outputs v_8 = {frag_main_inner()}; - return v_8; + frag_main_outputs v_6 = {frag_main_inner()}; + return v_6; } [numthreads(1, 1, 1)] diff --git a/test/tint/samples/compute_boids.wgsl.expected.ir.fxc.hlsl b/test/tint/samples/compute_boids.wgsl.expected.ir.fxc.hlsl index a9909fbe806..90ba35ab868 100644 --- a/test/tint/samples/compute_boids.wgsl.expected.ir.fxc.hlsl +++ b/test/tint/samples/compute_boids.wgsl.expected.ir.fxc.hlsl @@ -37,8 +37,8 @@ void comp_main_inner(uint3 gl_GlobalInvocationID) { if ((index >= 5u)) { return; } - float2 vPos = asfloat(particlesA.Load2((0u + (uint(index) * 16u)))); - float2 vVel = asfloat(particlesA.Load2((8u + (uint(index) * 16u)))); + float2 vPos = asfloat(particlesA.Load2((0u + (index * 16u)))); + float2 vVel = asfloat(particlesA.Load2((8u + (index * 16u)))); float2 cMass = (0.0f).xx; float2 cVel = (0.0f).xx; float2 colVel = (0.0f).xx; @@ -59,8 +59,8 @@ void comp_main_inner(uint3 gl_GlobalInvocationID) { } continue; } - pos = asfloat(particlesA.Load2((0u + (uint(i) * 16u)))).xy; - vel = asfloat(particlesA.Load2((8u + (uint(i) * 16u)))).xy; + pos = asfloat(particlesA.Load2((0u + (i * 16u)))).xy; + vel = asfloat(particlesA.Load2((8u + (i * 16u)))).xy; if ((distance(pos, vPos) < asfloat(params[0u].y))) { cMass = (cMass + pos); cMassCount = (cMassCount + int(1)); @@ -104,20 +104,18 @@ void comp_main_inner(uint3 gl_GlobalInvocationID) { if ((vPos.y > 1.0f)) { vPos.y = -1.0f; } - uint v_5 = (uint(index) * 16u); - particlesB.Store2((0u + v_5), asuint(vPos)); - uint v_6 = (uint(index) * 16u); - particlesB.Store2((8u + v_6), asuint(vVel)); + particlesB.Store2((0u + (index * 16u)), asuint(vPos)); + particlesB.Store2((8u + (index * 16u)), asuint(vVel)); } vert_main_outputs vert_main(vert_main_inputs inputs) { - vert_main_outputs v_7 = {vert_main_inner(inputs.a_particlePos, inputs.a_particleVel, inputs.a_pos)}; - return v_7; + vert_main_outputs v_5 = {vert_main_inner(inputs.a_particlePos, inputs.a_particleVel, inputs.a_pos)}; + return v_5; } frag_main_outputs frag_main() { - frag_main_outputs v_8 = {frag_main_inner()}; - return v_8; + frag_main_outputs v_6 = {frag_main_inner()}; + return v_6; } [numthreads(1, 1, 1)] diff --git a/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_dynamic_array.wgsl.expected.ir.dxc.hlsl b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_dynamic_array.wgsl.expected.ir.dxc.hlsl index b1bb6bb9f6d..5aa8396ac30 100644 --- a/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_dynamic_array.wgsl.expected.ir.dxc.hlsl +++ b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_dynamic_array.wgsl.expected.ir.dxc.hlsl @@ -14,8 +14,7 @@ void v_1(uint offset, InnerS obj) { [numthreads(1, 1, 1)] void main() { InnerS v = (InnerS)0; - uint v_2 = (uint(uniforms[0u].x) * 4u); - InnerS v_3 = v; - v_1((0u + v_2), v_3); + InnerS v_2 = v; + v_1((0u + (uniforms[0u].x * 4u)), v_2); } diff --git a/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_dynamic_array.wgsl.expected.ir.fxc.hlsl b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_dynamic_array.wgsl.expected.ir.fxc.hlsl index b1bb6bb9f6d..5aa8396ac30 100644 --- a/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_dynamic_array.wgsl.expected.ir.fxc.hlsl +++ b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_dynamic_array.wgsl.expected.ir.fxc.hlsl @@ -14,8 +14,7 @@ void v_1(uint offset, InnerS obj) { [numthreads(1, 1, 1)] void main() { InnerS v = (InnerS)0; - uint v_2 = (uint(uniforms[0u].x) * 4u); - InnerS v_3 = v; - v_1((0u + v_2), v_3); + InnerS v_2 = v; + v_1((0u + (uniforms[0u].x * 4u)), v_2); } diff --git a/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_dynamic_array_struct_array.wgsl.expected.ir.dxc.hlsl b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_dynamic_array_struct_array.wgsl.expected.ir.dxc.hlsl index 3583560c885..6af205bfc66 100644 --- a/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_dynamic_array_struct_array.wgsl.expected.ir.dxc.hlsl +++ b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_dynamic_array_struct_array.wgsl.expected.ir.dxc.hlsl @@ -14,10 +14,7 @@ void v_1(uint offset, InnerS obj) { [numthreads(1, 1, 1)] void main() { InnerS v = (InnerS)0; - uint v_2 = uniforms[0u].y; - uint v_3 = (uint(uniforms[0u].x) * 32u); - uint v_4 = (uint(v_2) * 4u); - InnerS v_5 = v; - v_1(((0u + v_3) + v_4), v_5); + InnerS v_2 = v; + v_1(((0u + (uniforms[0u].x * 32u)) + (uniforms[0u].y * 4u)), v_2); } diff --git a/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_dynamic_array_struct_array.wgsl.expected.ir.fxc.hlsl b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_dynamic_array_struct_array.wgsl.expected.ir.fxc.hlsl index 3583560c885..6af205bfc66 100644 --- a/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_dynamic_array_struct_array.wgsl.expected.ir.fxc.hlsl +++ b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_dynamic_array_struct_array.wgsl.expected.ir.fxc.hlsl @@ -14,10 +14,7 @@ void v_1(uint offset, InnerS obj) { [numthreads(1, 1, 1)] void main() { InnerS v = (InnerS)0; - uint v_2 = uniforms[0u].y; - uint v_3 = (uint(uniforms[0u].x) * 32u); - uint v_4 = (uint(v_2) * 4u); - InnerS v_5 = v; - v_1(((0u + v_3) + v_4), v_5); + InnerS v_2 = v; + v_1(((0u + (uniforms[0u].x * 32u)) + (uniforms[0u].y * 4u)), v_2); } diff --git a/test/tint/types/functions/shader_io/compute_subgroup_builtins.wgsl.expected.ir.dxc.hlsl b/test/tint/types/functions/shader_io/compute_subgroup_builtins.wgsl.expected.ir.dxc.hlsl index bc15bbd3afa..c6004ccc538 100644 --- a/test/tint/types/functions/shader_io/compute_subgroup_builtins.wgsl.expected.ir.dxc.hlsl +++ b/test/tint/types/functions/shader_io/compute_subgroup_builtins.wgsl.expected.ir.dxc.hlsl @@ -1,7 +1,7 @@ RWByteAddressBuffer output : register(u0); void main_inner(uint subgroup_invocation_id, uint subgroup_size) { - output.Store((0u + (uint(subgroup_invocation_id) * 4u)), subgroup_size); + output.Store((0u + (subgroup_invocation_id * 4u)), subgroup_size); } [numthreads(1, 1, 1)] diff --git a/test/tint/types/functions/shader_io/compute_subgroup_builtins_struct.wgsl.expected.ir.dxc.hlsl b/test/tint/types/functions/shader_io/compute_subgroup_builtins_struct.wgsl.expected.ir.dxc.hlsl index 08784ba7402..3ac97da48cc 100644 --- a/test/tint/types/functions/shader_io/compute_subgroup_builtins_struct.wgsl.expected.ir.dxc.hlsl +++ b/test/tint/types/functions/shader_io/compute_subgroup_builtins_struct.wgsl.expected.ir.dxc.hlsl @@ -6,7 +6,7 @@ struct ComputeInputs { RWByteAddressBuffer output : register(u0); void main_inner(ComputeInputs inputs) { - output.Store((0u + (uint(inputs.subgroup_invocation_id) * 4u)), inputs.subgroup_size); + output.Store((0u + (inputs.subgroup_invocation_id * 4u)), inputs.subgroup_size); } [numthreads(1, 1, 1)] diff --git a/test/tint/types/functions/shader_io/fragment_subgroup_builtins.wgsl.expected.ir.dxc.hlsl b/test/tint/types/functions/shader_io/fragment_subgroup_builtins.wgsl.expected.ir.dxc.hlsl index 2deb0100257..c3a47eaf230 100644 --- a/test/tint/types/functions/shader_io/fragment_subgroup_builtins.wgsl.expected.ir.dxc.hlsl +++ b/test/tint/types/functions/shader_io/fragment_subgroup_builtins.wgsl.expected.ir.dxc.hlsl @@ -1,7 +1,7 @@ RWByteAddressBuffer output : register(u0); void main_inner(uint subgroup_invocation_id, uint subgroup_size) { - output.Store((0u + (uint(subgroup_invocation_id) * 4u)), subgroup_size); + output.Store((0u + (subgroup_invocation_id * 4u)), subgroup_size); } void main() { diff --git a/test/tint/types/functions/shader_io/fragment_subgroup_builtins_struct.wgsl.expected.ir.dxc.hlsl b/test/tint/types/functions/shader_io/fragment_subgroup_builtins_struct.wgsl.expected.ir.dxc.hlsl index ad0d324b212..22272af6a4f 100644 --- a/test/tint/types/functions/shader_io/fragment_subgroup_builtins_struct.wgsl.expected.ir.dxc.hlsl +++ b/test/tint/types/functions/shader_io/fragment_subgroup_builtins_struct.wgsl.expected.ir.dxc.hlsl @@ -6,7 +6,7 @@ struct FragmentInputs { RWByteAddressBuffer output : register(u0); void main_inner(FragmentInputs inputs) { - output.Store((0u + (uint(inputs.subgroup_invocation_id) * 4u)), inputs.subgroup_size); + output.Store((0u + (inputs.subgroup_invocation_id * 4u)), inputs.subgroup_size); } void main() {