2021-08-16 10:25:41 -07:00
|
|
|
% Test HLSL attribute syntax. The compiler ignores unrecognized attributes, so
|
|
|
|
% we need to get the parsing syntax right. Most of the following tests which
|
|
|
|
% succeed print warnings.
|
|
|
|
|
2023-09-14 02:29:24 -07:00
|
|
|
[pixel shader fail(sm>=6)]
|
2021-08-16 10:25:41 -07:00
|
|
|
|
|
|
|
[numthreads]
|
|
|
|
float4 main() : sv_target { return 0; }
|
|
|
|
|
2023-09-14 02:29:24 -07:00
|
|
|
[pixel shader fail(sm>=6)]
|
2021-08-16 10:25:41 -07:00
|
|
|
|
|
|
|
[ numthreads ]
|
|
|
|
float4 main() : sv_target { return 0; }
|
|
|
|
|
2023-09-14 02:29:24 -07:00
|
|
|
[pixel shader fail(sm>=6)]
|
2021-08-16 10:25:41 -07:00
|
|
|
|
|
|
|
[numthreads(1)]
|
|
|
|
float4 main() : sv_target { return 0; }
|
|
|
|
|
2024-06-14 16:59:21 -07:00
|
|
|
[pixel shader fail(sm>=6)]
|
2021-08-16 10:25:41 -07:00
|
|
|
|
|
|
|
[numthreads("")]
|
|
|
|
float4 main() : sv_target { return 0; }
|
|
|
|
|
2024-06-14 16:59:21 -07:00
|
|
|
[pixel shader fail(sm>=6)]
|
2021-08-16 10:25:41 -07:00
|
|
|
|
|
|
|
[numthreads("one")]
|
|
|
|
float4 main() : sv_target { return 0; }
|
|
|
|
|
2024-06-14 16:59:21 -07:00
|
|
|
[pixel shader fail(sm>=6)]
|
2021-08-16 10:25:41 -07:00
|
|
|
|
|
|
|
uniform float4 f;
|
|
|
|
|
|
|
|
[numthreads(1, "one", 3 + 9, -9.8e4, -float2(1, 2), f)]
|
|
|
|
float4 main() : sv_target { return 0; }
|
|
|
|
|
|
|
|
[pixel shader fail]
|
|
|
|
|
|
|
|
[numthreads()]
|
|
|
|
float4 main() : sv_target { return 0; }
|
|
|
|
|
|
|
|
[pixel shader fail]
|
|
|
|
|
|
|
|
[numthreads(1,)]
|
|
|
|
float4 main() : sv_target { return 0; }
|
|
|
|
|
|
|
|
[pixel shader fail]
|
|
|
|
|
|
|
|
[numthreads(f)]
|
|
|
|
float4 main() : sv_target { return 0; }
|
|
|
|
|
|
|
|
[pixel shader fail]
|
|
|
|
|
|
|
|
/* Test an invalid constructor. */
|
|
|
|
[numthreads(float2(1))]
|
|
|
|
float4 main() : sv_target { return 0; }
|
|
|
|
|
2021-08-16 12:52:10 -07:00
|
|
|
[pixel shader]
|
2021-08-16 10:25:41 -07:00
|
|
|
|
|
|
|
[not_a_real_attribute_name]
|
|
|
|
float4 main() : sv_target { return 0; }
|
|
|
|
|
2021-08-16 12:52:10 -07:00
|
|
|
[pixel shader]
|
2021-08-16 10:25:41 -07:00
|
|
|
|
|
|
|
uniform float4 f;
|
|
|
|
|
|
|
|
[f]
|
|
|
|
float4 main() : sv_target { return 0; }
|
|
|
|
|
|
|
|
[pixel shader fail]
|
|
|
|
% This is valid IDL syntax, but not HLSL.
|
|
|
|
[one, two]
|
|
|
|
float4 main() : sv_target { return 0; }
|
|
|
|
|
2021-08-16 12:52:10 -07:00
|
|
|
[pixel shader]
|
2021-08-16 10:25:41 -07:00
|
|
|
|
|
|
|
[one][two]
|
|
|
|
float4 main() : sv_target { return 0; }
|
|
|
|
|
2023-09-14 02:29:24 -07:00
|
|
|
[pixel shader fail(sm<6) todo]
|
2021-08-16 10:25:41 -07:00
|
|
|
|
|
|
|
[one][one]
|
|
|
|
float4 main() : sv_target { return 0; }
|
|
|
|
|
2023-09-14 02:29:24 -07:00
|
|
|
[pixel shader fail(sm<6) todo]
|
2021-08-16 10:25:41 -07:00
|
|
|
|
|
|
|
[one][one(1)]
|
|
|
|
float4 main() : sv_target { return 0; }
|
|
|
|
|
2021-08-16 12:52:10 -07:00
|
|
|
[pixel shader]
|
2021-08-16 10:25:41 -07:00
|
|
|
|
|
|
|
[one][One]
|
|
|
|
float4 main() : sv_target { return 0; }
|
|
|
|
|
2023-09-14 02:29:24 -07:00
|
|
|
[pixel shader fail(sm>=6)]
|
2021-08-16 10:25:41 -07:00
|
|
|
|
|
|
|
[numthreads]
|
|
|
|
float4 main();
|
|
|
|
|
|
|
|
[numthreads]
|
|
|
|
float4 main() : sv_target { return 0; }
|
|
|
|
|
2021-08-16 12:52:10 -07:00
|
|
|
[pixel shader]
|
2021-08-16 10:25:41 -07:00
|
|
|
|
|
|
|
/* Expressions with side effects are forbidden in attributes—see
|
|
|
|
* hlsl-numthreads.shader_test for an example—but not if the attribute is
|
|
|
|
* ignored. */
|
|
|
|
static int i = 1;
|
|
|
|
|
|
|
|
[one(i++)]
|
|
|
|
[two(++i)]
|
|
|
|
[three(i = 4)]
|
|
|
|
float4 main() : sv_target { return 0; }
|
|
|
|
|
2023-09-14 02:29:24 -07:00
|
|
|
[pixel shader fail(sm<6)]
|
2021-08-16 10:25:41 -07:00
|
|
|
|
|
|
|
[one]
|
|
|
|
float4 f;
|
|
|
|
|
|
|
|
float4 main() : sv_target { return 0; }
|