mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-06-03 13:11:34 +00:00
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>
13 lines
284 B
HLSL
13 lines
284 B
HLSL
float3 tint_float_mod(float lhs, float3 rhs) {
|
|
const float3 l = float3((lhs).xxx);
|
|
return (l - (trunc((l / rhs)) * rhs));
|
|
}
|
|
|
|
[numthreads(1, 1, 1)]
|
|
void f() {
|
|
const float a = 4.0f;
|
|
const float3 b = float3(1.0f, 2.0f, 3.0f);
|
|
const float3 r = tint_float_mod(a, b);
|
|
return;
|
|
}
|