diff --git a/naga/src/back/hlsl/writer.rs b/naga/src/back/hlsl/writer.rs index b6b047b1f2..3e5d2a7f1b 100644 --- a/naga/src/back/hlsl/writer.rs +++ b/naga/src/back/hlsl/writer.rs @@ -2631,7 +2631,10 @@ impl<'a, W: fmt::Write> super::Writer<'a, W> { crate::Literal::F64(value) => write!(self.out, "{value:?}L")?, crate::Literal::F32(value) => write!(self.out, "{value:?}")?, crate::Literal::U32(value) => write!(self.out, "{value}u")?, - crate::Literal::I32(value) => write!(self.out, "{value}")?, + // HLSL has no suffix for explicit i32 literals, but not using any suffix + // makes the type ambiguous which prevents overload resolution from + // working. So we explicitly use the int() constructor syntax. + crate::Literal::I32(value) => write!(self.out, "int({value})")?, crate::Literal::U64(value) => write!(self.out, "{value}uL")?, crate::Literal::I64(value) => write!(self.out, "{value}L")?, crate::Literal::Bool(value) => write!(self.out, "{value}")?, diff --git a/naga/tests/out/hlsl/6772-unpack-expr-accesses.hlsl b/naga/tests/out/hlsl/6772-unpack-expr-accesses.hlsl index c6d6c3f150..be62edc89f 100644 --- a/naga/tests/out/hlsl/6772-unpack-expr-accesses.hlsl +++ b/naga/tests/out/hlsl/6772-unpack-expr-accesses.hlsl @@ -1,7 +1,7 @@ [numthreads(1, 1, 1)] void main() { - int phony = (int4(12u, 12u >> 8, 12u >> 16, 12u >> 24) << 24 >> 24)[2]; + int phony = (int4(12u, 12u >> 8, 12u >> 16, 12u >> 24) << 24 >> 24)[int(2)]; uint phony_1 = (uint4(12u, 12u >> 8, 12u >> 16, 12u >> 24) << 24 >> 24).y; return; } diff --git a/naga/tests/out/hlsl/abstract-types-return.hlsl b/naga/tests/out/hlsl/abstract-types-return.hlsl index fe2de29aee..77a09e8c9a 100644 --- a/naga/tests/out/hlsl/abstract-types-return.hlsl +++ b/naga/tests/out/hlsl/abstract-types-return.hlsl @@ -1,6 +1,6 @@ int return_i32_ai() { - return 1; + return int(1); } uint return_u32_ai() diff --git a/naga/tests/out/hlsl/access.hlsl b/naga/tests/out/hlsl/access.hlsl index dcb62ae2af..d0a1e9b219 100644 --- a/naga/tests/out/hlsl/access.hlsl +++ b/naga/tests/out/hlsl/access.hlsl @@ -93,7 +93,7 @@ GlobalConst ConstructGlobalConst(uint arg0, uint3 arg1, int arg2) { return ret; } -static GlobalConst global_const = ConstructGlobalConst(0u, uint3(0u, 0u, 0u), 0); +static GlobalConst global_const = ConstructGlobalConst(0u, uint3(0u, 0u, 0u), int(0)); RWByteAddressBuffer bar : register(u0); cbuffer baz : register(b1) { Baz baz; } RWByteAddressBuffer qux : register(u2); @@ -135,11 +135,11 @@ void SetMatScalarmOnBaz(Baz obj, float scalar, uint mat_idx, uint vec_idx) { void test_matrix_within_struct_accesses() { - int idx = 1; + int idx = int(1); Baz t = ConstructBaz(float3x2((1.0).xx, (2.0).xx, (3.0).xx)); int _e3 = idx; - idx = (_e3 - 1); + idx = (_e3 - int(1)); float3x2 l0_ = GetMatmOnBaz(baz); float2 l1_ = GetMatmOnBaz(baz)[0]; int _e14 = idx; @@ -153,7 +153,7 @@ void test_matrix_within_struct_accesses() int _e38 = idx; float l6_ = GetMatmOnBaz(baz)[_e36][_e38]; int _e51 = idx; - idx = (_e51 + 1); + idx = (_e51 + int(1)); SetMatmOnBaz(t, float3x2((6.0).xx, (5.0).xx, (4.0).xx)); t.m_0 = (9.0).xx; int _e66 = idx; @@ -182,11 +182,11 @@ ret_ZeroValuearray2_float4x2_ ZeroValuearray2_float4x2_() { void test_matrix_within_array_within_struct_accesses() { - int idx_1 = 1; + int idx_1 = int(1); MatCx2InArray t_1 = ConstructMatCx2InArray(ZeroValuearray2_float4x2_()); int _e3 = idx_1; - idx_1 = (_e3 - 1); + idx_1 = (_e3 - int(1)); float4x2 l0_1[2] = ((float4x2[2])nested_mat_cx2_.am); float4x2 l1_1 = ((float4x2)nested_mat_cx2_.am[0]); float2 l2_1 = nested_mat_cx2_.am[0]._0; @@ -201,7 +201,7 @@ void test_matrix_within_array_within_struct_accesses() int _e48 = idx_1; float l7_ = __get_col_of_mat4x2(nested_mat_cx2_.am[0], _e46)[_e48]; int _e55 = idx_1; - idx_1 = (_e55 + 1); + idx_1 = (_e55 + int(1)); t_1.am = (__mat4x2[2])ZeroValuearray2_float4x2_(); t_1.am[0] = (__mat4x2)float4x2((8.0).xx, (7.0).xx, (6.0).xx, (5.0).xx); t_1.am[0]._0 = (9.0).xx; @@ -294,7 +294,7 @@ S ConstructS(int arg0) { int member_ptr() { - S s = ConstructS(42); + S s = ConstructS(int(42)); int _e4 = s.m; return _e4; @@ -370,8 +370,8 @@ float4 foo_vert(uint vi : SV_VertexID) : SV_Position int a_2 = asint(bar.Load(0+(((NagaBufferLengthRW(bar) - 160) / 8) - 2u)*8+160)); int2 c = asint(qux.Load2(0)); const float _e33 = read_from_private(foo); - c2_ = Constructarray5_int_(a_2, int(b), 3, 4, 5); - c2_[min(uint((vi + 1u)), 4u)] = 42; + c2_ = Constructarray5_int_(a_2, int(b), int(3), int(4), int(5)); + c2_[min(uint((vi + 1u)), 4u)] = int(42); int value_1 = c2_[min(uint(vi), 4u)]; const float _e47 = test_arr_as_arg(ZeroValuearray5_array10_float__()); return float4(mul(float4((value_1).xxxx), _matrix), 2.0); @@ -396,7 +396,7 @@ float4 foo_frag() : SV_Target0 bar.Store2(144+0, asuint(_value2[0])); bar.Store2(144+8, asuint(_value2[1])); } - bar.Store(0+8+160, asuint(1)); + bar.Store(0+8+160, asuint(int(1))); qux.Store2(0, asuint(ZeroValueint2())); return (0.0).xxxx; } diff --git a/naga/tests/out/hlsl/atomicOps.hlsl b/naga/tests/out/hlsl/atomicOps.hlsl index 640972a2fa..52d11aa325 100644 --- a/naga/tests/out/hlsl/atomicOps.hlsl +++ b/naga/tests/out/hlsl/atomicOps.hlsl @@ -20,13 +20,13 @@ void cs_main(uint3 id : SV_GroupThreadID, uint3 __local_invocation_id : SV_Group } GroupMemoryBarrierWithGroupSync(); storage_atomic_scalar.Store(0, asuint(1u)); - storage_atomic_arr.Store(4, asuint(1)); + storage_atomic_arr.Store(4, asuint(int(1))); storage_struct.Store(0, asuint(1u)); - storage_struct.Store(4+4, asuint(1)); + storage_struct.Store(4+4, asuint(int(1))); workgroup_atomic_scalar = 1u; - workgroup_atomic_arr[1] = 1; + workgroup_atomic_arr[1] = int(1); workgroup_struct.atomic_scalar = 1u; - workgroup_struct.atomic_arr[1] = 1; + workgroup_struct.atomic_arr[1] = int(1); GroupMemoryBarrierWithGroupSync(); uint l0_ = asuint(storage_atomic_scalar.Load(0)); int l1_ = asint(storage_atomic_arr.Load(4)); @@ -38,74 +38,74 @@ void cs_main(uint3 id : SV_GroupThreadID, uint3 __local_invocation_id : SV_Group int l7_ = workgroup_struct.atomic_arr[1]; GroupMemoryBarrierWithGroupSync(); uint _e51; storage_atomic_scalar.InterlockedAdd(0, 1u, _e51); - int _e55; storage_atomic_arr.InterlockedAdd(4, 1, _e55); + int _e55; storage_atomic_arr.InterlockedAdd(4, int(1), _e55); uint _e59; storage_struct.InterlockedAdd(0, 1u, _e59); - int _e64; storage_struct.InterlockedAdd(4+4, 1, _e64); + int _e64; storage_struct.InterlockedAdd(4+4, int(1), _e64); uint _e67; InterlockedAdd(workgroup_atomic_scalar, 1u, _e67); - int _e71; InterlockedAdd(workgroup_atomic_arr[1], 1, _e71); + int _e71; InterlockedAdd(workgroup_atomic_arr[1], int(1), _e71); uint _e75; InterlockedAdd(workgroup_struct.atomic_scalar, 1u, _e75); - int _e80; InterlockedAdd(workgroup_struct.atomic_arr[1], 1, _e80); + int _e80; InterlockedAdd(workgroup_struct.atomic_arr[1], int(1), _e80); GroupMemoryBarrierWithGroupSync(); uint _e83; storage_atomic_scalar.InterlockedAdd(0, -1u, _e83); - int _e87; storage_atomic_arr.InterlockedAdd(4, -1, _e87); + int _e87; storage_atomic_arr.InterlockedAdd(4, -int(1), _e87); uint _e91; storage_struct.InterlockedAdd(0, -1u, _e91); - int _e96; storage_struct.InterlockedAdd(4+4, -1, _e96); + int _e96; storage_struct.InterlockedAdd(4+4, -int(1), _e96); uint _e99; InterlockedAdd(workgroup_atomic_scalar, -1u, _e99); - int _e103; InterlockedAdd(workgroup_atomic_arr[1], -1, _e103); + int _e103; InterlockedAdd(workgroup_atomic_arr[1], -int(1), _e103); uint _e107; InterlockedAdd(workgroup_struct.atomic_scalar, -1u, _e107); - int _e112; InterlockedAdd(workgroup_struct.atomic_arr[1], -1, _e112); + int _e112; InterlockedAdd(workgroup_struct.atomic_arr[1], -int(1), _e112); GroupMemoryBarrierWithGroupSync(); uint _e115; storage_atomic_scalar.InterlockedMax(0, 1u, _e115); - int _e119; storage_atomic_arr.InterlockedMax(4, 1, _e119); + int _e119; storage_atomic_arr.InterlockedMax(4, int(1), _e119); uint _e123; storage_struct.InterlockedMax(0, 1u, _e123); - int _e128; storage_struct.InterlockedMax(4+4, 1, _e128); + int _e128; storage_struct.InterlockedMax(4+4, int(1), _e128); uint _e131; InterlockedMax(workgroup_atomic_scalar, 1u, _e131); - int _e135; InterlockedMax(workgroup_atomic_arr[1], 1, _e135); + int _e135; InterlockedMax(workgroup_atomic_arr[1], int(1), _e135); uint _e139; InterlockedMax(workgroup_struct.atomic_scalar, 1u, _e139); - int _e144; InterlockedMax(workgroup_struct.atomic_arr[1], 1, _e144); + int _e144; InterlockedMax(workgroup_struct.atomic_arr[1], int(1), _e144); GroupMemoryBarrierWithGroupSync(); uint _e147; storage_atomic_scalar.InterlockedMin(0, 1u, _e147); - int _e151; storage_atomic_arr.InterlockedMin(4, 1, _e151); + int _e151; storage_atomic_arr.InterlockedMin(4, int(1), _e151); uint _e155; storage_struct.InterlockedMin(0, 1u, _e155); - int _e160; storage_struct.InterlockedMin(4+4, 1, _e160); + int _e160; storage_struct.InterlockedMin(4+4, int(1), _e160); uint _e163; InterlockedMin(workgroup_atomic_scalar, 1u, _e163); - int _e167; InterlockedMin(workgroup_atomic_arr[1], 1, _e167); + int _e167; InterlockedMin(workgroup_atomic_arr[1], int(1), _e167); uint _e171; InterlockedMin(workgroup_struct.atomic_scalar, 1u, _e171); - int _e176; InterlockedMin(workgroup_struct.atomic_arr[1], 1, _e176); + int _e176; InterlockedMin(workgroup_struct.atomic_arr[1], int(1), _e176); GroupMemoryBarrierWithGroupSync(); uint _e179; storage_atomic_scalar.InterlockedAnd(0, 1u, _e179); - int _e183; storage_atomic_arr.InterlockedAnd(4, 1, _e183); + int _e183; storage_atomic_arr.InterlockedAnd(4, int(1), _e183); uint _e187; storage_struct.InterlockedAnd(0, 1u, _e187); - int _e192; storage_struct.InterlockedAnd(4+4, 1, _e192); + int _e192; storage_struct.InterlockedAnd(4+4, int(1), _e192); uint _e195; InterlockedAnd(workgroup_atomic_scalar, 1u, _e195); - int _e199; InterlockedAnd(workgroup_atomic_arr[1], 1, _e199); + int _e199; InterlockedAnd(workgroup_atomic_arr[1], int(1), _e199); uint _e203; InterlockedAnd(workgroup_struct.atomic_scalar, 1u, _e203); - int _e208; InterlockedAnd(workgroup_struct.atomic_arr[1], 1, _e208); + int _e208; InterlockedAnd(workgroup_struct.atomic_arr[1], int(1), _e208); GroupMemoryBarrierWithGroupSync(); uint _e211; storage_atomic_scalar.InterlockedOr(0, 1u, _e211); - int _e215; storage_atomic_arr.InterlockedOr(4, 1, _e215); + int _e215; storage_atomic_arr.InterlockedOr(4, int(1), _e215); uint _e219; storage_struct.InterlockedOr(0, 1u, _e219); - int _e224; storage_struct.InterlockedOr(4+4, 1, _e224); + int _e224; storage_struct.InterlockedOr(4+4, int(1), _e224); uint _e227; InterlockedOr(workgroup_atomic_scalar, 1u, _e227); - int _e231; InterlockedOr(workgroup_atomic_arr[1], 1, _e231); + int _e231; InterlockedOr(workgroup_atomic_arr[1], int(1), _e231); uint _e235; InterlockedOr(workgroup_struct.atomic_scalar, 1u, _e235); - int _e240; InterlockedOr(workgroup_struct.atomic_arr[1], 1, _e240); + int _e240; InterlockedOr(workgroup_struct.atomic_arr[1], int(1), _e240); GroupMemoryBarrierWithGroupSync(); uint _e243; storage_atomic_scalar.InterlockedXor(0, 1u, _e243); - int _e247; storage_atomic_arr.InterlockedXor(4, 1, _e247); + int _e247; storage_atomic_arr.InterlockedXor(4, int(1), _e247); uint _e251; storage_struct.InterlockedXor(0, 1u, _e251); - int _e256; storage_struct.InterlockedXor(4+4, 1, _e256); + int _e256; storage_struct.InterlockedXor(4+4, int(1), _e256); uint _e259; InterlockedXor(workgroup_atomic_scalar, 1u, _e259); - int _e263; InterlockedXor(workgroup_atomic_arr[1], 1, _e263); + int _e263; InterlockedXor(workgroup_atomic_arr[1], int(1), _e263); uint _e267; InterlockedXor(workgroup_struct.atomic_scalar, 1u, _e267); - int _e272; InterlockedXor(workgroup_struct.atomic_arr[1], 1, _e272); + int _e272; InterlockedXor(workgroup_struct.atomic_arr[1], int(1), _e272); uint _e275; storage_atomic_scalar.InterlockedExchange(0, 1u, _e275); - int _e279; storage_atomic_arr.InterlockedExchange(4, 1, _e279); + int _e279; storage_atomic_arr.InterlockedExchange(4, int(1), _e279); uint _e283; storage_struct.InterlockedExchange(0, 1u, _e283); - int _e288; storage_struct.InterlockedExchange(4+4, 1, _e288); + int _e288; storage_struct.InterlockedExchange(4+4, int(1), _e288); uint _e291; InterlockedExchange(workgroup_atomic_scalar, 1u, _e291); - int _e295; InterlockedExchange(workgroup_atomic_arr[1], 1, _e295); + int _e295; InterlockedExchange(workgroup_atomic_arr[1], int(1), _e295); uint _e299; InterlockedExchange(workgroup_struct.atomic_scalar, 1u, _e299); - int _e304; InterlockedExchange(workgroup_struct.atomic_arr[1], 1, _e304); + int _e304; InterlockedExchange(workgroup_struct.atomic_arr[1], int(1), _e304); return; } diff --git a/naga/tests/out/hlsl/atomicTexture-int64.hlsl b/naga/tests/out/hlsl/atomicTexture-int64.hlsl index 056489c790..ed9e57dd62 100644 --- a/naga/tests/out/hlsl/atomicTexture-int64.hlsl +++ b/naga/tests/out/hlsl/atomicTexture-int64.hlsl @@ -10,8 +10,8 @@ RWTexture2D image : register(u0); [numthreads(2, 1, 1)] void cs_main(uint3 id : SV_GroupThreadID) { - InterlockedMax(image[int2(0, 0)],1uL); + InterlockedMax(image[int2(int(0), int(0))],1uL); GroupMemoryBarrierWithGroupSync(); - InterlockedMin(image[int2(0, 0)],1uL); + InterlockedMin(image[int2(int(0), int(0))],1uL); return; } diff --git a/naga/tests/out/hlsl/atomicTexture.hlsl b/naga/tests/out/hlsl/atomicTexture.hlsl index 241cdab678..d598be925d 100644 --- a/naga/tests/out/hlsl/atomicTexture.hlsl +++ b/naga/tests/out/hlsl/atomicTexture.hlsl @@ -11,17 +11,17 @@ RWTexture2D image_s : register(u1); [numthreads(2, 1, 1)] void cs_main(uint3 id : SV_GroupThreadID) { - InterlockedMax(image_u[int2(0, 0)],1u); - InterlockedMin(image_u[int2(0, 0)],1u); - InterlockedAdd(image_u[int2(0, 0)],1u); - InterlockedAnd(image_u[int2(0, 0)],1u); - InterlockedOr(image_u[int2(0, 0)],1u); - InterlockedXor(image_u[int2(0, 0)],1u); - InterlockedMax(image_s[int2(0, 0)],1); - InterlockedMin(image_s[int2(0, 0)],1); - InterlockedAdd(image_s[int2(0, 0)],1); - InterlockedAnd(image_s[int2(0, 0)],1); - InterlockedOr(image_s[int2(0, 0)],1); - InterlockedXor(image_s[int2(0, 0)],1); + InterlockedMax(image_u[int2(int(0), int(0))],1u); + InterlockedMin(image_u[int2(int(0), int(0))],1u); + InterlockedAdd(image_u[int2(int(0), int(0))],1u); + InterlockedAnd(image_u[int2(int(0), int(0))],1u); + InterlockedOr(image_u[int2(int(0), int(0))],1u); + InterlockedXor(image_u[int2(int(0), int(0))],1u); + InterlockedMax(image_s[int2(int(0), int(0))],int(1)); + InterlockedMin(image_s[int2(int(0), int(0))],int(1)); + InterlockedAdd(image_s[int2(int(0), int(0))],int(1)); + InterlockedAnd(image_s[int2(int(0), int(0))],int(1)); + InterlockedOr(image_s[int2(int(0), int(0))],int(1)); + InterlockedXor(image_s[int2(int(0), int(0))],int(1)); return; } diff --git a/naga/tests/out/hlsl/binding-arrays.hlsl b/naga/tests/out/hlsl/binding-arrays.hlsl index 3f0a533b6c..2f16123199 100644 --- a/naga/tests/out/hlsl/binding-arrays.hlsl +++ b/naga/tests/out/hlsl/binding-arrays.hlsl @@ -62,7 +62,7 @@ float4 main(FragmentInput_main fragmentinput_main) : SV_Target0 uint uniform_index = uni.index; uint non_uniform_index = fragment_in.index; float2 uv = (0.0).xx; - int2 pix = (0).xx; + int2 pix = (int(0)).xx; uint2 _e22 = u2_; u2_ = (_e22 + NagaDimensions2D(texture_array_unbounded[0])); uint2 _e27 = u2_; @@ -87,13 +87,13 @@ float4 main(FragmentInput_main fragmentinput_main) : SV_Target0 float4 _e76 = texture_array_depth[NonUniformResourceIndex(non_uniform_index)].GatherCmp(nagaComparisonSamplerHeap[NonUniformResourceIndex(nagaGroup0SamplerIndexArray[samp_comp + non_uniform_index])], uv, 0.0); float4 _e77 = v4_; v4_ = (_e77 + _e76); - float4 _e82 = texture_array_unbounded[0].Load(int3(pix, 0)); + float4 _e82 = texture_array_unbounded[0].Load(int3(pix, int(0))); float4 _e83 = v4_; v4_ = (_e83 + _e82); - float4 _e88 = texture_array_unbounded[uniform_index].Load(int3(pix, 0)); + float4 _e88 = texture_array_unbounded[uniform_index].Load(int3(pix, int(0))); float4 _e89 = v4_; v4_ = (_e89 + _e88); - float4 _e94 = texture_array_unbounded[NonUniformResourceIndex(non_uniform_index)].Load(int3(pix, 0)); + float4 _e94 = texture_array_unbounded[NonUniformResourceIndex(non_uniform_index)].Load(int3(pix, int(0))); float4 _e95 = v4_; v4_ = (_e95 + _e94); uint _e100 = u1_; diff --git a/naga/tests/out/hlsl/bitcast.hlsl b/naga/tests/out/hlsl/bitcast.hlsl index b21408dda5..420f39dd94 100644 --- a/naga/tests/out/hlsl/bitcast.hlsl +++ b/naga/tests/out/hlsl/bitcast.hlsl @@ -1,9 +1,9 @@ [numthreads(1, 1, 1)] void main() { - int2 i2_ = (0).xx; - int3 i3_ = (0).xxx; - int4 i4_ = (0).xxxx; + int2 i2_ = (int(0)).xx; + int3 i3_ = (int(0)).xxx; + int4 i4_ = (int(0)).xxxx; uint2 u2_ = (0u).xx; uint3 u3_ = (0u).xxx; uint4 u4_ = (0u).xxxx; diff --git a/naga/tests/out/hlsl/bits.hlsl b/naga/tests/out/hlsl/bits.hlsl index 1987e15514..f75cba90b6 100644 --- a/naga/tests/out/hlsl/bits.hlsl +++ b/naga/tests/out/hlsl/bits.hlsl @@ -177,10 +177,10 @@ uint4 naga_extractBits( [numthreads(1, 1, 1)] void main() { - int i = 0; - int2 i2_ = (0).xx; - int3 i3_ = (0).xxx; - int4 i4_ = (0).xxxx; + int i = int(0); + int2 i2_ = (int(0)).xx; + int3 i3_ = (int(0)).xxx; + int4 i4_ = (int(0)).xxxx; uint u = 0u; uint2 u2_ = (0u).xx; uint3 u3_ = (0u).xxx; diff --git a/naga/tests/out/hlsl/boids.hlsl b/naga/tests/out/hlsl/boids.hlsl index 8934a9bca2..b6bc4ed79e 100644 --- a/naga/tests/out/hlsl/boids.hlsl +++ b/naga/tests/out/hlsl/boids.hlsl @@ -27,8 +27,8 @@ void main(uint3 global_invocation_id : SV_DispatchThreadID) float2 cMass = float2(0.0, 0.0); float2 cVel = float2(0.0, 0.0); float2 colVel = float2(0.0, 0.0); - int cMassCount = 0; - int cVelCount = 0; + int cMassCount = int(0); + int cVelCount = int(0); float2 pos = (float2)0; float2 vel = (float2)0; uint i = 0u; @@ -73,7 +73,7 @@ void main(uint3 global_invocation_id : SV_DispatchThreadID) float2 _e61 = pos; cMass = (_e60 + _e61); int _e63 = cMassCount; - cMassCount = (_e63 + 1); + cMassCount = (_e63 + int(1)); } float2 _e66 = pos; float2 _e67 = vPos; @@ -92,18 +92,18 @@ void main(uint3 global_invocation_id : SV_DispatchThreadID) float2 _e86 = vel; cVel = (_e85 + _e86); int _e88 = cVelCount; - cVelCount = (_e88 + 1); + cVelCount = (_e88 + int(1)); } } int _e94 = cMassCount; - if ((_e94 > 0)) { + if ((_e94 > int(0))) { float2 _e97 = cMass; int _e98 = cMassCount; float2 _e102 = vPos; cMass = ((_e97 / (float(_e98)).xx) - _e102); } int _e104 = cVelCount; - if ((_e104 > 0)) { + if ((_e104 > int(0))) { float2 _e107 = cVel; int _e108 = cVelCount; cVel = (_e107 / (float(_e108)).xx); diff --git a/naga/tests/out/hlsl/const-exprs.hlsl b/naga/tests/out/hlsl/const-exprs.hlsl index 9d62504f78..ab2160cb19 100644 --- a/naga/tests/out/hlsl/const-exprs.hlsl +++ b/naga/tests/out/hlsl/const-exprs.hlsl @@ -1,45 +1,45 @@ static const uint TWO = 2u; -static const int THREE = 3; -static const int FOUR = 4; -static const int FOUR_ALIAS = 4; -static const int TEST_CONSTANT_ADDITION = 8; -static const int TEST_CONSTANT_ALIAS_ADDITION = 8; +static const int THREE = int(3); +static const int FOUR = int(4); +static const int FOUR_ALIAS = int(4); +static const int TEST_CONSTANT_ADDITION = int(8); +static const int TEST_CONSTANT_ALIAS_ADDITION = int(8); static const float PI = 3.141; static const float phi_sun = 6.282; static const float4 DIV = float4(0.44444445, 0.0, 0.0, 0.0); -static const int TEXTURE_KIND_REGULAR = 0; -static const int TEXTURE_KIND_WARP = 1; -static const int TEXTURE_KIND_SKY = 2; +static const int TEXTURE_KIND_REGULAR = int(0); +static const int TEXTURE_KIND_WARP = int(1); +static const int TEXTURE_KIND_SKY = int(2); static const float2 add_vec = float2(4.0, 5.0); static const bool2 compare_vec = bool2(true, false); void swizzle_of_compose() { - int4 out_ = int4(4, 3, 2, 1); + int4 out_ = int4(int(4), int(3), int(2), int(1)); return; } void index_of_compose() { - int out_1 = 2; + int out_1 = int(2); return; } void compose_three_deep() { - int out_2 = 6; + int out_2 = int(6); return; } void non_constant_initializers() { - int w = 30; + int w = int(30); int x = (int)0; int y = (int)0; - int z = 70; + int z = int(70); int4 out_3 = (int4)0; int _e2 = w; @@ -56,14 +56,14 @@ void non_constant_initializers() void splat_of_constant() { - int4 out_4 = int4(-4, -4, -4, -4); + int4 out_4 = int4(int(-4), int(-4), int(-4), int(-4)); return; } void compose_of_constant() { - int4 out_5 = int4(-4, -4, -4, -4); + int4 out_5 = int4(int(-4), int(-4), int(-4), int(-4)); return; } @@ -95,9 +95,9 @@ uint map_texture_kind(int texture_kind) void compose_vector_zero_val_binop() { - int3 a = int3(1, 1, 1); - int3 b = int3(0, 1, 2); - int3 c = int3(1, 0, 2); + int3 a = int3(int(1), int(1), int(1)); + int3 b = int3(int(0), int(1), int(2)); + int3 c = int3(int(1), int(0), int(2)); return; } diff --git a/naga/tests/out/hlsl/constructors.hlsl b/naga/tests/out/hlsl/constructors.hlsl index c354737114..5cc3702630 100644 --- a/naga/tests/out/hlsl/constructors.hlsl +++ b/naga/tests/out/hlsl/constructors.hlsl @@ -62,7 +62,7 @@ static const uint2 cz4_ = ZeroValueuint2(); static const float2x2 cz5_ = ZeroValuefloat2x2(); static const Foo cz6_[3] = ZeroValuearray3_Foo_(); static const Foo cz7_ = ZeroValueFoo(); -static const int cp3_[4] = Constructarray4_int_(0, 1, 2, 3); +static const int cp3_[4] = Constructarray4_int_(int(0), int(1), int(2), int(3)); Foo ConstructFoo(float4 arg0, int arg1) { Foo ret = (Foo)0; @@ -80,12 +80,12 @@ void main() { Foo foo = (Foo)0; - foo = ConstructFoo((1.0).xxxx, 1); + foo = ConstructFoo((1.0).xxxx, int(1)); float2x2 m0_ = float2x2(float2(1.0, 0.0), float2(0.0, 1.0)); float4x4 m1_ = float4x4(float4(1.0, 0.0, 0.0, 0.0), float4(0.0, 1.0, 0.0, 0.0), float4(0.0, 0.0, 1.0, 0.0), float4(0.0, 0.0, 0.0, 1.0)); uint2 cit0_ = (0u).xx; float2x2 cit1_ = float2x2((0.0).xx, (0.0).xx); - int cit2_[4] = Constructarray4_int_(0, 1, 2, 3); + int cit2_[4] = Constructarray4_int_(int(0), int(1), int(2), int(3)); uint2 ic4_ = uint2(0u, 0u); float2x3 ic5_ = float2x3(float3(0.0, 0.0, 0.0), float3(0.0, 0.0, 0.0)); return; diff --git a/naga/tests/out/hlsl/control-flow.hlsl b/naga/tests/out/hlsl/control-flow.hlsl index 7a8cb73779..ad36cc6201 100644 --- a/naga/tests/out/hlsl/control-flow.hlsl +++ b/naga/tests/out/hlsl/control-flow.hlsl @@ -7,7 +7,7 @@ void switch_default_break(int i) void switch_case_break() { - switch(0) { + switch(int(0)) { case 0: { break; } @@ -125,7 +125,7 @@ void loop_switch_continue_nesting(int x_1, int y, int z) void loop_switch_omit_continue_variable_checks(int x_2, int y_1, int z_1, int w) { - int pos_1 = 0; + int pos_1 = int(0); uint2 loop_bound_4 = uint2(0u, 0u); while(true) { @@ -134,7 +134,7 @@ void loop_switch_omit_continue_variable_checks(int x_2, int y_1, int z_1, int w) bool should_continue_5 = false; switch(x_2) { case 1: { - pos_1 = 1; + pos_1 = int(1); break; } default: { @@ -160,7 +160,7 @@ void loop_switch_omit_continue_variable_checks(int x_2, int y_1, int z_1, int w) default: { switch(z_1) { case 1: { - pos_1 = 2; + pos_1 = int(2); break; } default: { @@ -194,30 +194,30 @@ void main(uint3 global_id : SV_DispatchThreadID) DeviceMemoryBarrierWithGroupSync(); GroupMemoryBarrierWithGroupSync(); do { - pos = 1; + pos = int(1); } while(false); int _e4 = pos; switch(_e4) { case 1: { - pos = 0; + pos = int(0); break; } case 2: { - pos = 1; + pos = int(1); break; } case 3: case 4: { - pos = 2; + pos = int(2); break; } case 5: { - pos = 3; + pos = int(3); break; } default: case 6: { - pos = 4; + pos = int(4); break; } } @@ -232,22 +232,22 @@ void main(uint3 global_id : SV_DispatchThreadID) int _e11 = pos; switch(_e11) { case 1: { - pos = 0; + pos = int(0); break; } case 2: { - pos = 1; + pos = int(1); return; } case 3: { - pos = 2; + pos = int(2); return; } case 4: { return; } default: { - pos = 3; + pos = int(3); return; } } diff --git a/naga/tests/out/hlsl/empty-global-name.hlsl b/naga/tests/out/hlsl/empty-global-name.hlsl index 64227b0bc7..1d7208ee90 100644 --- a/naga/tests/out/hlsl/empty-global-name.hlsl +++ b/naga/tests/out/hlsl/empty-global-name.hlsl @@ -7,7 +7,7 @@ RWByteAddressBuffer unnamed : register(u0); void function() { int _e3 = asint(unnamed.Load(0)); - unnamed.Store(0, asuint((_e3 + 1))); + unnamed.Store(0, asuint((_e3 + int(1)))); return; } diff --git a/naga/tests/out/hlsl/fetch_depth.hlsl b/naga/tests/out/hlsl/fetch_depth.hlsl index 04a1f51353..71788135f1 100644 --- a/naga/tests/out/hlsl/fetch_depth.hlsl +++ b/naga/tests/out/hlsl/fetch_depth.hlsl @@ -13,7 +13,7 @@ Texture2D global_2 : register(t2); void function() { uint2 _e6 = asuint(global_1.Load2(0)); - float _e7 = global_2.Load(int3(_e6, 0)).x; + float _e7 = global_2.Load(int3(_e6, int(0))).x; global.Store(0, asuint((_e7).xxxx.x)); return; } diff --git a/naga/tests/out/hlsl/fragment-output.hlsl b/naga/tests/out/hlsl/fragment-output.hlsl index f1f0a82ae8..bc11c8518e 100644 --- a/naga/tests/out/hlsl/fragment-output.hlsl +++ b/naga/tests/out/hlsl/fragment-output.hlsl @@ -21,10 +21,10 @@ FragmentOutputVec4Vec3_ main_vec4vec3_() FragmentOutputVec4Vec3_ output = (FragmentOutputVec4Vec3_)0; output.vec4f = (0.0).xxxx; - output.vec4i = (0).xxxx; + output.vec4i = (int(0)).xxxx; output.vec4u = (0u).xxxx; output.vec3f = (0.0).xxx; - output.vec3i = (0).xxx; + output.vec3i = (int(0)).xxx; output.vec3u = (0u).xxx; FragmentOutputVec4Vec3_ _e19 = output; const FragmentOutputVec4Vec3_ fragmentoutputvec4vec3_ = _e19; @@ -36,10 +36,10 @@ FragmentOutputVec2Scalar main_vec2scalar() FragmentOutputVec2Scalar output_1 = (FragmentOutputVec2Scalar)0; output_1.vec2f = (0.0).xx; - output_1.vec2i = (0).xx; + output_1.vec2i = (int(0)).xx; output_1.vec2u = (0u).xx; output_1.scalarf = 0.0; - output_1.scalari = 0; + output_1.scalari = int(0); output_1.scalaru = 0u; FragmentOutputVec2Scalar _e16 = output_1; const FragmentOutputVec2Scalar fragmentoutputvec2scalar = _e16; diff --git a/naga/tests/out/hlsl/functions.hlsl b/naga/tests/out/hlsl/functions.hlsl index 6d7e210307..c2341fb43a 100644 --- a/naga/tests/out/hlsl/functions.hlsl +++ b/naga/tests/out/hlsl/functions.hlsl @@ -8,13 +8,13 @@ float2 test_fma() int test_integer_dot_product() { - int2 a_2_ = (1).xx; - int2 b_2_ = (1).xx; + int2 a_2_ = (int(1)).xx; + int2 b_2_ = (int(1)).xx; int c_2_ = dot(a_2_, b_2_); uint3 a_3_ = (1u).xxx; uint3 b_3_ = (1u).xxx; uint c_3_ = dot(a_3_, b_3_); - int c_4_ = dot((4).xxxx, (2).xxxx); + int c_4_ = dot((int(4)).xxxx, (int(2)).xxxx); return c_4_; } diff --git a/naga/tests/out/hlsl/globals.hlsl b/naga/tests/out/hlsl/globals.hlsl index d320899b89..af2951a334 100644 --- a/naga/tests/out/hlsl/globals.hlsl +++ b/naga/tests/out/hlsl/globals.hlsl @@ -84,7 +84,7 @@ FooStruct ConstructFooStruct(float3 arg0, float arg1) { void test_msl_packed_vec3_() { - int idx = 1; + int idx = int(1); alignment.Store3(0, asuint((1.0).xxx)); alignment.Store(0+0, asuint(1.0)); diff --git a/naga/tests/out/hlsl/image.hlsl b/naga/tests/out/hlsl/image.hlsl index 30bfd86aeb..57d25f2079 100644 --- a/naga/tests/out/hlsl/image.hlsl +++ b/naga/tests/out/hlsl/image.hlsl @@ -35,18 +35,18 @@ uint2 NagaRWDimensions2D(RWTexture2D tex) void main(uint3 local_id : SV_GroupThreadID) { uint2 dim = NagaRWDimensions2D(image_storage_src); - int2 itc = (int2((dim * local_id.xy)) % int2(10, 20)); + int2 itc = (int2((dim * local_id.xy)) % int2(int(10), int(20))); uint4 value1_ = image_mipmapped_src.Load(int3(itc, int(local_id.z))); uint4 value2_ = image_multisampled_src.Load(itc, int(local_id.z)); uint4 value4_ = image_storage_src.Load(itc); - uint4 value5_ = image_array_src.Load(int4(itc, local_id.z, (int(local_id.z) + 1))); - uint4 value6_ = image_array_src.Load(int4(itc, int(local_id.z), (int(local_id.z) + 1))); + uint4 value5_ = image_array_src.Load(int4(itc, local_id.z, (int(local_id.z) + int(1)))); + uint4 value6_ = image_array_src.Load(int4(itc, int(local_id.z), (int(local_id.z) + int(1)))); uint4 value7_ = image_1d_src.Load(int2(int(local_id.x), int(local_id.z))); uint4 value1u = image_mipmapped_src.Load(int3(uint2(itc), int(local_id.z))); uint4 value2u = image_multisampled_src.Load(uint2(itc), int(local_id.z)); uint4 value4u = image_storage_src.Load(uint2(itc)); - uint4 value5u = image_array_src.Load(int4(uint2(itc), local_id.z, (int(local_id.z) + 1))); - uint4 value6u = image_array_src.Load(int4(uint2(itc), int(local_id.z), (int(local_id.z) + 1))); + uint4 value5u = image_array_src.Load(int4(uint2(itc), local_id.z, (int(local_id.z) + int(1)))); + uint4 value6u = image_array_src.Load(int4(uint2(itc), int(local_id.z), (int(local_id.z) + int(1)))); uint4 value7u = image_1d_src.Load(int2(uint(local_id.x), int(local_id.z))); image_dst[itc.x] = ((((value1_ + value2_) + value4_) + value5_) + value6_); image_dst[uint(itc.x)] = ((((value1u + value2u) + value4u) + value5u) + value6u); @@ -57,7 +57,7 @@ void main(uint3 local_id : SV_GroupThreadID) void depth_load(uint3 local_id_1 : SV_GroupThreadID) { uint2 dim_1 = NagaRWDimensions2D(image_storage_src); - int2 itc_1 = (int2((dim_1 * local_id_1.xy)) % int2(10, 20)); + int2 itc_1 = (int2((dim_1 * local_id_1.xy)) % int2(int(10), int(20))); float val = image_depth_multisampled_src.Load(itc_1, int(local_id_1.z)).x; image_dst[itc_1.x] = (uint(val)).xxxx; return; @@ -159,15 +159,15 @@ float4 queries() : SV_Position uint dim_1d = NagaDimensions1D(image_1d); uint dim_1d_lod = NagaMipDimensions1D(image_1d, int(dim_1d)); uint2 dim_2d = NagaDimensions2D(image_2d); - uint2 dim_2d_lod = NagaMipDimensions2D(image_2d, 1); + uint2 dim_2d_lod = NagaMipDimensions2D(image_2d, int(1)); uint2 dim_2d_array = NagaDimensions2DArray(image_2d_array); - uint2 dim_2d_array_lod = NagaMipDimensions2DArray(image_2d_array, 1); + uint2 dim_2d_array_lod = NagaMipDimensions2DArray(image_2d_array, int(1)); uint2 dim_cube = NagaDimensionsCube(image_cube); - uint2 dim_cube_lod = NagaMipDimensionsCube(image_cube, 1); + uint2 dim_cube_lod = NagaMipDimensionsCube(image_cube, int(1)); uint2 dim_cube_array = NagaDimensionsCubeArray(image_cube_array); - uint2 dim_cube_array_lod = NagaMipDimensionsCubeArray(image_cube_array, 1); + uint2 dim_cube_array_lod = NagaMipDimensionsCubeArray(image_cube_array, int(1)); uint3 dim_3d = NagaDimensions3D(image_3d); - uint3 dim_3d_lod = NagaMipDimensions3D(image_3d, 1); + uint3 dim_3d_lod = NagaMipDimensions3D(image_3d, int(1)); uint2 dim_2s_ms = NagaMSDimensions2D(image_aa); uint sum = ((((((((((dim_1d + dim_2d.y) + dim_2d_lod.y) + dim_2d_array.y) + dim_2d_array_lod.y) + dim_cube.y) + dim_cube_lod.y) + dim_cube_array.y) + dim_cube_array_lod.y) + dim_3d.z) + dim_3d_lod.z); return (float(sum)).xxxx; @@ -256,46 +256,46 @@ float4 texture_sample() : SV_Target0 float4 _e14 = image_2d.Sample(sampler_reg, tc); float4 _e15 = a; a = (_e15 + _e14); - float4 _e19 = image_2d.Sample(sampler_reg, tc, int2(int2(3, 1))); + float4 _e19 = image_2d.Sample(sampler_reg, tc, int2(int2(int(3), int(1)))); float4 _e20 = a; a = (_e20 + _e19); float4 _e24 = image_2d.SampleLevel(sampler_reg, tc, 2.3); float4 _e25 = a; a = (_e25 + _e24); - float4 _e29 = image_2d.SampleLevel(sampler_reg, tc, 2.3, int2(int2(3, 1))); + float4 _e29 = image_2d.SampleLevel(sampler_reg, tc, 2.3, int2(int2(int(3), int(1)))); float4 _e30 = a; a = (_e30 + _e29); - float4 _e35 = image_2d.SampleBias(sampler_reg, tc, 2.0, int2(int2(3, 1))); + float4 _e35 = image_2d.SampleBias(sampler_reg, tc, 2.0, int2(int2(int(3), int(1)))); float4 _e36 = a; a = (_e36 + _e35); float4 _e41 = image_2d_array.Sample(sampler_reg, float3(tc, 0u)); float4 _e42 = a; a = (_e42 + _e41); - float4 _e47 = image_2d_array.Sample(sampler_reg, float3(tc, 0u), int2(int2(3, 1))); + float4 _e47 = image_2d_array.Sample(sampler_reg, float3(tc, 0u), int2(int2(int(3), int(1)))); float4 _e48 = a; a = (_e48 + _e47); float4 _e53 = image_2d_array.SampleLevel(sampler_reg, float3(tc, 0u), 2.3); float4 _e54 = a; a = (_e54 + _e53); - float4 _e59 = image_2d_array.SampleLevel(sampler_reg, float3(tc, 0u), 2.3, int2(int2(3, 1))); + float4 _e59 = image_2d_array.SampleLevel(sampler_reg, float3(tc, 0u), 2.3, int2(int2(int(3), int(1)))); float4 _e60 = a; a = (_e60 + _e59); - float4 _e66 = image_2d_array.SampleBias(sampler_reg, float3(tc, 0u), 2.0, int2(int2(3, 1))); + float4 _e66 = image_2d_array.SampleBias(sampler_reg, float3(tc, 0u), 2.0, int2(int2(int(3), int(1)))); float4 _e67 = a; a = (_e67 + _e66); - float4 _e72 = image_2d_array.Sample(sampler_reg, float3(tc, 0)); + float4 _e72 = image_2d_array.Sample(sampler_reg, float3(tc, int(0))); float4 _e73 = a; a = (_e73 + _e72); - float4 _e78 = image_2d_array.Sample(sampler_reg, float3(tc, 0), int2(int2(3, 1))); + float4 _e78 = image_2d_array.Sample(sampler_reg, float3(tc, int(0)), int2(int2(int(3), int(1)))); float4 _e79 = a; a = (_e79 + _e78); - float4 _e84 = image_2d_array.SampleLevel(sampler_reg, float3(tc, 0), 2.3); + float4 _e84 = image_2d_array.SampleLevel(sampler_reg, float3(tc, int(0)), 2.3); float4 _e85 = a; a = (_e85 + _e84); - float4 _e90 = image_2d_array.SampleLevel(sampler_reg, float3(tc, 0), 2.3, int2(int2(3, 1))); + float4 _e90 = image_2d_array.SampleLevel(sampler_reg, float3(tc, int(0)), 2.3, int2(int2(int(3), int(1)))); float4 _e91 = a; a = (_e91 + _e90); - float4 _e97 = image_2d_array.SampleBias(sampler_reg, float3(tc, 0), 2.0, int2(int2(3, 1))); + float4 _e97 = image_2d_array.SampleBias(sampler_reg, float3(tc, int(0)), 2.0, int2(int2(int(3), int(1)))); float4 _e98 = a; a = (_e98 + _e97); float4 _e103 = image_cube_array.Sample(sampler_reg, float4(tc3_, 0u)); @@ -307,13 +307,13 @@ float4 texture_sample() : SV_Target0 float4 _e116 = image_cube_array.SampleBias(sampler_reg, float4(tc3_, 0u), 2.0); float4 _e117 = a; a = (_e117 + _e116); - float4 _e122 = image_cube_array.Sample(sampler_reg, float4(tc3_, 0)); + float4 _e122 = image_cube_array.Sample(sampler_reg, float4(tc3_, int(0))); float4 _e123 = a; a = (_e123 + _e122); - float4 _e128 = image_cube_array.SampleLevel(sampler_reg, float4(tc3_, 0), 2.3); + float4 _e128 = image_cube_array.SampleLevel(sampler_reg, float4(tc3_, int(0)), 2.3); float4 _e129 = a; a = (_e129 + _e128); - float4 _e135 = image_cube_array.SampleBias(sampler_reg, float4(tc3_, 0), 2.0); + float4 _e135 = image_cube_array.SampleBias(sampler_reg, float4(tc3_, int(0)), 2.0); float4 _e136 = a; a = (_e136 + _e135); float4 _e138 = a; @@ -332,7 +332,7 @@ float texture_sample_comparison() : SV_Target0 float _e14 = image_2d_array_depth.SampleCmp(sampler_cmp, float3(tc_1, 0u), 0.5); float _e15 = a_1; a_1 = (_e15 + _e14); - float _e20 = image_2d_array_depth.SampleCmp(sampler_cmp, float3(tc_1, 0), 0.5); + float _e20 = image_2d_array_depth.SampleCmp(sampler_cmp, float3(tc_1, int(0)), 0.5); float _e21 = a_1; a_1 = (_e21 + _e20); float _e25 = image_cube_depth.SampleCmp(sampler_cmp, tc3_1, 0.5); @@ -344,7 +344,7 @@ float texture_sample_comparison() : SV_Target0 float _e36 = image_2d_array_depth.SampleCmpLevelZero(sampler_cmp, float3(tc_1, 0u), 0.5); float _e37 = a_1; a_1 = (_e37 + _e36); - float _e42 = image_2d_array_depth.SampleCmpLevelZero(sampler_cmp, float3(tc_1, 0), 0.5); + float _e42 = image_2d_array_depth.SampleCmpLevelZero(sampler_cmp, float3(tc_1, int(0)), 0.5); float _e43 = a_1; a_1 = (_e43 + _e42); float _e47 = image_cube_depth.SampleCmpLevelZero(sampler_cmp, tc3_1, 0.5); @@ -358,9 +358,9 @@ float4 gather() : SV_Target0 { float2 tc_2 = (0.5).xx; float4 s2d = image_2d.GatherGreen(sampler_reg, tc_2); - float4 s2d_offset = image_2d.GatherAlpha(sampler_reg, tc_2, int2(int2(3, 1))); + float4 s2d_offset = image_2d.GatherAlpha(sampler_reg, tc_2, int2(int2(int(3), int(1)))); float4 s2d_depth = image_2d_depth.GatherCmp(sampler_cmp, tc_2, 0.5); - float4 s2d_depth_offset = image_2d_depth.GatherCmp(sampler_cmp, tc_2, 0.5, int2(int2(3, 1))); + float4 s2d_depth_offset = image_2d_depth.GatherCmp(sampler_cmp, tc_2, 0.5, int2(int2(int(3), int(1)))); uint4 u = image_2d_u32_.Gather(sampler_reg, tc_2); int4 i = image_2d_i32_.Gather(sampler_reg, tc_2); float4 f = (float4(u) + float4(i)); @@ -372,6 +372,6 @@ float4 depth_no_comparison() : SV_Target0 float2 tc_3 = (0.5).xx; float s2d_1 = image_2d_depth.Sample(sampler_reg, tc_3); float4 s2d_gather = image_2d_depth.Gather(sampler_reg, tc_3); - float s2d_level = image_2d_depth.SampleLevel(sampler_reg, tc_3, 1); + float s2d_level = image_2d_depth.SampleLevel(sampler_reg, tc_3, int(1)); return (((s2d_1).xxxx + s2d_gather) + (s2d_level).xxxx); } diff --git a/naga/tests/out/hlsl/math-functions.hlsl b/naga/tests/out/hlsl/math-functions.hlsl index b8ace15b3c..b31d804a7b 100644 --- a/naga/tests/out/hlsl/math-functions.hlsl +++ b/naga/tests/out/hlsl/math-functions.hlsl @@ -76,21 +76,21 @@ void main() float4 d = radians(v); float4 e = saturate(v); float4 g = refract(v, v, 1.0); - int4 sign_b = int4(-1, -1, -1, -1); + int4 sign_b = int4(int(-1), int(-1), int(-1), int(-1)); float4 sign_d = float4(-1.0, -1.0, -1.0, -1.0); int const_dot = dot(ZeroValueint2(), ZeroValueint2()); - int2 flb_b = int2(-1, -1); + int2 flb_b = int2(int(-1), int(-1)); uint2 flb_c = uint2(0u, 0u); - int2 ftb_c = int2(0, 0); + int2 ftb_c = int2(int(0), int(0)); uint2 ftb_d = uint2(0u, 0u); uint2 ctz_e = uint2(32u, 32u); - int2 ctz_f = int2(32, 32); + int2 ctz_f = int2(int(32), int(32)); uint2 ctz_g = uint2(0u, 0u); - int2 ctz_h = int2(0, 0); - int2 clz_c = int2(0, 0); + int2 ctz_h = int2(int(0), int(0)); + int2 clz_c = int2(int(0), int(0)); uint2 clz_d = uint2(31u, 31u); - float lde_a = ldexp(1.0, 2); - float2 lde_b = ldexp(float2(1.0, 2.0), int2(3, 4)); + float lde_a = ldexp(1.0, int(2)); + float2 lde_b = ldexp(float2(1.0, 2.0), int2(int(3), int(4))); _modf_result_f32_ modf_a = naga_modf(1.5); float modf_b = naga_modf(1.5).fract; float modf_c = naga_modf(1.5).whole; diff --git a/naga/tests/out/hlsl/operators.hlsl b/naga/tests/out/hlsl/operators.hlsl index 338ecabb0f..55562830a2 100644 --- a/naga/tests/out/hlsl/operators.hlsl +++ b/naga/tests/out/hlsl/operators.hlsl @@ -1,25 +1,25 @@ static const float4 v_f32_one = float4(1.0, 1.0, 1.0, 1.0); static const float4 v_f32_zero = float4(0.0, 0.0, 0.0, 0.0); static const float4 v_f32_half = float4(0.5, 0.5, 0.5, 0.5); -static const int4 v_i32_one = int4(1, 1, 1, 1); +static const int4 v_i32_one = int4(int(1), int(1), int(1), int(1)); float4 builtins() { - int s1_ = (true ? 1 : 0); + int s1_ = (true ? int(1) : int(0)); float4 s2_ = (true ? v_f32_one : v_f32_zero); float4 s3_ = (bool4(false, false, false, false) ? v_f32_zero : v_f32_one); float4 m1_ = lerp(v_f32_zero, v_f32_one, v_f32_half); float4 m2_ = lerp(v_f32_zero, v_f32_one, 0.1); - float b1_ = asfloat(1); + float b1_ = asfloat(int(1)); float4 b2_ = asfloat(v_i32_one); - int4 v_i32_zero = int4(0, 0, 0, 0); + int4 v_i32_zero = int4(int(0), int(0), int(0), int(0)); return (((((float4(((s1_).xxxx + v_i32_zero)) + s2_) + m1_) + m2_) + (b1_).xxxx) + b2_); } float4 splat(float m, int n) { float2 a_2 = ((((2.0).xx + (m).xx) - (4.0).xx) / (8.0).xx); - int4 b = ((n).xxxx % (2).xxxx); + int4 b = ((n).xxxx % (int(2)).xxxx); return (a_2.xyxy + float4(b)); } @@ -71,65 +71,65 @@ float3x4 ZeroValuefloat3x4() { void arithmetic() { float neg0_1 = -(1.0); - int2 neg1_1 = -((1).xx); + int2 neg1_1 = -((int(1)).xx); float2 neg2_ = -((1.0).xx); - int add0_ = (2 + 1); + int add0_ = (int(2) + int(1)); uint add1_ = (2u + 1u); float add2_ = (2.0 + 1.0); - int2 add3_ = ((2).xx + (1).xx); + int2 add3_ = ((int(2)).xx + (int(1)).xx); uint3 add4_ = ((2u).xxx + (1u).xxx); float4 add5_ = ((2.0).xxxx + (1.0).xxxx); - int sub0_ = (2 - 1); + int sub0_ = (int(2) - int(1)); uint sub1_ = (2u - 1u); float sub2_ = (2.0 - 1.0); - int2 sub3_ = ((2).xx - (1).xx); + int2 sub3_ = ((int(2)).xx - (int(1)).xx); uint3 sub4_ = ((2u).xxx - (1u).xxx); float4 sub5_ = ((2.0).xxxx - (1.0).xxxx); - int mul0_ = (2 * 1); + int mul0_ = (int(2) * int(1)); uint mul1_ = (2u * 1u); float mul2_ = (2.0 * 1.0); - int2 mul3_ = ((2).xx * (1).xx); + int2 mul3_ = ((int(2)).xx * (int(1)).xx); uint3 mul4_ = ((2u).xxx * (1u).xxx); float4 mul5_ = ((2.0).xxxx * (1.0).xxxx); - int div0_ = (2 / 1); + int div0_ = (int(2) / int(1)); uint div1_ = (2u / 1u); float div2_ = (2.0 / 1.0); - int2 div3_ = ((2).xx / (1).xx); + int2 div3_ = ((int(2)).xx / (int(1)).xx); uint3 div4_ = ((2u).xxx / (1u).xxx); float4 div5_ = ((2.0).xxxx / (1.0).xxxx); - int rem0_ = (2 % 1); + int rem0_ = (int(2) % int(1)); uint rem1_ = (2u % 1u); float rem2_ = fmod(2.0, 1.0); - int2 rem3_ = ((2).xx % (1).xx); + int2 rem3_ = ((int(2)).xx % (int(1)).xx); uint3 rem4_ = ((2u).xxx % (1u).xxx); float4 rem5_ = fmod((2.0).xxxx, (1.0).xxxx); { - int2 add0_1 = ((2).xx + (1).xx); - int2 add1_1 = ((2).xx + (1).xx); + int2 add0_1 = ((int(2)).xx + (int(1)).xx); + int2 add1_1 = ((int(2)).xx + (int(1)).xx); uint2 add2_1 = ((2u).xx + (1u).xx); uint2 add3_1 = ((2u).xx + (1u).xx); float2 add4_1 = ((2.0).xx + (1.0).xx); float2 add5_1 = ((2.0).xx + (1.0).xx); - int2 sub0_1 = ((2).xx - (1).xx); - int2 sub1_1 = ((2).xx - (1).xx); + int2 sub0_1 = ((int(2)).xx - (int(1)).xx); + int2 sub1_1 = ((int(2)).xx - (int(1)).xx); uint2 sub2_1 = ((2u).xx - (1u).xx); uint2 sub3_1 = ((2u).xx - (1u).xx); float2 sub4_1 = ((2.0).xx - (1.0).xx); float2 sub5_1 = ((2.0).xx - (1.0).xx); - int2 mul0_1 = ((2).xx * 1); - int2 mul1_1 = (2 * (1).xx); + int2 mul0_1 = ((int(2)).xx * int(1)); + int2 mul1_1 = (int(2) * (int(1)).xx); uint2 mul2_1 = ((2u).xx * 1u); uint2 mul3_1 = (2u * (1u).xx); float2 mul4_1 = ((2.0).xx * 1.0); float2 mul5_1 = (2.0 * (1.0).xx); - int2 div0_1 = ((2).xx / (1).xx); - int2 div1_1 = ((2).xx / (1).xx); + int2 div0_1 = ((int(2)).xx / (int(1)).xx); + int2 div1_1 = ((int(2)).xx / (int(1)).xx); uint2 div2_1 = ((2u).xx / (1u).xx); uint2 div3_1 = ((2u).xx / (1u).xx); float2 div4_1 = ((2.0).xx / (1.0).xx); float2 div5_1 = ((2.0).xx / (1.0).xx); - int2 rem0_1 = ((2).xx % (1).xx); - int2 rem1_1 = ((2).xx % (1).xx); + int2 rem0_1 = ((int(2)).xx % (int(1)).xx); + int2 rem1_1 = ((int(2)).xx % (int(1)).xx); uint2 rem2_1 = ((2u).xx % (1u).xx); uint2 rem3_1 = ((2u).xx % (1u).xx); float2 rem4_1 = fmod((2.0).xx, (1.0).xx); @@ -147,69 +147,69 @@ void arithmetic() void bit() { - int flip0_ = ~(1); + int flip0_ = ~(int(1)); uint flip1_ = ~(1u); - int2 flip2_ = ~((1).xx); + int2 flip2_ = ~((int(1)).xx); uint3 flip3_ = ~((1u).xxx); - int or0_ = (2 | 1); + int or0_ = (int(2) | int(1)); uint or1_ = (2u | 1u); - int2 or2_ = ((2).xx | (1).xx); + int2 or2_ = ((int(2)).xx | (int(1)).xx); uint3 or3_ = ((2u).xxx | (1u).xxx); - int and0_ = (2 & 1); + int and0_ = (int(2) & int(1)); uint and1_ = (2u & 1u); - int2 and2_ = ((2).xx & (1).xx); + int2 and2_ = ((int(2)).xx & (int(1)).xx); uint3 and3_ = ((2u).xxx & (1u).xxx); - int xor0_ = (2 ^ 1); + int xor0_ = (int(2) ^ int(1)); uint xor1_ = (2u ^ 1u); - int2 xor2_ = ((2).xx ^ (1).xx); + int2 xor2_ = ((int(2)).xx ^ (int(1)).xx); uint3 xor3_ = ((2u).xxx ^ (1u).xxx); - int shl0_ = (2 << 1u); + int shl0_ = (int(2) << 1u); uint shl1_ = (2u << 1u); - int2 shl2_ = ((2).xx << (1u).xx); + int2 shl2_ = ((int(2)).xx << (1u).xx); uint3 shl3_ = ((2u).xxx << (1u).xxx); - int shr0_ = (2 >> 1u); + int shr0_ = (int(2) >> 1u); uint shr1_ = (2u >> 1u); - int2 shr2_ = ((2).xx >> (1u).xx); + int2 shr2_ = ((int(2)).xx >> (1u).xx); uint3 shr3_ = ((2u).xxx >> (1u).xxx); return; } void comparison() { - bool eq0_ = (2 == 1); + bool eq0_ = (int(2) == int(1)); bool eq1_ = (2u == 1u); bool eq2_ = (2.0 == 1.0); - bool2 eq3_ = ((2).xx == (1).xx); + bool2 eq3_ = ((int(2)).xx == (int(1)).xx); bool3 eq4_ = ((2u).xxx == (1u).xxx); bool4 eq5_ = ((2.0).xxxx == (1.0).xxxx); - bool neq0_ = (2 != 1); + bool neq0_ = (int(2) != int(1)); bool neq1_ = (2u != 1u); bool neq2_ = (2.0 != 1.0); - bool2 neq3_ = ((2).xx != (1).xx); + bool2 neq3_ = ((int(2)).xx != (int(1)).xx); bool3 neq4_ = ((2u).xxx != (1u).xxx); bool4 neq5_ = ((2.0).xxxx != (1.0).xxxx); - bool lt0_ = (2 < 1); + bool lt0_ = (int(2) < int(1)); bool lt1_ = (2u < 1u); bool lt2_ = (2.0 < 1.0); - bool2 lt3_ = ((2).xx < (1).xx); + bool2 lt3_ = ((int(2)).xx < (int(1)).xx); bool3 lt4_ = ((2u).xxx < (1u).xxx); bool4 lt5_ = ((2.0).xxxx < (1.0).xxxx); - bool lte0_ = (2 <= 1); + bool lte0_ = (int(2) <= int(1)); bool lte1_ = (2u <= 1u); bool lte2_ = (2.0 <= 1.0); - bool2 lte3_ = ((2).xx <= (1).xx); + bool2 lte3_ = ((int(2)).xx <= (int(1)).xx); bool3 lte4_ = ((2u).xxx <= (1u).xxx); bool4 lte5_ = ((2.0).xxxx <= (1.0).xxxx); - bool gt0_ = (2 > 1); + bool gt0_ = (int(2) > int(1)); bool gt1_ = (2u > 1u); bool gt2_ = (2.0 > 1.0); - bool2 gt3_ = ((2).xx > (1).xx); + bool2 gt3_ = ((int(2)).xx > (int(1)).xx); bool3 gt4_ = ((2u).xxx > (1u).xxx); bool4 gt5_ = ((2.0).xxxx > (1.0).xxxx); - bool gte0_ = (2 >= 1); + bool gte0_ = (int(2) >= int(1)); bool gte1_ = (2u >= 1u); bool gte2_ = (2.0 >= 1.0); - bool2 gte3_ = ((2).xx >= (1).xx); + bool2 gte3_ = ((int(2)).xx >= (int(1)).xx); bool3 gte4_ = ((2u).xxx >= (1u).xxx); bool4 gte5_ = ((2.0).xxxx >= (1.0).xxxx); return; @@ -224,11 +224,11 @@ void assignment() int a_1 = (int)0; int3 vec0_ = ZeroValueint3(); - a_1 = 1; + a_1 = int(1); int _e5 = a_1; - a_1 = (_e5 + 1); + a_1 = (_e5 + int(1)); int _e7 = a_1; - a_1 = (_e7 - 1); + a_1 = (_e7 - int(1)); int _e9 = a_1; int _e10 = a_1; a_1 = (_e10 * _e9); @@ -236,38 +236,38 @@ void assignment() int _e13 = a_1; a_1 = (_e13 / _e12); int _e15 = a_1; - a_1 = (_e15 % 1); + a_1 = (_e15 % int(1)); int _e17 = a_1; - a_1 = (_e17 & 0); + a_1 = (_e17 & int(0)); int _e19 = a_1; - a_1 = (_e19 | 0); + a_1 = (_e19 | int(0)); int _e21 = a_1; - a_1 = (_e21 ^ 0); + a_1 = (_e21 ^ int(0)); int _e23 = a_1; a_1 = (_e23 << 2u); int _e25 = a_1; a_1 = (_e25 >> 1u); int _e28 = a_1; - a_1 = (_e28 + 1); + a_1 = (_e28 + int(1)); int _e31 = a_1; - a_1 = (_e31 - 1); - int _e37 = vec0_[1]; - vec0_[1] = (_e37 + 1); - int _e41 = vec0_[1]; - vec0_[1] = (_e41 - 1); + a_1 = (_e31 - int(1)); + int _e37 = vec0_[int(1)]; + vec0_[int(1)] = (_e37 + int(1)); + int _e41 = vec0_[int(1)]; + vec0_[int(1)] = (_e41 - int(1)); return; } void negation_avoids_prefix_decrement() { - int i0_ = -(1); - int i1_ = -(-(1)); - int i2_ = -(-(1)); - int i3_ = -(-(1)); - int i4_ = -(-(-(1))); - int i5_ = -(-(-(-(1)))); - int i6_ = -(-(-(-(-(1))))); - int i7_ = -(-(-(-(-(1))))); + int i0_ = -(int(1)); + int i1_ = -(-(int(1))); + int i2_ = -(-(int(1))); + int i3_ = -(-(int(1))); + int i4_ = -(-(-(int(1)))); + int i5_ = -(-(-(-(int(1))))); + int i6_ = -(-(-(-(-(int(1)))))); + int i7_ = -(-(-(-(-(int(1)))))); float f0_ = -(1.0); float f1_ = -(-(1.0)); float f2_ = -(-(1.0)); diff --git a/naga/tests/out/hlsl/phony_assignment.hlsl b/naga/tests/out/hlsl/phony_assignment.hlsl index dbe587e5c8..02348c87df 100644 --- a/naga/tests/out/hlsl/phony_assignment.hlsl +++ b/naga/tests/out/hlsl/phony_assignment.hlsl @@ -2,7 +2,7 @@ cbuffer binding : register(b0) { float binding; } int five() { - return 5; + return int(5); } [numthreads(1, 1, 1)] diff --git a/naga/tests/out/hlsl/skybox.hlsl b/naga/tests/out/hlsl/skybox.hlsl index f1d77c3c50..31d29581a2 100644 --- a/naga/tests/out/hlsl/skybox.hlsl +++ b/naga/tests/out/hlsl/skybox.hlsl @@ -44,8 +44,8 @@ VertexOutput_vs_main vs_main(uint vertex_index : SV_VertexID) int tmp1_ = (int)0; int tmp2_ = (int)0; - tmp1_ = (int((_NagaConstants.first_vertex + vertex_index)) / 2); - tmp2_ = (int((_NagaConstants.first_vertex + vertex_index)) & 1); + tmp1_ = (int((_NagaConstants.first_vertex + vertex_index)) / int(2)); + tmp2_ = (int((_NagaConstants.first_vertex + vertex_index)) & int(1)); int _e9 = tmp1_; int _e15 = tmp2_; float4 pos = float4(((float(_e9) * 4.0) - 1.0), ((float(_e15) * 4.0) - 1.0), 0.0, 1.0); diff --git a/naga/tests/out/hlsl/unnamed-gl-per-vertex.hlsl b/naga/tests/out/hlsl/unnamed-gl-per-vertex.hlsl index 6564f71f72..9b2ac0864e 100644 --- a/naga/tests/out/hlsl/unnamed-gl-per-vertex.hlsl +++ b/naga/tests/out/hlsl/unnamed-gl-per-vertex.hlsl @@ -26,7 +26,7 @@ static int global_1 = (int)0; void function() { int _e9 = global_1; - global.member = float4(((_e9 == 0) ? -4.0 : 1.0), ((_e9 == 2) ? 4.0 : -1.0), 0.0, 1.0); + global.member = float4(((_e9 == int(0)) ? -4.0 : 1.0), ((_e9 == int(2)) ? 4.0 : -1.0), 0.0, 1.0); return; } diff --git a/naga/tests/out/hlsl/workgroup-uniform-load.hlsl b/naga/tests/out/hlsl/workgroup-uniform-load.hlsl index a8dba16b9a..0bfb55cb6c 100644 --- a/naga/tests/out/hlsl/workgroup-uniform-load.hlsl +++ b/naga/tests/out/hlsl/workgroup-uniform-load.hlsl @@ -12,7 +12,7 @@ void test_workgroupUniformLoad(uint3 workgroup_id : SV_GroupID, uint3 __local_in GroupMemoryBarrierWithGroupSync(); int _e4 = arr_i32_[min(uint(workgroup_id.x), 127u)]; GroupMemoryBarrierWithGroupSync(); - if ((_e4 > 10)) { + if ((_e4 > int(10))) { GroupMemoryBarrierWithGroupSync(); return; } else {