tests: Test comparison and logic operators on SM1 vertex shaders.

Currently these are failing for SM1 because VKD3DSIH_SLT is not being
handled by spirv.c.
This commit is contained in:
Francisco Casas 2024-02-22 17:39:45 -03:00 committed by Alexandre Julliard
parent cfac67ccc2
commit 308c7941d4
Notes: Alexandre Julliard 2024-03-11 23:06:28 +01:00
Approved-by: Giovanni Mascellani (@giomasce)
Approved-by: Zebediah Figura (@zfigura)
Approved-by: Francisco Casas (@fcasas)
Approved-by: Henri Verbeet (@hverbeet)
Approved-by: Alexandre Julliard (@julliard)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/694
2 changed files with 96 additions and 0 deletions

View File

@ -214,6 +214,7 @@ vkd3d_shader_tests = \
tests/hlsl/uniform-semantics.shader_test \ tests/hlsl/uniform-semantics.shader_test \
tests/hlsl/vector-indexing-uniform.shader_test \ tests/hlsl/vector-indexing-uniform.shader_test \
tests/hlsl/vector-indexing.shader_test \ tests/hlsl/vector-indexing.shader_test \
tests/hlsl/vertex-shader-ops.shader_test \
tests/hlsl/writemask-assignop-0.shader_test \ tests/hlsl/writemask-assignop-0.shader_test \
tests/hlsl/writemask-assignop-1.shader_test \ tests/hlsl/writemask-assignop-1.shader_test \
tests/hlsl/writemask-assignop-2.shader_test \ tests/hlsl/writemask-assignop-2.shader_test \

View File

@ -0,0 +1,95 @@
% The main objective of this test is to see if operations for SM1 vertex shaders work, because they
% have a different instruction set than pixel shaders.
% Considerations so that the vertex shader output matches the pixel shader input properly on all
% backends:
% - sv_position must be the last field in the output signature.
% - the d3d9 backend, on Windows, clamps the value of the COLORX semantics before passing it to
% the pixel shader, so their values must be between 0.0 and 1.0.
[pixel shader]
float4 main(in float4 res : COLOR1) : sv_target
{
return res;
}
[vertex shader todo(sm<4)]
int a, b;
void main(out float4 res : COLOR1, in float4 pos : position, out float4 out_pos : sv_position)
{
out_pos = pos;
res.x = a == b;
res.y = a != b;
res.z = a > b;
res.w = b >= a;
}
[test]
if(sm<4) uniform 0 float 3
if(sm<4) uniform 4 float 4
if(sm>=4) uniform 0 int4 3 4 0 0
todo(sm<4) draw quad
probe all rgba (0.0, 1.0, 0.0, 1.0)
if(sm<4) uniform 0 float -2
if(sm<4) uniform 4 float -2
if(sm>=4) uniform 0 int4 -2 -2 0 0
todo(sm<4) draw quad
probe all rgba (1.0, 0.0, 0.0, 1.0)
[vertex shader todo(sm<4)]
int a, b;
void main(out float4 res : COLOR1, in float4 pos : position, out float4 out_pos : sv_position)
{
out_pos = pos;
res.x = a && b;
res.y = a || b;
res.z = b && a;
res.w = b || a;
}
[test]
if(sm<4) uniform 0 float 0
if(sm<4) uniform 4 float 2
if(sm>=4) uniform 0 int4 0 2 0 0
todo(sm<4) draw quad
probe all rgba (0.0, 1.0, 0.0, 1.0)
if(sm<4) uniform 0 float -2
if(sm<4) uniform 4 float 8
if(sm>=4) uniform 0 int4 -2 8 0 0
todo(sm<4) draw quad
probe all rgba (1.0, 1.0, 1.0, 1.0)
[require]
% The ternary operator works differently in sm6. See sm6-ternary.shader_test.
shader model < 6.0
[vertex shader todo(sm<4)]
int a, b, c;
void main(out float4 res : COLOR1, in float4 pos : position, out float4 out_pos : sv_position)
{
out_pos = pos;
res = a ? b/1000.0 : c/1000.0;
}
[test]
if(sm<4) uniform 0 float 0
if(sm<4) uniform 4 float 100
if(sm<4) uniform 8 float 200
if(sm>=4) uniform 0 int4 0 100 200 0
todo(sm<4) draw quad
probe all rgba (0.2, 0.2, 0.2, 0.2)
if(sm<4) uniform 0 float -4
if(sm<4) uniform 4 float 100
if(sm<4) uniform 8 float 200
if(sm>=4) uniform 0 int4 -4 100 200 0
todo(sm<4) draw quad
probe all rgba (0.1, 0.1, 0.1, 0.1)