mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-09-12 18:50:22 -07:00
vkd3d-shader/hlsl: Fold some general unary identities.
The following unary identities are applied: ||x|| -> |x| |-x| -> |x| ~(~x) -> x f(g(x)) -> g(x), where f(), g() are floor() or ceil() functions. -(-x) -> x !!x -> x !(x == y) -> x != y, !(x < y) -> x >= y, etc (for integers).
This commit is contained in:
Notes:
Henri Verbeet
2025-08-21 16:34:36 +02:00
Approved-by: Francisco Casas (@fcasas) Approved-by: Elizabeth Figura (@zfigura) Approved-by: Henri Verbeet (@hverbeet) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1648
@@ -127,6 +127,37 @@ uniform 8 float4 1.00000007 -1.0 0.5 -0.5
|
||||
todo(msl & sm>=6) draw quad
|
||||
probe (0, 0) rgba (2.62500048, 209.5, 17.0, 224.5) 1
|
||||
|
||||
[pixel shader]
|
||||
uniform float4 a;
|
||||
|
||||
float4 main() : sv_target
|
||||
{
|
||||
return float4(abs(abs(a.x)), abs(-a.y), -(-a.z), 0);
|
||||
}
|
||||
|
||||
[test]
|
||||
uniform 0 float4 -1.0 -2.0 -3.0 0.0
|
||||
draw quad
|
||||
probe (0, 0) f32(1.0, 2.0, -3.0, 0.0)
|
||||
|
||||
[pixel shader]
|
||||
uniform float4 a;
|
||||
|
||||
float4 main() : sv_target
|
||||
{
|
||||
float4 ret;
|
||||
ret.x = floor(floor(a.x));
|
||||
ret.y = floor(ceil(a.y));
|
||||
ret.z = ceil(floor(a.z));
|
||||
ret.w = ceil(ceil(a.w));
|
||||
return ret;
|
||||
}
|
||||
|
||||
[test]
|
||||
uniform 0 float4 1.5 1.5 -1.5 -1.5
|
||||
draw quad
|
||||
probe (0, 0) f32(1.0, 2.0, -2.0, -1.0)
|
||||
|
||||
[require]
|
||||
shader model >= 5.0
|
||||
float64
|
||||
|
Reference in New Issue
Block a user