mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-04-13 05:43:18 -07:00
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.
This commit is contained in:
committed by
Henri Verbeet
parent
a3f80061b1
commit
080672478d
Notes:
Henri Verbeet
2025-03-18 16:03:46 +01:00
Approved-by: Elizabeth Figura (@zfigura) Approved-by: Henri Verbeet (@hverbeet) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1427
@@ -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)
|
||||
|
Reference in New Issue
Block a user