dawn-cmake/test/tint/statements/compound_assign/vector/modulo-scalar.wgsl.expected.fxc.hlsl
Ben Clayton 619f9bd639 tint/transform: Fix ICE when combining polyfills
There's a reason the overload of `ctx.Replace()` that takes a pointer to the replacement is deprecated - it doesn't play well when used as part of another replacement.
Switch to using the callback overload of Replace() to fix bad transform output.

Bug: tint:1386647
Change-Id: I94292eeb65d24d7b2446b16b8b4ad13bdd27965a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/111000
Auto-Submit: Ben Clayton <bclayton@google.com>
Commit-Queue: James Price <jrprice@google.com>
Reviewed-by: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-11-21 17:11:05 +00:00

17 lines
399 B
HLSL

[numthreads(1, 1, 1)]
void unused_entry_point() {
return;
}
RWByteAddressBuffer v : register(u0, space0);
int4 tint_mod(int4 lhs, int rhs) {
const int4 r = int4((rhs).xxxx);
return (lhs % (((r == (0).xxxx) | ((lhs == (-2147483648).xxxx) & (r == (-1).xxxx))) ? (1).xxxx : r));
}
void foo() {
const int4 tint_symbol = tint_mod(asint(v.Load4(0u)), 2);
v.Store4(0u, asuint(tint_symbol));
}