dawn-cmake/test/tint/bug/tint/1369.wgsl.expected.msl
Antonio Maiorano 66d6668372 Implement discard semantics
Implement new transform UnwindDiscardFunctions that replaces discard
statements with setting a module-level bool, adds a check and return for
this bool after every function call that may discard, and finally
invokes a single function that executes a discard from top-level
functions.

Regenerated tests and remove HLSL ones that used to fail FXC because it
had difficulty with discard.

Bug: tint:1478
Bug: chromium:1118
Change-Id: I09d680f59e2d5d0cad907bfbbdd426aae76d4bf3
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/84221
Reviewed-by: James Price <jrprice@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
2022-03-28 20:51:32 +00:00

33 lines
610 B
Plaintext

bug/tint/1369.wgsl:3:3 warning: code is unreachable
return true;
^^^^^^
bug/tint/1369.wgsl:9:9 warning: code is unreachable
var also_unreachable : bool;
^^^^^^^^^^^^^^^^
#include <metal_stdlib>
using namespace metal;
bool call_discard(thread bool* const tint_symbol) {
*(tint_symbol) = true;
return bool();
return true;
}
void tint_discard_func() {
discard_fragment();
}
fragment void f() {
thread bool tint_symbol_1 = false;
bool v = call_discard(&(tint_symbol_1));
if (tint_symbol_1) {
tint_discard_func();
return;
}
bool also_unreachable = false;
return;
}