Skip to content
Snippets Groups Projects
Commit 08067247 authored by Francisco Casas's avatar Francisco Casas Committed by Henri Verbeet
Browse files

tests/hlsl: Test integer modulus with big integers.

Note that in d3dbc target profiles it gives different results when this
operation is constant folded compared to when it is not.

This suggests that whatever pass lowers the modulus operation to d3dbc
operations doesn't do it before constant folding.

Also note that when constant folded, d3dbc results differ from tpf
results for negative operands, because of the loss of precision that
happens when NEG is constant folded.

So the same integer modulus expression can have 3 different results
depending on the context.
parent a3f80061
No related branches found
No related tags found
No related merge requests found
......@@ -120,6 +120,23 @@ uniform 4 float4 3.0 8.0 2.0 5.0
todo(sm<4 | glsl | msl) draw quad
probe (0, 0) rgba (9.0, 5.0, 1.0, 3.0)
[pixel shader todo(sm<4)]
float f;
float4 main() : sv_target
{
int a = 16777217; // This rounds down to 16777216 when converted to float.
int b = f;
return float4(a % b, a % (-b), (-a) % b, (-a) % (-b));
}
[test]
uniform 0 float 10.0
todo(sm<4 | glsl | msl) draw quad
if(sm<4) probe (0, 0) rgba(6, 6, -6, -6)
if(sm>=4) probe (0, 0) rgba(7, 7, -7, -7)
[require]
shader model >= 6.0
int64
......
......@@ -165,3 +165,17 @@ float4 main() : sv_target
draw quad
todo if(sm<4) probe (0, 0) rgba(16782202, 16782200, 0, 0)
if(sm>=4) probe (0, 0) rgba(16782202, 16782202, 0, 0)
[pixel shader]
float4 main() : sv_target
{
int a = 16777217; // This rounds down to 16777216 when converted to float.
int b = 10;
return float4(a % b, a % (-b), (-a) % b, (-a) % (-b));
}
[test]
draw quad
todo if(sm<4) probe (0, 0) rgba(7, 7, -6, -6)
if(sm>=4) probe (0, 0) rgba(7, 7, -7, -7)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment