mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-09 21:47:47 +00:00
Fix operator% for f32 and vecN<f32>
https://github.com/gpuweb/gpuweb/pull/1945 changes the SPIR-V mapping of this operator so that it now maps to OpFRem instead of OpFMod. Polyfill OpFMod with `x - y * floor(x / y)` Also map the MSL output of this operator to use `fmod()`. Behavior of this operator is now consistent across all backends. Fixed: tint:945 Fixed: tint:977 Fixed: tint:1010 Change-Id: Iefa009b905989c55ace24e073ab0e261c7cf69b0 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/58393 Auto-Submit: Ben Clayton <bclayton@google.com> Commit-Queue: Ben Clayton <bclayton@chromium.org> Kokoro: Kokoro <noreply+kokoro@google.com> Reviewed-by: David Neto <dneto@google.com>
This commit is contained in:
committed by
Tint LUCI CQ
parent
1ec484410a
commit
81d4ed0d9c
@@ -1,19 +1,10 @@
|
||||
SKIP: FAILED
|
||||
|
||||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
kernel void f() {
|
||||
float const a = 1.0f;
|
||||
float const b = 2.0f;
|
||||
float const r = (a % b);
|
||||
float const r = fmod(a, b);
|
||||
return;
|
||||
}
|
||||
|
||||
Compilation failed:
|
||||
|
||||
program_source:7:22: error: invalid operands to binary expression ('const float' and 'const float')
|
||||
float const r = (a % b);
|
||||
~ ^ ~
|
||||
|
||||
|
||||
|
||||
@@ -15,6 +15,6 @@
|
||||
%float_2 = OpConstant %float 2
|
||||
%f = OpFunction %void None %1
|
||||
%4 = OpLabel
|
||||
%8 = OpFMod %float %float_1 %float_2
|
||||
%8 = OpFRem %float %float_1 %float_2
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
|
||||
Reference in New Issue
Block a user