vkd3d/tests/hlsl/for.shader_test
Francisco Casas 1c73513425 tests: Use the vulkan runner to run SM1 compilation tests.
At the current moment this is a little odd because for SM1 [test]
directives are skipped, and the [shader] directives are not executed by
the shader_runner_vulkan.c:compile_shader() but by the general
shader_runner.c:compile_shader(). So in principle it is a little weird
that we go through the vulkan runner.

But fret not, because in the future we plan to make the parser agnostic
to the language of the tests, so we will get rid of the general
shader_runner.c:compile_shader() function and instead call a
runner->compile_shader() function, defined for each runner. Granted,
most of these may call a generic implementation that uses native
compiler in Windows, and vkd3d-shader on Linux, but it would be more
conceptually correct.
2024-01-24 22:37:44 +01:00

100 lines
2.0 KiB
Plaintext

[vertex shader]
void main(float4 pos : position, out float tex : texcoord, out float4 out_pos : sv_position)
{
tex = pos.x;
out_pos = pos;
}
[pixel shader todo(sm<4)]
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<4) 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)
[require]
shader model >= 4.0
% Identical to the previous, except we prevent DXC from unrolling the
% loop so we can test non-trivial control flow
[pixel shader]
uniform uint iter;
float4 main(float tex : texcoord) : sv_target
{
int i;
float x = 0.0;
for (i = 0; i < iter; 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]
uniform 0 uint4 10 0 0 0
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)
[require]
% Reset requirements
[pixel shader todo(sm<4)]
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]
todo(sm<4) 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);
}