We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Consider the attached shader, which has a OpSRem operation. When converted to MSL it becomes:
OpSRem
#include <metal_stdlib> #include <simd/simd.h> using namespace metal; struct push_cb_struct { float4 cb0[1]; }; struct main0_out { float4 o0 [[color(0)]]; }; fragment main0_out main0(constant push_cb_struct& push_cb [[buffer(0)]]) { main0_out out = {}; float _25 = precise::max(push_cb.cb0[0u].x, -2147483648.0); uint _32 = isnan(push_cb.cb0[0u].x) ? 0u : ((_25 >= 2147483648.0) ? 2147483647u : uint(int(_25))); float _34 = precise::max(push_cb.cb0[0u].y, -2147483648.0); uint _39 = isnan(push_cb.cb0[0u].y) ? 0u : ((_34 >= 2147483648.0) ? 2147483647u : uint(int(_34))); out.o0.x = float(int((_39 != 0u) ? (_32 - _39 * (_32 / _39)) : 4294967295u)); out.o0.y = 0.0; out.o0.z = 0.0; out.o0.w = 0.0; float4 r0; return out; }
The remainder operation is executed as unsigned instead of signed, which means that it is incorrect for negative numbers.
The text was updated successfully, but these errors were encountered:
Successfully merging a pull request may close this issue.
Consider the attached shader, which has a
OpSRem
operation. When converted to MSL it becomes:The remainder operation is executed as unsigned instead of signed, which means that it is incorrect for negative numbers.
The text was updated successfully, but these errors were encountered: