vkd3d/tests/hlsl/for.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

64 lines
1.2 KiB
Plaintext

[vertex shader]
void main(out float tex : texcoord, inout float4 pos : sv_position)
{
tex = pos.x;
}
[pixel shader]
float4 main(float tex : texcoord) : sv_target
{
int i;
float x = 0.0;
[unroll] for (i = 0; i < 10; i++)
{
x += i;
if (tex > 0.5 && i == 5)
break;
if (tex > -0.5 && i >= 7)
continue;
x -= 1;
}
return float4(i, x, 0.0, 0.0);
}
[test]
todo(sm>=6) draw quad
probe ( 0, 0, 159, 480) rgba (10.0, 35.0, 0.0, 0.0)
probe (161, 0, 479, 480) rgba (10.0, 38.0, 0.0, 0.0)
probe (481, 0, 640, 480) rgba ( 5.0, 10.0, 0.0, 0.0)
[pixel shader]
float4 main(float tex : texcoord) : sv_target
{
int i;
float x = 0.0;
[unroll] [attr1] for (i = 0; i < 10; i++)
{
x += i;
}
return float4(i, x, 0.0, 0.0);
}
[test]
draw quad
probe all rgba (10.0, 45.0, 0.0, 0.0)
[pixel shader fail(sm<6)]
float4 main(float tex : texcoord) : sv_target
{
int i;
float x = 0.0;
[unroll] [unroll] for (i = 0; i < 10; i++)
{
x += i;
}
return float4(i, x, 0.0, 0.0);
}
[pixel shader fail]
float4 main() : sv_target
{
break;
return float4(0.0, 0.0, 0.0, 0.0);
}