| 1 |
// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-compute \ |
| 2 |
// RUN: -fsyntax-only -verify %s |
| 3 |
|
| 4 |
__attribute__((availability(shadermodel, introduced = 6.5))) |
| 5 |
float fx(float); // #fx |
| 6 |
|
| 7 |
__attribute__((availability(shadermodel, introduced = 6.6))) |
| 8 |
half fx(half); // #fx_half |
| 9 |
|
| 10 |
__attribute__((availability(shadermodel, introduced = 5.0, environment = pixel))) |
| 11 |
__attribute__((availability(shadermodel, introduced = 6.5, environment = compute))) |
| 12 |
float fy(float); // #fy |
| 13 |
|
| 14 |
__attribute__((availability(shadermodel, introduced = 5.0, environment = pixel))) |
| 15 |
__attribute__((availability(shadermodel, introduced = 6.5, environment = mesh))) |
| 16 |
float fz(float); // #fz |
| 17 |
|
| 18 |
float also_alive(float f) { |
| 19 |
// expected-error@#also_alive_fx_call {{'fx' is only available on Shader Model 6.5 or newer}} |
| 20 |
// expected-note@#fx {{'fx' has been marked as being introduced in Shader Model 6.5 here, but the deployment target is Shader Model 6.0}} |
| 21 |
float A = fx(f); // #also_alive_fx_call |
| 22 |
// expected-error@#also_alive_fy_call {{'fy' is only available in compute environment on Shader Model 6.5 or newer}} |
| 23 |
// expected-note@#fy {{'fy' has been marked as being introduced in Shader Model 6.5 in compute environment here, but the deployment target is Shader Model 6.0 compute environment}} |
| 24 |
float B = fy(f); // #also_alive_fy_call |
| 25 |
// expected-error@#also_alive_fz_call {{'fz' is unavailable}} |
| 26 |
// expected-note@#fz {{'fz' has been marked as being introduced in Shader Model 6.5 in mesh environment here, but the deployment target is Shader Model 6.0 compute environment}} |
| 27 |
float C = fz(f); // #also_alive_fz_call |
| 28 |
return 0; |
| 29 |
} |
| 30 |
|
| 31 |
float alive(float f) { |
| 32 |
// expected-error@#alive_fx_call {{'fx' is only available on Shader Model 6.5 or newer}} |
| 33 |
// expected-note@#fx {{'fx' has been marked as being introduced in Shader Model 6.5 here, but the deployment target is Shader Model 6.0}} |
| 34 |
float A = fx(f); // #alive_fx_call |
| 35 |
// expected-error@#alive_fy_call {{'fy' is only available in compute environment on Shader Model 6.5 or newer}} |
| 36 |
// expected-note@#fy {{'fy' has been marked as being introduced in Shader Model 6.5 in compute environment here, but the deployment target is Shader Model 6.0 compute environment}} |
| 37 |
float B = fy(f); // #alive_fy_call |
| 38 |
// expected-error@#alive_fz_call {{'fz' is unavailable}} |
| 39 |
// expected-note@#fz {{'fz' has been marked as being introduced in Shader Model 6.5 in mesh environment here, but the deployment target is Shader Model 6.0 compute environment}} |
| 40 |
float C = fz(f); // #alive_fz_call |
| 41 |
|
| 42 |
return also_alive(f); |
| 43 |
} |
| 44 |
|
| 45 |
float also_dead(float f) { |
| 46 |
// unreachable code - no errors expected |
| 47 |
float A = fx(f); |
| 48 |
float B = fy(f); |
| 49 |
float C = fz(f); |
| 50 |
return 0; |
| 51 |
} |
| 52 |
|
| 53 |
float dead(float f) { |
| 54 |
// unreachable code - no errors expected |
| 55 |
float A = fx(f); |
| 56 |
float B = fy(f); |
| 57 |
float C = fz(f); |
| 58 |
|
| 59 |
return also_dead(f); |
| 60 |
} |
| 61 |
|
| 62 |
template<typename T> |
| 63 |
T aliveTemp(T f) { |
| 64 |
// expected-error@#aliveTemp_fx_call {{'fx' is only available on Shader Model 6.5 or newer}} |
| 65 |
// expected-note@#fx {{'fx' has been marked as being introduced in Shader Model 6.5 here, but the deployment target is Shader Model 6.0}} |
| 66 |
float A = fx(f); // #aliveTemp_fx_call |
| 67 |
// expected-error@#aliveTemp_fy_call {{'fy' is only available in compute environment on Shader Model 6.5 or newer}} |
| 68 |
// expected-note@#fy {{'fy' has been marked as being introduced in Shader Model 6.5 in compute environment here, but the deployment target is Shader Model 6.0 compute environment}} |
| 69 |
float B = fy(f); // #aliveTemp_fy_call |
| 70 |
// expected-error@#aliveTemp_fz_call {{'fz' is unavailable}} |
| 71 |
// expected-note@#fz {{'fz' has been marked as being introduced in Shader Model 6.5 in mesh environment here, but the deployment target is Shader Model 6.0 compute environment}} |
| 72 |
float C = fz(f); // #aliveTemp_fz_call |
| 73 |
return 0; |
| 74 |
} |
| 75 |
|
| 76 |
template<typename T> T aliveTemp2(T f) { |
| 77 |
// expected-error@#aliveTemp2_fx_call {{'fx' is only available on Shader Model 6.6 or newer}} |
| 78 |
// expected-note@#fx_half {{'fx' has been marked as being introduced in Shader Model 6.6 here, but the deployment target is Shader Model 6.0}} |
| 79 |
// expected-error@#aliveTemp2_fx_call {{'fx' is only available on Shader Model 6.5 or newer}} |
| 80 |
// expected-note@#fx {{'fx' has been marked as being introduced in Shader Model 6.5 here, but the deployment target is Shader Model 6.0}} |
| 81 |
return fx(f); // #aliveTemp2_fx_call |
| 82 |
} |
| 83 |
|
| 84 |
half test(half x) { |
| 85 |
return aliveTemp2(x); |
| 86 |
} |
| 87 |
|
| 88 |
float test(float x) { |
| 89 |
return aliveTemp2(x); |
| 90 |
} |
| 91 |
|
| 92 |
class MyClass |
| 93 |
{ |
| 94 |
float F; |
| 95 |
float makeF() { |
| 96 |
// expected-error@#MyClass_makeF_fx_call {{'fx' is only available on Shader Model 6.5 or newer}} |
| 97 |
// expected-note@#fx {{'fx' has been marked as being introduced in Shader Model 6.5 here, but the deployment target is Shader Model 6.0}} |
| 98 |
float A = fx(F); // #MyClass_makeF_fx_call |
| 99 |
// expected-error@#MyClass_makeF_fy_call {{'fy' is only available in compute environment on Shader Model 6.5 or newer}} |
| 100 |
// expected-note@#fy {{'fy' has been marked as being introduced in Shader Model 6.5 in compute environment here, but the deployment target is Shader Model 6.0 compute environment}} |
| 101 |
float B = fy(F); // #MyClass_makeF_fy_call |
| 102 |
// expected-error@#MyClass_makeF_fz_call {{'fz' is unavailable}} |
| 103 |
// expected-note@#fz {{'fz' has been marked as being introduced in Shader Model 6.5 in mesh environment here, but the deployment target is Shader Model 6.0 compute environment}} |
| 104 |
float C = fz(F); // #MyClass_makeF_fz_call |
| 105 |
return 0; |
| 106 |
} |
| 107 |
}; |
| 108 |
|
| 109 |
[numthreads(4,1,1)] |
| 110 |
void main() { |
| 111 |
float f = 3; |
| 112 |
MyClass C = { 1.0f }; |
| 113 |
float a = alive(f); |
| 114 |
float b = aliveTemp<float>(f); // #aliveTemp_inst |
| 115 |
float c = C.makeF(); |
| 116 |
float d = test((float)1.0); |
| 117 |
float e = test((half)1.0); |
| 118 |
} |