2022-04-07 18:58:16 -05:00
|
|
|
[vertex shader]
|
2022-08-15 19:53:55 -05:00
|
|
|
void main(float4 pos : position, out float tex : texcoord, out float4 out_pos : sv_position)
|
2022-04-07 18:58:16 -05:00
|
|
|
{
|
|
|
|
tex = pos.x;
|
2022-08-15 19:53:55 -05:00
|
|
|
out_pos = pos;
|
2022-04-07 18:58:16 -05:00
|
|
|
}
|
|
|
|
|
2023-11-15 17:41:33 -03:00
|
|
|
[pixel shader todo(sm<4)]
|
2022-04-07 18:58:16 -05:00
|
|
|
float4 main(float tex : texcoord) : sv_target
|
2021-09-15 16:00:16 +02:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
float x = 0.0;
|
2023-04-21 08:20:32 +02:00
|
|
|
[unroll] for (i = 0; i < 10; i++)
|
2021-09-15 16:00:16 +02:00
|
|
|
{
|
|
|
|
x += i;
|
2022-04-07 18:58:16 -05:00
|
|
|
if (tex > 0.5 && i == 5)
|
2021-09-15 16:00:16 +02:00
|
|
|
break;
|
2022-04-07 18:58:16 -05:00
|
|
|
if (tex > -0.5 && i >= 7)
|
2021-09-15 16:00:16 +02:00
|
|
|
continue;
|
|
|
|
x -= 1;
|
|
|
|
}
|
|
|
|
return float4(i, x, 0.0, 0.0);
|
|
|
|
}
|
|
|
|
|
|
|
|
[test]
|
2023-11-15 17:41:33 -03:00
|
|
|
todo(sm<4) draw quad
|
2022-04-18 08:33:58 +02:00
|
|
|
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)
|
2023-04-21 08:20:32 +02:00
|
|
|
|
2024-01-15 12:08:56 +01:00
|
|
|
[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
|
2024-01-16 23:56:43 +01:00
|
|
|
draw quad
|
2024-01-15 12:08:56 +01:00
|
|
|
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)
|
|
|
|
|
2023-11-15 17:41:33 -03:00
|
|
|
|
2024-01-15 12:08:56 +01:00
|
|
|
[require]
|
|
|
|
% Reset requirements
|
|
|
|
|
2023-11-15 17:41:33 -03:00
|
|
|
[pixel shader todo(sm<4)]
|
2023-04-21 08:20:32 +02:00
|
|
|
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]
|
2023-11-15 17:41:33 -03:00
|
|
|
todo(sm<4) draw quad
|
2023-04-21 08:20:32 +02:00
|
|
|
probe all rgba (10.0, 45.0, 0.0, 0.0)
|
|
|
|
|
2023-09-14 19:29:24 +10:00
|
|
|
[pixel shader fail(sm<6)]
|
2023-04-21 08:20:32 +02:00
|
|
|
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);
|
|
|
|
}
|
2023-09-25 16:30:02 +02:00
|
|
|
|
|
|
|
[pixel shader fail]
|
|
|
|
float4 main() : sv_target
|
|
|
|
{
|
|
|
|
break;
|
|
|
|
return float4(0.0, 0.0, 0.0, 0.0);
|
|
|
|
}
|