vkd3d/tests/hlsl/array-index-expr.shader_test
Conor McCarthy 57280673e5 tests/shader-runner: Test shaders with dxcompiler.
The location of dxcompiler should be set during configuration with
'DXCOMPILER_LIBS=-L/path/to/dxcompiler', and then at runtime with
LD_LIBRARY_PATH, WINEPATH or PATH as applicable.

A new 'fail(sm<6)' decoration is needed on many shader declarations
because dxcompiler succeeds on many shaders which fail with fxc. The
opposite case is less common and is flagged with 'fail(sm>=6)'. A few
tests cause dxcompiler to crash or hang, so these are avoided using
[require], which now skips tests until reset instead of exiting. Also,
'todo(sm<6)' and 'todo(sm>=6)' are used to separate checking of results.
2023-10-11 22:21:14 +02:00

100 lines
2.0 KiB
Plaintext

[pixel shader todo]
uniform float4 f[3];
uniform float2 i;
float4 main() : sv_target
{
return f[i.x + i.y];
}
[test]
uniform 0 float4 1.0 2.0 3.0 4.0
uniform 4 float4 5.0 6.0 7.0 8.0
uniform 8 float4 9.0 10.0 11.0 12.0
uniform 12 float4 0 0 0 0
todo draw quad
todo probe all rgba (1.0, 2.0, 3.0, 4.0)
uniform 12 float4 1 0 0 0
todo draw quad
todo probe all rgba (5.0, 6.0, 7.0, 8.0)
uniform 12 float4 0 1 0 0
todo draw quad
todo probe all rgba (5.0, 6.0, 7.0, 8.0)
uniform 12 float4 1 1 0 0
todo draw quad
todo probe all rgba (9.0, 10.0, 11.0, 12.0)
[pixel shader]
uniform float i;
float4 main() : SV_TARGET
{
float4 arr = float4(11.0, 12.0, 13.0, 14.0);
return arr[i];
}
[test]
uniform 0 float 0
todo(sm>=6) draw quad
probe all rgba (11.0, 11.0, 11.0, 11.0)
uniform 0 float 1
todo(sm>=6) draw quad
probe all rgba (12.0, 12.0, 12.0, 12.0)
uniform 0 float 2
todo(sm>=6) draw quad
probe all rgba (13.0, 13.0, 13.0, 13.0)
uniform 0 float 3
todo(sm>=6) draw quad
probe all rgba (14.0, 14.0, 14.0, 14.0)
[pixel shader]
uniform float i;
float4 main() : SV_TARGET
{
int4 arr_i = int4(21, 22, 23, 24);
bool4 arr_b = bool4(true, false, true, false);
return float4(arr_i[i], arr_b[i], arr_i[3 - i], arr_b[3 - i]);
}
[test]
uniform 0 float 0
todo(sm>=6) draw quad
probe all rgba (21.0, 1.0, 24.0, 0.0)
uniform 0 float 1
todo(sm>=6) draw quad
probe all rgba (22.0, 0.0, 23.0, 1.0)
uniform 0 float 2
todo(sm>=6) draw quad
probe all rgba (23.0, 1.0, 22.0, 0.0)
uniform 0 float 3
todo(sm>=6) draw quad
probe all rgba (24.0, 0.0, 21.0, 1.0)
[pixel shader todo]
uniform float2 i;
float4 main() : sv_target
{
float4 f[3] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12};
return f[i.x + i.y];
}
[test]
uniform 0 float4 0 0 0 0
todo draw quad
todo probe all rgba (1.0, 2.0, 3.0, 4.0)
uniform 0 float4 1 0 0 0
todo draw quad
todo probe all rgba (5.0, 6.0, 7.0, 8.0)
uniform 0 float4 0 1 0 0
todo draw quad
todo probe all rgba (5.0, 6.0, 7.0, 8.0)
uniform 0 float4 1 1 0 0
todo draw quad
todo probe all rgba (9.0, 10.0, 11.0, 12.0)