dawn-cmake/test/tint/expressions/binary/mod/vec3-scalar/f16.wgsl.expected.dxc.hlsl
Antonio Maiorano ee665a4240 tint: add precise float mod polyfill and enable it for HLSL
HLSL's % operator results in less precise results than expected.

Bug: tint:1799
Change-Id: I1a9572288a0e536f0fc9c0748a25dcf58551e57b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/119760
Kokoro: Kokoro <noreply+kokoro@google.com>
Kokoro: Ben Clayton <bclayton@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
2023-02-14 16:12:59 +00:00

13 lines
434 B
HLSL

vector<float16_t, 3> tint_float_mod(vector<float16_t, 3> lhs, float16_t rhs) {
const vector<float16_t, 3> r = vector<float16_t, 3>((rhs).xxx);
return (lhs - (trunc((lhs / r)) * r));
}
[numthreads(1, 1, 1)]
void f() {
const vector<float16_t, 3> a = vector<float16_t, 3>(float16_t(1.0h), float16_t(2.0h), float16_t(3.0h));
const float16_t b = float16_t(4.0h);
const vector<float16_t, 3> r = tint_float_mod(a, b);
return;
}