mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-01-28 13:05:02 -08:00
We apply distributivity to applicable expressions, specifically with the following rewrite rules: (x OPL a) OPR (x OPL b) -> x OPL (a OPR b) (y OPR (x OPL a)) OPR (x OPL b) -> y OPR (x OPL (a OPR b)) ((x OPL a) OPR y) OPR (x OPL b) -> (x OPL (a OPR b)) OPR y (x OPL a) OPR ((x OPL b) OPR y) -> (x OPL (a OPR b)) OPR y (x OPL a) OPR (y OPR (x OPL b)) -> (x OPL (a OPR b)) OPR y where a, b are constants.
91 lines
1.3 KiB
Plaintext
91 lines
1.3 KiB
Plaintext
[require]
|
|
shader model >= 4.0
|
|
|
|
[pixel shader]
|
|
float4 main() : SV_TARGET
|
|
{
|
|
uint x = 5;
|
|
uint y = 15;
|
|
|
|
return float4(x + y, x - y, x * y, x / y);
|
|
}
|
|
|
|
[test]
|
|
draw quad
|
|
probe (0, 0) rgba (20.0, 4294967296.0, 75.0, 0.0)
|
|
|
|
[pixel shader]
|
|
float4 main() : SV_TARGET
|
|
{
|
|
uint x = 5;
|
|
uint y = 15;
|
|
|
|
return float4(x % y, +x, -x, y / x);
|
|
}
|
|
|
|
[test]
|
|
draw quad
|
|
probe (0, 0) rgba (5.0, 5.0, 4294967296.0, 3.0)
|
|
|
|
[pixel shader fail(sm<6)]
|
|
float4 main() : SV_TARGET
|
|
{
|
|
uint x = 1;
|
|
uint y = 0;
|
|
|
|
return x / y;
|
|
}
|
|
|
|
[test]
|
|
draw quad
|
|
probe (0, 0) rgba (0.0, 0.0, 0.0, 0.0)
|
|
|
|
[pixel shader fail(sm<6)]
|
|
float4 main() : SV_TARGET
|
|
{
|
|
uint x = 1;
|
|
uint y = 0;
|
|
|
|
return x % y;
|
|
}
|
|
|
|
[test]
|
|
draw quad
|
|
probe (0, 0) rgba (0.0, 0.0, 0.0, 0.0)
|
|
|
|
|
|
% Test expression normalization and simplification.
|
|
|
|
[pixel shader]
|
|
uniform uint4 x;
|
|
|
|
float4 main() : SV_TARGET
|
|
{
|
|
return 6 + (2 * x * 3) - 5;
|
|
}
|
|
|
|
[test]
|
|
uniform 0 uint4 0 1 2 3
|
|
todo(msl) draw quad
|
|
probe (0, 0) rgba (1.0, 7.0, 13.0, 19.0)
|
|
|
|
% Test collecting terms with constant coefficients.
|
|
|
|
[pixel shader]
|
|
uniform uint x;
|
|
|
|
float4 main() : SV_TARGET
|
|
{
|
|
uint4 res;
|
|
res.x = x * 2 + (3 + 3 * x);
|
|
res.y = (x & 4) | (x & 1);
|
|
res.z = max(min(2, x), min(x, 10));
|
|
res.w = 0;
|
|
return res;
|
|
}
|
|
|
|
[test]
|
|
uniform 0 uint 7
|
|
todo(msl) draw quad
|
|
probe (0, 0) rgba(38.0, 5.0, 7.0, 0.0)
|