mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-04-13 05:43:18 -07:00
vkd3d-shader/hlsl: Collect together terms with constant coefficients.
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.
This commit is contained in:
Notes:
Henri Verbeet
2025-01-10 20:14:25 +01:00
Approved-by: Elizabeth Figura (@zfigura) Approved-by: Henri Verbeet (@hverbeet) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1314
@@ -68,3 +68,23 @@ float4 main() : SV_TARGET
|
||||
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)
|
||||
|
Reference in New Issue
Block a user