diff --git a/docs/origin-trial-changes.md b/docs/origin-trial-changes.md index d6400b2df3..e9aa186599 100644 --- a/docs/origin-trial-changes.md +++ b/docs/origin-trial-changes.md @@ -21,6 +21,7 @@ ### Fixes * Swizzling of `vec3` types in `storage` and `uniform` buffers has been fixed for Metal 1.x. [tint:1249](https://crbug.com/tint/1249) +* Calling a function that returns an unused value no longer produces an FXC compilation error. [tint:1259](https://crbug.com/tint/1259) ## Changes for M95 diff --git a/src/writer/hlsl/generator_impl.cc b/src/writer/hlsl/generator_impl.cc index 17b83540c4..dd287de1a9 100644 --- a/src/writer/hlsl/generator_impl.cc +++ b/src/writer/hlsl/generator_impl.cc @@ -2907,9 +2907,6 @@ bool GeneratorImpl::EmitStatement(const ast::Statement* stmt) { } if (auto* c = stmt->As()) { auto out = line(); - if (!TypeOf(c->expr)->Is()) { - out << "(void) "; - } if (!EmitCall(out, c->expr)) { return false; } diff --git a/src/writer/hlsl/generator_impl_intrinsic_test.cc b/src/writer/hlsl/generator_impl_intrinsic_test.cc index 0065e5b354..92f5c55b0b 100644 --- a/src/writer/hlsl/generator_impl_intrinsic_test.cc +++ b/src/writer/hlsl/generator_impl_intrinsic_test.cc @@ -317,7 +317,7 @@ modf_result tint_modf(float param_0) { [numthreads(1, 1, 1)] void test_function() { - (void) tint_modf(1.0f); + tint_modf(1.0f); return; } )"); @@ -343,7 +343,7 @@ modf_result_vec3 tint_modf(float3 param_0) { [numthreads(1, 1, 1)] void test_function() { - (void) tint_modf(float3(0.0f, 0.0f, 0.0f)); + tint_modf(float3(0.0f, 0.0f, 0.0f)); return; } )"); @@ -369,7 +369,7 @@ frexp_result tint_frexp(float param_0) { [numthreads(1, 1, 1)] void test_function() { - (void) tint_frexp(1.0f); + tint_frexp(1.0f); return; } )"); @@ -395,7 +395,7 @@ frexp_result_vec3 tint_frexp(float3 param_0) { [numthreads(1, 1, 1)] void test_function() { - (void) tint_frexp(float3(0.0f, 0.0f, 0.0f)); + tint_frexp(float3(0.0f, 0.0f, 0.0f)); return; } )"); @@ -418,7 +418,7 @@ TEST_F(HlslGeneratorImplTest_Intrinsic, IsNormal_Scalar) { [numthreads(1, 1, 1)] void test_function() { float val = 0.0f; - (void) tint_isNormal(val); + tint_isNormal(val); return; } )"); @@ -441,7 +441,7 @@ TEST_F(HlslGeneratorImplTest_Intrinsic, IsNormal_Vector) { [numthreads(1, 1, 1)] void test_function() { float3 val = float3(0.0f, 0.0f, 0.0f); - (void) tint_isNormal(val); + tint_isNormal(val); return; } )"); @@ -463,7 +463,7 @@ static float4 p1 = float4(0.0f, 0.0f, 0.0f, 0.0f); [numthreads(1, 1, 1)] void test_function() { - (void) tint_pack4x8snorm(p1); + tint_pack4x8snorm(p1); return; } )"); @@ -485,7 +485,7 @@ static float4 p1 = float4(0.0f, 0.0f, 0.0f, 0.0f); [numthreads(1, 1, 1)] void test_function() { - (void) tint_pack4x8unorm(p1); + tint_pack4x8unorm(p1); return; } )"); @@ -507,7 +507,7 @@ static float2 p1 = float2(0.0f, 0.0f); [numthreads(1, 1, 1)] void test_function() { - (void) tint_pack2x16snorm(p1); + tint_pack2x16snorm(p1); return; } )"); @@ -529,7 +529,7 @@ static float2 p1 = float2(0.0f, 0.0f); [numthreads(1, 1, 1)] void test_function() { - (void) tint_pack2x16unorm(p1); + tint_pack2x16unorm(p1); return; } )"); @@ -551,7 +551,7 @@ static float2 p1 = float2(0.0f, 0.0f); [numthreads(1, 1, 1)] void test_function() { - (void) tint_pack2x16float(p1); + tint_pack2x16float(p1); return; } )"); @@ -574,7 +574,7 @@ static uint p1 = 0u; [numthreads(1, 1, 1)] void test_function() { - (void) tint_unpack4x8snorm(p1); + tint_unpack4x8snorm(p1); return; } )"); @@ -597,7 +597,7 @@ static uint p1 = 0u; [numthreads(1, 1, 1)] void test_function() { - (void) tint_unpack4x8unorm(p1); + tint_unpack4x8unorm(p1); return; } )"); @@ -620,7 +620,7 @@ static uint p1 = 0u; [numthreads(1, 1, 1)] void test_function() { - (void) tint_unpack2x16snorm(p1); + tint_unpack2x16snorm(p1); return; } )"); @@ -643,7 +643,7 @@ static uint p1 = 0u; [numthreads(1, 1, 1)] void test_function() { - (void) tint_unpack2x16unorm(p1); + tint_unpack2x16unorm(p1); return; } )"); @@ -665,7 +665,7 @@ static uint p1 = 0u; [numthreads(1, 1, 1)] void test_function() { - (void) tint_unpack2x16float(p1); + tint_unpack2x16float(p1); return; } )"); diff --git a/test/intrinsics/repeated_use.wgsl.expected.hlsl b/test/intrinsics/repeated_use.wgsl.expected.hlsl index f0a247f690..c89b9fb7b9 100644 --- a/test/intrinsics/repeated_use.wgsl.expected.hlsl +++ b/test/intrinsics/repeated_use.wgsl.expected.hlsl @@ -24,17 +24,17 @@ bool tint_isNormal_3(float param_0) { [numthreads(1, 1, 1)] void main() { - (void) tint_isNormal(float4(0.0f, 0.0f, 0.0f, 0.0f)); - (void) tint_isNormal(float4((1.0f).xxxx)); - (void) tint_isNormal(float4(1.0f, 2.0f, 3.0f, 4.0f)); - (void) tint_isNormal_1(float3(0.0f, 0.0f, 0.0f)); - (void) tint_isNormal_1(float3((1.0f).xxx)); - (void) tint_isNormal_1(float3(1.0f, 2.0f, 3.0f)); - (void) tint_isNormal_2(float2(0.0f, 0.0f)); - (void) tint_isNormal_2(float2((1.0f).xx)); - (void) tint_isNormal_2(float2(1.0f, 2.0f)); - (void) tint_isNormal_3(1.0f); - (void) tint_isNormal_3(2.0f); - (void) tint_isNormal_3(3.0f); + tint_isNormal(float4(0.0f, 0.0f, 0.0f, 0.0f)); + tint_isNormal(float4((1.0f).xxxx)); + tint_isNormal(float4(1.0f, 2.0f, 3.0f, 4.0f)); + tint_isNormal_1(float3(0.0f, 0.0f, 0.0f)); + tint_isNormal_1(float3((1.0f).xxx)); + tint_isNormal_1(float3(1.0f, 2.0f, 3.0f)); + tint_isNormal_2(float2(0.0f, 0.0f)); + tint_isNormal_2(float2((1.0f).xx)); + tint_isNormal_2(float2(1.0f, 2.0f)); + tint_isNormal_3(1.0f); + tint_isNormal_3(2.0f); + tint_isNormal_3(3.0f); return; } diff --git a/test/statements/assign/phony/call.wgsl.expected.hlsl b/test/statements/assign/phony/call.wgsl.expected.hlsl index 2df8bdf454..3d18ac9c64 100644 --- a/test/statements/assign/phony/call.wgsl.expected.hlsl +++ b/test/statements/assign/phony/call.wgsl.expected.hlsl @@ -4,6 +4,6 @@ int f(int a, int b, int c) { [numthreads(1, 1, 1)] void main() { - (void) f(1, 2, 3); + f(1, 2, 3); return; }