writer/hlsl: Do not emit `(void) call_expr;`

Just emit `call_expr;` instead.

Fixed: tint:1259
Change-Id: I84a2976d82f891e9263f3e11e5774fcb01ea09bd
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/67381
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
This commit is contained in:
Ben Clayton 2021-10-25 11:00:44 +00:00 committed by Tint LUCI CQ
parent 7b776f18b0
commit 33c13c6e28
5 changed files with 30 additions and 32 deletions

View File

@ -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

View File

@ -2907,9 +2907,6 @@ bool GeneratorImpl::EmitStatement(const ast::Statement* stmt) {
}
if (auto* c = stmt->As<ast::CallStatement>()) {
auto out = line();
if (!TypeOf(c->expr)->Is<sem::Void>()) {
out << "(void) ";
}
if (!EmitCall(out, c->expr)) {
return false;
}

View File

@ -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;
}
)");

View File

@ -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;
}

View File

@ -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;
}