mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-08-06 12:15:43 +00:00
Discard statements no longer affect the behavior or uniformity analysis. Update the resolver, validator, and several tests to reflect this. Some E2E tests were removed as they had loops that are now considered to be infinite. Use the DemoteToHelper transform to emulate the correct semantics on platforms where discard is (or may) terminate the invocation in a manner that would affect derivative operations. We no longer need the UnwindDiscardFunctions transform for HLSL, which already implements the correct semantics. However, we still run the DemoteToHelper transform for the HLSL backend due to issues with FXC's handling of discard statements (see crbug.com/tint/1118). Fixed: tint:1723 Change-Id: Ib49ff187919ae81c4af8675e1b66acd57e2ff7d2 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/109003 Reviewed-by: Ben Clayton <bclayton@google.com> Kokoro: Kokoro <noreply+kokoro@google.com> Commit-Queue: James Price <jrprice@google.com>
37 lines
633 B
HLSL
37 lines
633 B
HLSL
static bool tint_discarded = false;
|
|
|
|
int f(int x) {
|
|
if ((x == 10)) {
|
|
tint_discarded = true;
|
|
}
|
|
return x;
|
|
}
|
|
|
|
struct tint_symbol_1 {
|
|
nointerpolation int3 x : TEXCOORD1;
|
|
};
|
|
struct tint_symbol_2 {
|
|
int value : SV_Target2;
|
|
};
|
|
|
|
int main_inner(int3 x) {
|
|
int y = x.x;
|
|
while (true) {
|
|
const int r = f(y);
|
|
if ((r == 0)) {
|
|
break;
|
|
}
|
|
}
|
|
return y;
|
|
}
|
|
|
|
tint_symbol_2 main(tint_symbol_1 tint_symbol) {
|
|
const int inner_result = main_inner(tint_symbol.x);
|
|
tint_symbol_2 wrapper_result = (tint_symbol_2)0;
|
|
wrapper_result.value = inner_result;
|
|
if (tint_discarded) {
|
|
discard;
|
|
}
|
|
return wrapper_result;
|
|
}
|