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