vkd3d-shader/msl: Implement VKD3DSIH_MIN.

This commit is contained in:
Feifan He 2024-12-03 00:49:05 +08:00 committed by Henri Verbeet
parent ab2cb43e15
commit bc67f2eb75
Notes: Henri Verbeet 2024-12-04 14:44:01 +01:00
Approved-by: Henri Verbeet (@hverbeet)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1294
4 changed files with 26 additions and 23 deletions

View File

@ -613,6 +613,9 @@ static void msl_handle_instruction(struct msl_generator *gen, const struct vkd3d
case VKD3DSIH_MAX:
msl_intrinsic(gen, ins, "max");
break;
case VKD3DSIH_MIN:
msl_intrinsic(gen, ins, "min");
break;
case VKD3DSIH_INE:
case VKD3DSIH_NEU:
msl_relop(gen, ins, "!=");

View File

@ -8,7 +8,7 @@ float4 main() : sv_target
[test]
uniform 0 float4 -0.3 -0.1 0.7 0.0
todo(msl) draw quad
draw quad
probe (0, 0) rgba (-0.1, 0.7, -0.3, 0.3)

View File

@ -102,23 +102,23 @@ float4 main() : sv_target
[test]
uniform 0 float4 -1.0 0.0 0.0 0.0
todo(msl) draw quad
draw quad
probe (0, 0) rgba (-0.785409629, 0.0, 0.0, 0.0) 512
uniform 0 float4 -0.5 0.0 0.0 0.0
todo(msl) draw quad
draw quad
probe (0, 0) rgba (-0.4636476, 0.0, 0.0, 0.0) 256
uniform 0 float4 0.0 0.0 0.0 0.0
todo(msl) draw quad
draw quad
probe (0, 0) rgba (0.0, 0.0, 0.0, 0.0) 256
uniform 0 float4 0.5 0.0 0.0 0.0
todo(msl) draw quad
draw quad
probe (0, 0) rgba (0.4636476, 0.0, 0.0, 0.0) 256
uniform 0 float4 1.0 0.0 0.0 0.0
todo(msl) draw quad
draw quad
probe (0, 0) rgba (0.785409629, 0.0, 0.0, 0.0) 512
[pixel shader]
@ -133,64 +133,64 @@ float4 main() : sv_target
[test]
% Non-degenerate cases
uniform 0 float4 1.0 1.0 0.0 0.0
todo(msl) draw quad
draw quad
probe (0, 0) rgba (0.785385, 0.0, 0.0, 0.0) 512
uniform 0 float4 5.0 -5.0 0.0 0.0
todo(msl) draw quad
draw quad
probe (0, 0) rgba (2.356194, 0.0, 0.0, 0.0) 256
uniform 0 float4 -3.0 -3.0 0.0 0.0
todo(msl) draw quad
draw quad
probe (0, 0) rgba (-2.356194, 0.0, 0.0, 0.0) 256
uniform 0 float4 1.0 0.0 0.0 0.0
todo(msl) draw quad
draw quad
probe (0, 0) rgba (1.570796, 0.0, 0.0, 0.0) 256
uniform 0 float4 -1.0 0.0 0.0 0.0
todo(msl) draw quad
draw quad
probe (0, 0) rgba (-1.570796, 0.0, 0.0, 0.0) 256
uniform 0 float4 0.0 1.0 0.0 0.0
todo(msl) draw quad
draw quad
probe (0, 0) rgba (0.0, 0.0, 0.0, 0.0) 256
uniform 0 float4 0.0 -1.0 0.0 0.0
todo(msl) draw quad
draw quad
probe (0, 0) rgba (3.1415927, 0.0, 0.0, 0.0) 256
% Degenerate cases
uniform 0 float4 0.00001 0.00002 0.0 0.0
todo(msl) draw quad
draw quad
probe (0, 0) rgba (0.463647, 0.0, 0.0, 0.0) 256
uniform 0 float4 0.00001 -0.00002 0.0 0.0
todo(msl) draw quad
draw quad
probe (0, 0) rgba (2.677945, 0.0, 0.0, 0.0) 256
uniform 0 float4 -0.00001 100000.0 0.0 0.0
todo(msl) draw quad
draw quad
probe (0, 0) rgba (-0.000000000099986595, 0.0, 0.0, 0.0) 2048
uniform 0 float4 10000000.0 0.00000001 0.0 0.0
todo(msl) draw quad
draw quad
probe (0, 0) rgba (1.570796, 0.0, 0.0, 0.0) 256
% Negative zero behavior should be to treat it the
% same as normal zero.
uniform 0 float4 1000000000.0 0.0 0.0 0.0
todo(msl) draw quad
draw quad
probe (0, 0) rgba (1.570796, 0.0, 0.0, 0.0) 256
uniform 0 float4 1000000000.0 -0.0 0.0 0.0
todo(msl) draw quad
draw quad
probe (0, 0) rgba (1.570796, 0.0, 0.0, 0.0) 256
uniform 0 float4 0.0 -1.0 0.0 0.0
todo(msl) draw quad
draw quad
probe (0, 0) rgba (3.1415927, 0.0, 0.0, 0.0) 256
uniform 0 float4 -0.0 -1.0 0.0 0.0
todo(msl) draw quad
draw quad
probe (0, 0) rgba (3.1415927, 0.0, 0.0, 0.0) 256

View File

@ -64,7 +64,7 @@ float4 main() : sv_target
[test]
uniform 0 float4 0.7 -0.1 0.0 0.0
todo(msl) draw quad
draw quad
probe (0, 0) rgba (-0.1, 2.0, 1.0, -2.0)
@ -80,7 +80,7 @@ float4 main() : sv_target
[test]
uniform 0 float4 0.7 -0.1 0.4 0.8
todo(msl) draw quad
draw quad
probe (0, 0) rgba (0.4, -0.1, -0.2, -0.1)