diff options
Diffstat (limited to 'clang/test/SemaHLSL')
6 files changed, 222 insertions, 27 deletions
diff --git a/clang/test/SemaHLSL/Availability/attr-availability-compute.hlsl b/clang/test/SemaHLSL/Availability/attr-availability-compute.hlsl new file mode 100644 index 0000000..8fa696e --- /dev/null +++ b/clang/test/SemaHLSL/Availability/attr-availability-compute.hlsl @@ -0,0 +1,73 @@ +// RUN: %clang_cc1 -triple dxil-pc-shadermodel5.0-compute -fsyntax-only -verify %s + +// Platform shader model, no environment parameter +__attribute__((availability(shadermodel, introduced = 6.0))) +unsigned f1(); // #f1 + +__attribute__((availability(shadermodel, introduced = 5.1))) +unsigned f2(); // #f2 + +__attribute__((availability(shadermodel, introduced = 5.0))) +unsigned f3(); + +// Platform shader model, environment parameter restricting earlier version, +// available in all environments in higher versions +__attribute__((availability(shadermodel, introduced = 2.0, environment = pixel))) +__attribute__((availability(shadermodel, introduced = 6.0))) +unsigned f4(); // #f4 + +__attribute__((availability(shadermodel, introduced = 2.0, environment = pixel))) +__attribute__((availability(shadermodel, introduced = 5.0))) +unsigned f5(); + +// Platform shader model, environment parameter restricting earlier version, +// never available in all environments in higher versions +__attribute__((availability(shadermodel, introduced = 2.0, environment = pixel))) +__attribute__((availability(shadermodel, introduced = 6.0, environment = compute))) +__attribute__((availability(shadermodel, introduced = 5.0, environment = mesh))) +unsigned f6(); // #f6 + +__attribute__((availability(shadermodel, introduced = 2.0, environment = pixel))) +__attribute__((availability(shadermodel, introduced = 6.0, environment = mesh))) +unsigned f7(); // #f7 + +__attribute__((availability(shadermodel, introduced = 2.0, environment = pixel))) +__attribute__((availability(shadermodel, introduced = 5.0, environment = compute))) +__attribute__((availability(shadermodel, introduced = 6.0, environment = mesh))) +unsigned f8(); + +[numthreads(4,1,1)] +int main() { + // expected-warning@#f1_call {{'f1' is only available on Shader Model 6.0 or newer}} + // expected-note@#f1 {{'f1' has been marked as being introduced in Shader Model 6.0 here, but the deployment target is Shader Model 5.0}} + // expected-note@#f1_call {{enclose 'f1' in a __builtin_available check to silence this warning}} + unsigned A = f1(); // #f1_call + + // expected-warning@#f2_call {{'f2' is only available on Shader Model 5.1 or newer}} + // expected-note@#f2 {{'f2' has been marked as being introduced in Shader Model 5.1 here, but the deployment target is Shader Model 5.0}} + // expected-note@#f2_call {{enclose 'f2' in a __builtin_available check to silence this warning}} + unsigned B = f2(); // #f2_call + + unsigned C = f3(); + + // expected-warning@#f4_call {{'f4' is only available on Shader Model 6.0 or newer}} + // expected-note@#f4 {{'f4' has been marked as being introduced in Shader Model 6.0 here, but the deployment target is Shader Model 5.0}} + // expected-note@#f4_call {{enclose 'f4' in a __builtin_available check to silence this warning}} + unsigned D = f4(); // #f4_call + + unsigned E = f5(); + + // expected-warning@#f6_call {{'f6' is only available in compute shader environment on Shader Model 6.0 or newer}} + // expected-note@#f6 {{'f6' has been marked as being introduced in Shader Model 6.0 in compute shader environment here, but the deployment target is Shader Model 5.0}} + // expected-note@#f6_call {{enclose 'f6' in a __builtin_available check to silence this warning}} + unsigned F = f6(); // #f6_call + + // expected-warning@#f7_call {{'f7' is unavailable}} + // expected-note@#f7 {{'f7' has been marked as being introduced in Shader Model 6.0 in mesh shader environment here, but the deployment target is Shader Model 5.0 compute shader environment}} + // expected-note@#f7_call {{enclose 'f7' in a __builtin_available check to silence this warning}} + unsigned G = f7(); // #f7_call + + unsigned H = f8(); + + return 0; +} diff --git a/clang/test/SemaHLSL/Availability/attr-availability-errors.hlsl b/clang/test/SemaHLSL/Availability/attr-availability-errors.hlsl new file mode 100644 index 0000000..2682eb5 --- /dev/null +++ b/clang/test/SemaHLSL/Availability/attr-availability-errors.hlsl @@ -0,0 +1,11 @@ +// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.5-library -fsyntax-only -verify %s + + +void f1(void) __attribute__((availability(shadermodel, introduced = 6.0, environment="pixel"))); // expected-error {{expected an environment name, e.g., 'compute'}} + +void f2(void) __attribute__((availability(shadermodel, introduced = 6.0, environment=pixel, environment=compute))); // expected-error {{redundant 'environment' availability change; only the last specified change will be used}} + +void f3(void) __attribute__((availability(shadermodel, strict, introduced = 6.0, environment = mesh))); // expected-error {{unexpected parameter 'strict' in availability attribute, not permitted in HLSL}} + +int main() { +} diff --git a/clang/test/SemaHLSL/Availability/attr-availability-mesh.hlsl b/clang/test/SemaHLSL/Availability/attr-availability-mesh.hlsl new file mode 100644 index 0000000..40a7ddb --- /dev/null +++ b/clang/test/SemaHLSL/Availability/attr-availability-mesh.hlsl @@ -0,0 +1,73 @@ +// RUN: %clang_cc1 -triple dxil-pc-shadermodel5.0-mesh -fsyntax-only -verify %s + +// Platform shader model, no environment parameter +__attribute__((availability(shadermodel, introduced = 6.0))) +unsigned f1(); // #f1 + +__attribute__((availability(shadermodel, introduced = 5.1))) +unsigned f2(); // #f2 + +__attribute__((availability(shadermodel, introduced = 5.0))) +unsigned f3(); + +// Platform shader model, environment parameter restricting earlier version, +// available in all environments in higher versions +__attribute__((availability(shadermodel, introduced = 2.0, environment = pixel))) +__attribute__((availability(shadermodel, introduced = 6.0))) +unsigned f4(); // #f4 + +__attribute__((availability(shadermodel, introduced = 2.0, environment = pixel))) +__attribute__((availability(shadermodel, introduced = 5.0))) +unsigned f5(); // #f5 + +// Platform shader model, environment parameter restricting earlier version, +// never available in all environments in higher versions +__attribute__((availability(shadermodel, introduced = 2.0, environment = pixel))) +__attribute__((availability(shadermodel, introduced = 6.0, environment = compute))) +__attribute__((availability(shadermodel, introduced = 5.0, environment = mesh))) +unsigned f6(); // #f6 + +__attribute__((availability(shadermodel, introduced = 2.0, environment = pixel))) +__attribute__((availability(shadermodel, introduced = 6.0, environment = mesh))) +unsigned f7(); // #f7 + +__attribute__((availability(shadermodel, introduced = 2.0, environment = pixel))) +__attribute__((availability(shadermodel, introduced = 5.0, environment = compute))) +__attribute__((availability(shadermodel, introduced = 6.0, environment = mesh))) +unsigned f8(); // #f8 + +[numthreads(4,1,1)] +int main() { + // expected-warning@#f1_call {{'f1' is only available on Shader Model 6.0 or newer}} + // expected-note@#f1 {{'f1' has been marked as being introduced in Shader Model 6.0 here, but the deployment target is Shader Model 5.0}} + // expected-note@#f1_call {{enclose 'f1' in a __builtin_available check to silence this warning}} + unsigned A = f1(); // #f1_call + + // expected-warning@#f2_call {{'f2' is only available on Shader Model 5.1 or newer}} + // expected-note@#f2 {{'f2' has been marked as being introduced in Shader Model 5.1 here, but the deployment target is Shader Model 5.0}} + // expected-note@#f2_call {{enclose 'f2' in a __builtin_available check to silence this warning}} + unsigned B = f2(); // #f2_call + + unsigned C = f3(); + + // expected-warning@#f4_call {{'f4' is only available on Shader Model 6.0 or newer}} + // expected-note@#f4 {{'f4' has been marked as being introduced in Shader Model 6.0 here, but the deployment target is Shader Model 5.0}} + // expected-note@#f4_call {{enclose 'f4' in a __builtin_available check to silence this warning}} + unsigned D = f4(); // #f4_call + + unsigned E = f5(); // #f5_call + + unsigned F = f6(); // #f6_call + + // expected-warning@#f7_call {{'f7' is only available in mesh shader environment on Shader Model 6.0 or newer}} + // expected-note@#f7 {{'f7' has been marked as being introduced in Shader Model 6.0 in mesh shader environment here, but the deployment target is Shader Model 5.0 mesh shader environment}} + // expected-note@#f7_call {{enclose 'f7' in a __builtin_available check to silence this warning}} + unsigned G = f7(); // #f7_call + + // expected-warning@#f8_call {{'f8' is only available in mesh shader environment on Shader Model 6.0 or newer}} + // expected-note@#f8 {{'f8' has been marked as being introduced in Shader Model 6.0 in mesh shader environment here, but the deployment target is Shader Model 5.0 mesh shader environment}} + // expected-note@#f8_call {{enclose 'f8' in a __builtin_available check to silence this warning}} + unsigned H = f8(); // #f8_call + + return 0; +} diff --git a/clang/test/SemaHLSL/Availability/attr-availability-pixel.hlsl b/clang/test/SemaHLSL/Availability/attr-availability-pixel.hlsl new file mode 100644 index 0000000..59d09a9 --- /dev/null +++ b/clang/test/SemaHLSL/Availability/attr-availability-pixel.hlsl @@ -0,0 +1,63 @@ +// RUN: %clang_cc1 -triple dxil-pc-shadermodel5.0-pixel -fsyntax-only -verify %s + +// Platform shader model, no environment parameter +__attribute__((availability(shadermodel, introduced = 6.0))) +unsigned f1(); // #f1 + +__attribute__((availability(shadermodel, introduced = 5.1))) +unsigned f2(); // #f2 + +__attribute__((availability(shadermodel, introduced = 5.0))) +unsigned f3(); + +// Platform shader model, environment parameter restricting earlier version, +// available in all environments in higher versions +__attribute__((availability(shadermodel, introduced = 2.0, environment = pixel))) +__attribute__((availability(shadermodel, introduced = 6.0))) +unsigned f4(); // #f4 + +__attribute__((availability(shadermodel, introduced = 2.0, environment = pixel))) +__attribute__((availability(shadermodel, introduced = 5.0))) +unsigned f5(); + +// Platform shader model, environment parameter restricting earlier version, +// never available in all environments in higher versions +__attribute__((availability(shadermodel, introduced = 2.0, environment = pixel))) +__attribute__((availability(shadermodel, introduced = 6.0, environment = compute))) +__attribute__((availability(shadermodel, introduced = 5.0, environment = mesh))) +unsigned f6(); // #f6 + +__attribute__((availability(shadermodel, introduced = 2.0, environment = pixel))) +__attribute__((availability(shadermodel, introduced = 6.0, environment = mesh))) +unsigned f7(); // #f7 + +__attribute__((availability(shadermodel, introduced = 2.0, environment = pixel))) +__attribute__((availability(shadermodel, introduced = 5.0, environment = compute))) +__attribute__((availability(shadermodel, introduced = 6.0, environment = mesh))) +unsigned f8(); + +int main() { + // expected-warning@#f1_call {{'f1' is only available on Shader Model 6.0 or newer}} + // expected-note@#f1 {{'f1' has been marked as being introduced in Shader Model 6.0 here, but the deployment target is Shader Model 5.0}} + // expected-note@#f1_call {{enclose 'f1' in a __builtin_available check to silence this warning}} + unsigned A = f1(); // #f1_call + + // expected-warning@#f2_call {{'f2' is only available on Shader Model 5.1 or newer}} + // expected-note@#f2 {{'f2' has been marked as being introduced in Shader Model 5.1 here, but the deployment target is Shader Model 5.0}} + // expected-note@#f2_call {{enclose 'f2' in a __builtin_available check to silence this warning}} + unsigned B = f2(); // #f2_call + + unsigned C = f3(); + + unsigned D = f4(); // #f4_call + + unsigned E = f5(); + + unsigned F = f6(); // #f6_call + + unsigned G = f7(); // #f7_call + + unsigned H = f8(); + + return 0; +} diff --git a/clang/test/SemaHLSL/AvailabilityMarkup.hlsl b/clang/test/SemaHLSL/AvailabilityMarkup.hlsl deleted file mode 100644 index b883957..0000000 --- a/clang/test/SemaHLSL/AvailabilityMarkup.hlsl +++ /dev/null @@ -1,25 +0,0 @@ -// RUN: %clang_cc1 -triple dxil-pc-shadermodel5.0-library -verify %s - -__attribute__((availability(shadermodel, introduced = 6.0))) -unsigned fn6_0(); // #fn6_0 - -__attribute__((availability(shadermodel, introduced = 5.1))) -unsigned fn5_1(); // #fn5_1 - -__attribute__((availability(shadermodel, introduced = 5.0))) -unsigned fn5_0(); - -void fn() { - // expected-warning@#fn6_0_site {{'fn6_0' is only available on HLSL ShaderModel 6.0 or newer}} - // expected-note@#fn6_0 {{'fn6_0' has been marked as being introduced in HLSL ShaderModel 6.0 here, but the deployment target is HLSL ShaderModel 5.0}} - // expected-note@#fn6_0_site {{enclose 'fn6_0' in a __builtin_available check to silence this warning}} - unsigned A = fn6_0(); // #fn6_0_site - - // expected-warning@#fn5_1_site {{'fn5_1' is only available on HLSL ShaderModel 5.1 or newer}} - // expected-note@#fn5_1 {{'fn5_1' has been marked as being introduced in HLSL ShaderModel 5.1 here, but the deployment target is HLSL ShaderModel 5.0}} - // expected-note@#fn5_1_site {{enclose 'fn5_1' in a __builtin_available check to silence this warning}} - unsigned B = fn5_1(); // #fn5_1_site - - unsigned C = fn5_0(); -} - diff --git a/clang/test/SemaHLSL/WaveBuiltinAvailability.hlsl b/clang/test/SemaHLSL/WaveBuiltinAvailability.hlsl index 0e45edc..185b79b 100644 --- a/clang/test/SemaHLSL/WaveBuiltinAvailability.hlsl +++ b/clang/test/SemaHLSL/WaveBuiltinAvailability.hlsl @@ -2,8 +2,8 @@ // WaveActiveCountBits is unavailable before ShaderModel 6.0. unsigned foo(bool b) { - // expected-warning@#site {{'WaveActiveCountBits' is only available on HLSL ShaderModel 6.0 or newer}} - // expected-note@hlsl/hlsl_intrinsics.h:* {{'WaveActiveCountBits' has been marked as being introduced in HLSL ShaderModel 6.0 here, but the deployment target is HLSL ShaderModel 5.0}} + // expected-warning@#site {{'WaveActiveCountBits' is only available on Shader Model 6.0 or newer}} + // expected-note@hlsl/hlsl_intrinsics.h:* {{'WaveActiveCountBits' has been marked as being introduced in Shader Model 6.0 here, but the deployment target is Shader Model 5.0}} // expected-note@#site {{enclose 'WaveActiveCountBits' in a __builtin_available check to silence this warning}} return hlsl::WaveActiveCountBits(b); // #site } |