| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,119 +1,119 @@ | ||
| // RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-compute \ | ||
| // RUN: -fsyntax-only -verify %s | ||
|
|
||
| __attribute__((availability(shadermodel, introduced = 6.5))) | ||
| float fx(float); // #fx | ||
|
|
||
| __attribute__((availability(shadermodel, introduced = 6.6))) | ||
| half fx(half); // #fx_half | ||
|
|
||
| __attribute__((availability(shadermodel, introduced = 5.0, environment = pixel))) | ||
| __attribute__((availability(shadermodel, introduced = 6.5, environment = compute))) | ||
| float fy(float); // #fy | ||
|
|
||
| __attribute__((availability(shadermodel, introduced = 5.0, environment = pixel))) | ||
| __attribute__((availability(shadermodel, introduced = 6.5, environment = mesh))) | ||
| float fz(float); // #fz | ||
|
|
||
| float also_alive(float f) { | ||
| // expected-error@#also_alive_fx_call {{'fx' is only available on Shader Model 6.5 or newer}} | ||
| // 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}} | ||
| float A = fx(f); // #also_alive_fx_call | ||
| // expected-error@#also_alive_fy_call {{'fy' is only available in compute environment on Shader Model 6.5 or newer}} | ||
| // 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}} | ||
| float B = fy(f); // #also_alive_fy_call | ||
| // expected-error@#also_alive_fz_call {{'fz' is unavailable}} | ||
| // 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}} | ||
| float C = fz(f); // #also_alive_fz_call | ||
| return 0; | ||
| } | ||
|
|
||
| float alive(float f) { | ||
| // expected-error@#alive_fx_call {{'fx' is only available on Shader Model 6.5 or newer}} | ||
| // 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}} | ||
| float A = fx(f); // #alive_fx_call | ||
| // expected-error@#alive_fy_call {{'fy' is only available in compute environment on Shader Model 6.5 or newer}} | ||
| // 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}} | ||
| float B = fy(f); // #alive_fy_call | ||
| // expected-error@#alive_fz_call {{'fz' is unavailable}} | ||
| // 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}} | ||
| float C = fz(f); // #alive_fz_call | ||
|
|
||
| return also_alive(f); | ||
| } | ||
|
|
||
| float also_dead(float f) { | ||
| // unreachable code - no errors expected | ||
| float A = fx(f); | ||
| float B = fy(f); | ||
| float C = fz(f); | ||
| return 0; | ||
| } | ||
|
|
||
| float dead(float f) { | ||
| // unreachable code - no errors expected | ||
| float A = fx(f); | ||
| float B = fy(f); | ||
| float C = fz(f); | ||
|
|
||
| return also_dead(f); | ||
| } | ||
|
|
||
| template<typename T> | ||
| T aliveTemp(T f) { | ||
| // expected-error@#aliveTemp_fx_call {{'fx' is only available on Shader Model 6.5 or newer}} | ||
| // 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}} | ||
| float A = fx(f); // #aliveTemp_fx_call | ||
| // expected-error@#aliveTemp_fy_call {{'fy' is only available in compute environment on Shader Model 6.5 or newer}} | ||
| // 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}} | ||
| float B = fy(f); // #aliveTemp_fy_call | ||
| // expected-error@#aliveTemp_fz_call {{'fz' is unavailable}} | ||
| // 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}} | ||
| float C = fz(f); // #aliveTemp_fz_call | ||
| return 0; | ||
| } | ||
|
|
||
| template<typename T> T aliveTemp2(T f) { | ||
| // expected-error@#aliveTemp2_fx_call {{'fx' is only available on Shader Model 6.6 or newer}} | ||
| // 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}} | ||
| // expected-error@#aliveTemp2_fx_call {{'fx' is only available on Shader Model 6.5 or newer}} | ||
| // 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}} | ||
| return fx(f); // #aliveTemp2_fx_call | ||
| } | ||
|
|
||
| half test(half x) { | ||
| return aliveTemp2(x); | ||
| } | ||
|
|
||
| float test(float x) { | ||
| return aliveTemp2(x); | ||
| } | ||
|
|
||
| class MyClass | ||
| { | ||
| float F; | ||
| float makeF() { | ||
| // expected-error@#MyClass_makeF_fx_call {{'fx' is only available on Shader Model 6.5 or newer}} | ||
| // 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}} | ||
| float A = fx(F); // #MyClass_makeF_fx_call | ||
| // expected-error@#MyClass_makeF_fy_call {{'fy' is only available in compute environment on Shader Model 6.5 or newer}} | ||
| // 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}} | ||
| float B = fy(F); // #MyClass_makeF_fy_call | ||
| // expected-error@#MyClass_makeF_fz_call {{'fz' is unavailable}} | ||
| // 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}} | ||
| float C = fz(F); // #MyClass_makeF_fz_call | ||
| return 0; | ||
| } | ||
| }; | ||
|
|
||
| [numthreads(4,1,1)] | ||
| float main() { | ||
| float f = 3; | ||
| MyClass C = { 1.0f }; | ||
| float a = alive(f); | ||
| float b = aliveTemp<float>(f); // #aliveTemp_inst | ||
| float c = C.makeF(); | ||
| float d = test((float)1.0); | ||
| float e = test((half)1.0); | ||
| return a * b * c; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,119 +1,119 @@ | ||
| // RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-compute \ | ||
| // RUN: -fsyntax-only -Wno-error=hlsl-availability -verify %s | ||
|
|
||
| __attribute__((availability(shadermodel, introduced = 6.5))) | ||
| float fx(float); // #fx | ||
|
|
||
| __attribute__((availability(shadermodel, introduced = 6.6))) | ||
| half fx(half); // #fx_half | ||
|
|
||
| __attribute__((availability(shadermodel, introduced = 5.0, environment = pixel))) | ||
| __attribute__((availability(shadermodel, introduced = 6.5, environment = compute))) | ||
| float fy(float); // #fy | ||
|
|
||
| __attribute__((availability(shadermodel, introduced = 5.0, environment = pixel))) | ||
| __attribute__((availability(shadermodel, introduced = 6.5, environment = mesh))) | ||
| float fz(float); // #fz | ||
|
|
||
| float also_alive(float f) { | ||
| // expected-warning@#also_alive_fx_call {{'fx' is only available on Shader Model 6.5 or newer}} | ||
| // 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}} | ||
| float A = fx(f); // #also_alive_fx_call | ||
| // expected-warning@#also_alive_fy_call {{'fy' is only available in compute environment on Shader Model 6.5 or newer}} | ||
| // 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}} | ||
| float B = fy(f); // #also_alive_fy_call | ||
| // expected-warning@#also_alive_fz_call {{'fz' is unavailable}} | ||
| // 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}} | ||
| float C = fz(f); // #also_alive_fz_call | ||
| return 0; | ||
| } | ||
|
|
||
| float alive(float f) { | ||
| // expected-warning@#alive_fx_call {{'fx' is only available on Shader Model 6.5 or newer}} | ||
| // 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}} | ||
| float A = fx(f); // #alive_fx_call | ||
| // expected-warning@#alive_fy_call {{'fy' is only available in compute environment on Shader Model 6.5 or newer}} | ||
| // 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}} | ||
| float B = fy(f); // #alive_fy_call | ||
| // expected-warning@#alive_fz_call {{'fz' is unavailable}} | ||
| // 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}} | ||
| float C = fz(f); // #alive_fz_call | ||
|
|
||
| return also_alive(f); | ||
| } | ||
|
|
||
| float also_dead(float f) { | ||
| // unreachable code - no errors expected | ||
| float A = fx(f); | ||
| float B = fy(f); | ||
| float C = fz(f); | ||
| return 0; | ||
| } | ||
|
|
||
| float dead(float f) { | ||
| // unreachable code - no errors expected | ||
| float A = fx(f); | ||
| float B = fy(f); | ||
| float C = fz(f); | ||
|
|
||
| return also_dead(f); | ||
| } | ||
|
|
||
| template<typename T> | ||
| T aliveTemp(T f) { | ||
| // expected-warning@#aliveTemp_fx_call {{'fx' is only available on Shader Model 6.5 or newer}} | ||
| // 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}} | ||
| float A = fx(f); // #aliveTemp_fx_call | ||
| // expected-warning@#aliveTemp_fy_call {{'fy' is only available in compute environment on Shader Model 6.5 or newer}} | ||
| // 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}} | ||
| float B = fy(f); // #aliveTemp_fy_call | ||
| // expected-warning@#aliveTemp_fz_call {{'fz' is unavailable}} | ||
| // 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}} | ||
| float C = fz(f); // #aliveTemp_fz_call | ||
| return 0; | ||
| } | ||
|
|
||
| template<typename T> T aliveTemp2(T f) { | ||
| // expected-warning@#aliveTemp2_fx_call {{'fx' is only available on Shader Model 6.6 or newer}} | ||
| // 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}} | ||
| // expected-warning@#aliveTemp2_fx_call {{'fx' is only available on Shader Model 6.5 or newer}} | ||
| // 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}} | ||
| return fx(f); // #aliveTemp2_fx_call | ||
| } | ||
|
|
||
| half test(half x) { | ||
| return aliveTemp2(x); | ||
| } | ||
|
|
||
| float test(float x) { | ||
| return aliveTemp2(x); | ||
| } | ||
|
|
||
| class MyClass | ||
| { | ||
| float F; | ||
| float makeF() { | ||
| // expected-warning@#MyClass_makeF_fx_call {{'fx' is only available on Shader Model 6.5 or newer}} | ||
| // 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}} | ||
| float A = fx(F); // #MyClass_makeF_fx_call | ||
| // expected-warning@#MyClass_makeF_fy_call {{'fy' is only available in compute environment on Shader Model 6.5 or newer}} | ||
| // 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}} | ||
| float B = fy(F); // #MyClass_makeF_fy_call | ||
| // expected-warning@#MyClass_makeF_fz_call {{'fz' is unavailable}} | ||
| // 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}} | ||
| float C = fz(F); // #MyClass_makeF_fz_call | ||
| return 0; | ||
| } | ||
| }; | ||
|
|
||
| [numthreads(4,1,1)] | ||
| float main() { | ||
| float f = 3; | ||
| MyClass C = { 1.0f }; | ||
| float a = alive(f); | ||
| float b = aliveTemp<float>(f); // #aliveTemp_inst | ||
| float c = C.makeF(); | ||
| float d = test((float)1.0); | ||
| float e = test((half)1.0); | ||
| return a * b * c; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,129 +1,129 @@ | ||
| // RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-compute \ | ||
| // RUN: -fhlsl-strict-availability -fsyntax-only -verify %s | ||
|
|
||
| __attribute__((availability(shadermodel, introduced = 6.5))) | ||
| float fx(float); // #fx | ||
|
|
||
| __attribute__((availability(shadermodel, introduced = 6.6))) | ||
| half fx(half); // #fx_half | ||
|
|
||
| __attribute__((availability(shadermodel, introduced = 5.0, environment = pixel))) | ||
| __attribute__((availability(shadermodel, introduced = 6.5, environment = compute))) | ||
| float fy(float); // #fy | ||
|
|
||
| __attribute__((availability(shadermodel, introduced = 5.0, environment = pixel))) | ||
| __attribute__((availability(shadermodel, introduced = 6.5, environment = mesh))) | ||
| float fz(float); // #fz | ||
|
|
||
| float also_alive(float f) { | ||
| // expected-error@#also_alive_fx_call {{'fx' is only available on Shader Model 6.5 or newer}} | ||
| // 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}} | ||
| float A = fx(f); // #also_alive_fx_call | ||
| // expected-error@#also_alive_fy_call {{'fy' is only available in compute environment on Shader Model 6.5 or newer}} | ||
| // 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}} | ||
| float B = fy(f); // #also_alive_fy_call | ||
| // expected-error@#also_alive_fz_call {{'fz' is unavailable}} | ||
| // 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}} | ||
| float C = fz(f); // #also_alive_fz_call | ||
| return 0; | ||
| } | ||
|
|
||
| float alive(float f) { | ||
| // expected-error@#alive_fx_call {{'fx' is only available on Shader Model 6.5 or newer}} | ||
| // 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}} | ||
| float A = fx(f); // #alive_fx_call | ||
| // expected-error@#alive_fy_call {{'fy' is only available in compute environment on Shader Model 6.5 or newer}} | ||
| // 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}} | ||
| float B = fy(f); // #alive_fy_call | ||
| // expected-error@#alive_fz_call {{'fz' is unavailable}} | ||
| // 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}} | ||
| float C = fz(f); // #alive_fz_call | ||
|
|
||
| return also_alive(f); | ||
| } | ||
|
|
||
| float also_dead(float f) { | ||
| // expected-error@#also_dead_fx_call {{'fx' is only available on Shader Model 6.5 or newer}} | ||
| // 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}} | ||
| float A = fx(f); // #also_dead_fx_call | ||
| // expected-error@#also_dead_fy_call {{'fy' is only available in compute environment on Shader Model 6.5 or newer}} | ||
| // 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}} | ||
| float B = fy(f); // #also_dead_fy_call | ||
| // expected-error@#also_dead_fz_call {{'fz' is unavailable}} | ||
| // 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}} | ||
| float C = fz(f); // #also_dead_fz_call | ||
| return 0; | ||
| } | ||
|
|
||
| float dead(float f) { | ||
| // expected-error@#dead_fx_call {{'fx' is only available on Shader Model 6.5 or newer}} | ||
| // 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}} | ||
| float A = fx(f); // #dead_fx_call | ||
| // expected-error@#dead_fy_call {{'fy' is only available in compute environment on Shader Model 6.5 or newer}} | ||
| // 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}} | ||
| float B = fy(f); // #dead_fy_call | ||
| // expected-error@#dead_fz_call {{'fz' is unavailable}} | ||
| // 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}} | ||
| float C = fz(f); // #dead_fz_call | ||
|
|
||
| return also_dead(f); | ||
| } | ||
|
|
||
| template<typename T> | ||
| T aliveTemp(T f) { | ||
| // expected-error@#aliveTemp_fx_call {{'fx' is only available on Shader Model 6.5 or newer}} | ||
| // expected-note@#aliveTemp_inst {{in instantiation of function template specialization 'aliveTemp<float>' requested here}} | ||
| // 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}} | ||
| float A = fx(f); // #aliveTemp_fx_call | ||
| // expected-error@#aliveTemp_fy_call {{'fy' is only available in compute environment on Shader Model 6.5 or newer}} | ||
| // 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}} | ||
| float B = fy(f); // #aliveTemp_fy_call | ||
| // expected-error@#aliveTemp_fz_call {{'fz' is unavailable}} | ||
| // 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}} | ||
| float C = fz(f); // #aliveTemp_fz_call | ||
| return 0; | ||
| } | ||
|
|
||
| template<typename T> T aliveTemp2(T f) { | ||
| // expected-error@#aliveTemp2_fx_call {{'fx' is only available on Shader Model 6.6 or newer}} | ||
| // 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}} | ||
| // expected-error@#aliveTemp2_fx_call {{'fx' is only available on Shader Model 6.5 or newer}} | ||
| // 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}} | ||
| return fx(f); // #aliveTemp2_fx_call | ||
| } | ||
|
|
||
| half test(half x) { | ||
| return aliveTemp2(x); // expected-note {{in instantiation of function template specialization 'aliveTemp2<half>' requested here}} | ||
| } | ||
|
|
||
| float test(float x) { | ||
| return aliveTemp2(x); // expected-note {{in instantiation of function template specialization 'aliveTemp2<float>' requested here}} | ||
| } | ||
|
|
||
| class MyClass | ||
| { | ||
| float F; | ||
| float makeF() { | ||
| // expected-error@#MyClass_makeF_fx_call {{'fx' is only available on Shader Model 6.5 or newer}} | ||
| // 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}} | ||
| float A = fx(F); // #MyClass_makeF_fx_call | ||
| // expected-error@#MyClass_makeF_fy_call {{'fy' is only available in compute environment on Shader Model 6.5 or newer}} | ||
| // 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}} | ||
| float B = fy(F); // #MyClass_makeF_fy_call | ||
| // expected-error@#MyClass_makeF_fz_call {{'fz' is unavailable}} | ||
| // 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}} | ||
| float C = fz(F); // #MyClass_makeF_fz_call | ||
| } | ||
| }; | ||
|
|
||
| [numthreads(4,1,1)] | ||
| float main() { | ||
| float f = 3; | ||
| MyClass C = { 1.0f }; | ||
| float a = alive(f); | ||
| float b = aliveTemp<float>(f); // #aliveTemp_inst | ||
| float c = C.makeF(); | ||
| float d = test((float)1.0); | ||
| float e = test((half)1.0); | ||
| return a * b * c; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,57 +1,57 @@ | ||
| // RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-library \ | ||
| // RUN: -fsyntax-only -verify %s | ||
|
|
||
| __attribute__((availability(shadermodel, introduced = 6.5))) | ||
| float fx(float); // #fx | ||
|
|
||
| __attribute__((availability(shadermodel, introduced = 5.0, environment = pixel))) | ||
| __attribute__((availability(shadermodel, introduced = 6.5, environment = compute))) | ||
| float fy(float); // #fy | ||
|
|
||
| __attribute__((availability(shadermodel, introduced = 5.0, environment = compute))) | ||
| float fz(float); // #fz | ||
|
|
||
|
|
||
| void F(float f) { | ||
| // Make sure we only get this error once, even though this function is scanned twice - once | ||
| // in compute shader context and once in pixel shader context. | ||
| // expected-error@#fx_call {{'fx' is only available on Shader Model 6.5 or newer}} | ||
| // 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}} | ||
| float A = fx(f); // #fx_call | ||
|
|
||
| // expected-error@#fy_call {{'fy' is only available in compute environment on Shader Model 6.5 or newer}} | ||
| // 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}} | ||
| float B = fy(f); // #fy_call | ||
|
|
||
| // expected-error@#fz_call {{'fz' is unavailable}} | ||
| // expected-note@#fz {{'fz' has been marked as being introduced in Shader Model 5.0 in compute environment here, but the deployment target is Shader Model 6.0 pixel environment}} | ||
| float X = fz(f); // #fz_call | ||
| } | ||
|
|
||
| void deadCode(float f) { | ||
| // no diagnostics expected under default diagnostic mode | ||
| float A = fx(f); | ||
| float B = fy(f); | ||
| float X = fz(f); | ||
| } | ||
|
|
||
| // Pixel shader | ||
| [shader("pixel")] | ||
| void mainPixel() { | ||
| F(1.0); | ||
| } | ||
|
|
||
| // First Compute shader | ||
| [shader("compute")] | ||
| [numthreads(4,1,1)] | ||
| void mainCompute1() { | ||
| F(2.0); | ||
| } | ||
|
|
||
| // Second compute shader to make sure we do not get duplicate messages if F is called | ||
| // from multiple entry points. | ||
| [shader("compute")] | ||
| [numthreads(4,1,1)] | ||
| void mainCompute2() { | ||
| F(3.0); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,19 +1,19 @@ | ||
| // RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-compute -x hlsl -fsyntax-only -verify %s | ||
|
|
||
| typedef vector<float, 3> float3; | ||
|
|
||
| StructuredBuffer<float3> Buffer; | ||
|
|
||
| // expected-error@+2 {{class template 'StructuredBuffer' requires template arguments}} | ||
| // expected-note@*:* {{template declaration from hidden source: template <class element_type> class StructuredBuffer}} | ||
| StructuredBuffer BufferErr1; | ||
|
|
||
| // expected-error@+2 {{too few template arguments for class template 'StructuredBuffer'}} | ||
| // expected-note@*:* {{template declaration from hidden source: template <class element_type> class StructuredBuffer}} | ||
| StructuredBuffer<> BufferErr2; | ||
|
|
||
| [numthreads(1,1,1)] | ||
| void main() { | ||
| (void)Buffer.h; // expected-error {{'h' is a private member of 'hlsl::StructuredBuffer<vector<float, 3>>'}} | ||
| // expected-note@* {{implicitly declared private here}} | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,43 +1,43 @@ | ||
| // RUN: %clang_cc1 -finclude-default-header -triple dxil-pc-shadermodel6.6-library %s -fnative-half-type -disable-llvm-passes -verify | ||
|
|
||
| void test_too_few_arg() | ||
| { | ||
| return __builtin_hlsl_cross(); | ||
| // expected-error@-1 {{too few arguments to function call, expected 2, have 0}} | ||
| } | ||
|
|
||
| void test_too_many_arg(float3 p0) | ||
| { | ||
| return __builtin_hlsl_cross(p0, p0, p0); | ||
| // expected-error@-1 {{too many arguments to function call, expected 2, have 3}} | ||
| } | ||
|
|
||
| bool builtin_bool_to_float_type_promotion(bool p1) | ||
| { | ||
| return __builtin_hlsl_cross(p1, p1); | ||
| // expected-error@-1 {{passing 'bool' to parameter of incompatible type 'float'}} | ||
| } | ||
|
|
||
| bool builtin_cross_int_to_float_promotion(int p1) | ||
| { | ||
| return __builtin_hlsl_cross(p1, p1); | ||
| // expected-error@-1 {{passing 'int' to parameter of incompatible type 'float'}} | ||
| } | ||
|
|
||
| bool2 builtin_cross_int2_to_float2_promotion(int2 p1) | ||
| { | ||
| return __builtin_hlsl_cross(p1, p1); | ||
| // expected-error@-1 {{passing 'int2' (aka 'vector<int, 2>') to parameter of incompatible type '__attribute__((__vector_size__(2 * sizeof(float)))) float' (vector of 2 'float' values)}} | ||
| } | ||
|
|
||
| float2 builtin_cross_float2(float2 p1, float2 p2) | ||
| { | ||
| return __builtin_hlsl_cross(p1, p2); | ||
| // expected-error@-1 {{too many elements in vector operand (expected 3 elements, have 2)}} | ||
| } | ||
|
|
||
| float3 builtin_cross_float3_int3(float3 p1, int3 p2) | ||
| { | ||
| return __builtin_hlsl_cross(p1, p2); | ||
| // expected-error@-1 {{all arguments to '__builtin_hlsl_cross' must have the same type}} | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,13 +1,13 @@ | ||
| // RUN: %clang_cc1 -finclude-default-header -triple dxil-pc-shadermodel6.6-library %s -fnative-half-type -emit-llvm-only -disable-llvm-passes -verify -DTEST_FUNC=__builtin_elementwise_atan2 | ||
| // RUN: %clang_cc1 -finclude-default-header -triple dxil-pc-shadermodel6.6-library %s -fnative-half-type -emit-llvm-only -disable-llvm-passes -verify -DTEST_FUNC=__builtin_elementwise_fmod | ||
| // RUN: %clang_cc1 -finclude-default-header -triple dxil-pc-shadermodel6.6-library %s -fnative-half-type -emit-llvm-only -disable-llvm-passes -verify -DTEST_FUNC=__builtin_elementwise_pow | ||
|
|
||
| double test_double_builtin(double p0, double p1) { | ||
| return TEST_FUNC(p0, p1); | ||
| // expected-error@-1 {{passing 'double' to parameter of incompatible type 'float'}} | ||
| } | ||
|
|
||
| double2 test_vec_double_builtin(double2 p0, double2 p1) { | ||
| return TEST_FUNC(p0, p1); | ||
| // expected-error@-1 {{passing 'double2' (aka 'vector<double, 2>') to parameter of incompatible type '__attribute__((__vector_size__(2 * sizeof(float)))) float' (vector of 2 'float' values)}} | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,32 +1,32 @@ | ||
| // RUN: %clang_cc1 -finclude-default-header -triple dxil-pc-shadermodel6.6-library %s -fnative-half-type -disable-llvm-passes -verify -verify-ignore-unexpected | ||
|
|
||
|
|
||
| void test_too_few_arg() | ||
| { | ||
| return __builtin_hlsl_length(); | ||
| // expected-error@-1 {{too few arguments to function call, expected 1, have 0}} | ||
| } | ||
|
|
||
| void test_too_many_arg(float2 p0) | ||
| { | ||
| return __builtin_hlsl_length(p0, p0); | ||
| // expected-error@-1 {{too many arguments to function call, expected 1, have 2}} | ||
| } | ||
|
|
||
| bool builtin_bool_to_float_type_promotion(bool p1) | ||
| { | ||
| return __builtin_hlsl_length(p1); | ||
| // expected-error@-1 {passing 'bool' to parameter of incompatible type 'float'}} | ||
| } | ||
|
|
||
| bool builtin_length_int_to_float_promotion(int p1) | ||
| { | ||
| return __builtin_hlsl_length(p1); | ||
| // expected-error@-1 {{passing 'int' to parameter of incompatible type 'float'}} | ||
| } | ||
|
|
||
| bool2 builtin_length_int2_to_float2_promotion(int2 p1) | ||
| { | ||
| return __builtin_hlsl_length(p1); | ||
| // expected-error@-1 {{passing 'int2' (aka 'vector<int, 2>') to parameter of incompatible type '__attribute__((__vector_size__(2 * sizeof(float)))) float' (vector of 2 'float' values)}} | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,31 +1,31 @@ | ||
| // RUN: %clang_cc1 -finclude-default-header -triple dxil-pc-shadermodel6.6-library %s -fnative-half-type -disable-llvm-passes -verify -verify-ignore-unexpected | ||
|
|
||
| void test_too_few_arg() | ||
| { | ||
| return __builtin_hlsl_normalize(); | ||
| // expected-error@-1 {{too few arguments to function call, expected 1, have 0}} | ||
| } | ||
|
|
||
| void test_too_many_arg(float2 p0) | ||
| { | ||
| return __builtin_hlsl_normalize(p0, p0); | ||
| // expected-error@-1 {{too many arguments to function call, expected 1, have 2}} | ||
| } | ||
|
|
||
| bool builtin_bool_to_float_type_promotion(bool p1) | ||
| { | ||
| return __builtin_hlsl_normalize(p1); | ||
| // expected-error@-1 {passing 'bool' to parameter of incompatible type 'float'}} | ||
| } | ||
|
|
||
| bool builtin_normalize_int_to_float_promotion(int p1) | ||
| { | ||
| return __builtin_hlsl_normalize(p1); | ||
| // expected-error@-1 {{passing 'int' to parameter of incompatible type 'float'}} | ||
| } | ||
|
|
||
| bool2 builtin_normalize_int2_to_float2_promotion(int2 p1) | ||
| { | ||
| return __builtin_hlsl_normalize(p1); | ||
| // expected-error@-1 {{passing 'int2' (aka 'vector<int, 2>') to parameter of incompatible type '__attribute__((__vector_size__(2 * sizeof(float)))) float' (vector of 2 'float' values)}} | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,31 +1,31 @@ | ||
| // RUN: %clang_cc1 -finclude-default-header -triple dxil-pc-shadermodel6.6-library %s -fnative-half-type -disable-llvm-passes -verify -verify-ignore-unexpected | ||
|
|
||
| void test_too_few_arg() | ||
| { | ||
| return __builtin_hlsl_step(); | ||
| // expected-error@-1 {{too few arguments to function call, expected 2, have 0}} | ||
| } | ||
|
|
||
| void test_too_many_arg(float2 p0) | ||
| { | ||
| return __builtin_hlsl_step(p0, p0, p0); | ||
| // expected-error@-1 {{too many arguments to function call, expected 2, have 3}} | ||
| } | ||
|
|
||
| bool builtin_bool_to_float_type_promotion(bool p1) | ||
| { | ||
| return __builtin_hlsl_step(p1, p1); | ||
| // expected-error@-1 {passing 'bool' to parameter of incompatible type 'float'}} | ||
| } | ||
|
|
||
| bool builtin_step_int_to_float_promotion(int p1) | ||
| { | ||
| return __builtin_hlsl_step(p1, p1); | ||
| // expected-error@-1 {{passing 'int' to parameter of incompatible type 'float'}} | ||
| } | ||
|
|
||
| bool2 builtin_step_int2_to_float2_promotion(int2 p1) | ||
| { | ||
| return __builtin_hlsl_step(p1, p1); | ||
| // expected-error@-1 {{passing 'int2' (aka 'vector<int, 2>') to parameter of incompatible type '__attribute__((__vector_size__(2 * sizeof(float)))) float' (vector of 2 'float' values)}} | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,81 +1,81 @@ | ||
| // RUN: %clang_cc1 -triple dxil-pc-shadermodel6.6-library -finclude-default-header -verify %s | ||
| // RUN: %clang_cc1 -triple dxil-pc-shadermodel6.6-library -finclude-default-header -fnative-half-type -verify %s | ||
| // expected-no-diagnostics | ||
|
|
||
| _Static_assert(__builtin_hlsl_is_intangible(__hlsl_resource_t), ""); | ||
| // no need to check array of __hlsl_resource_t, arrays of sizeless types are not supported | ||
|
|
||
| _Static_assert(!__builtin_hlsl_is_intangible(int), ""); | ||
| _Static_assert(!__builtin_hlsl_is_intangible(float3), ""); | ||
| _Static_assert(!__builtin_hlsl_is_intangible(half[4]), ""); | ||
|
|
||
| typedef __hlsl_resource_t Res; | ||
| _Static_assert(__builtin_hlsl_is_intangible(const Res), ""); | ||
| // no need to check array of Res, arrays of sizeless types are not supported | ||
|
|
||
| struct ABuffer { | ||
| const int i[10]; | ||
| __hlsl_resource_t h; | ||
| }; | ||
| _Static_assert(__builtin_hlsl_is_intangible(ABuffer), ""); | ||
| _Static_assert(__builtin_hlsl_is_intangible(ABuffer[10]), ""); | ||
|
|
||
| struct MyStruct { | ||
| half2 h2; | ||
| int3 i3; | ||
| }; | ||
| _Static_assert(!__builtin_hlsl_is_intangible(MyStruct), ""); | ||
| _Static_assert(!__builtin_hlsl_is_intangible(MyStruct[10]), ""); | ||
|
|
||
| class MyClass { | ||
| int3 ivec; | ||
| float farray[12]; | ||
| MyStruct ms; | ||
| ABuffer buf; | ||
| }; | ||
| _Static_assert(__builtin_hlsl_is_intangible(MyClass), ""); | ||
| _Static_assert(__builtin_hlsl_is_intangible(MyClass[2]), ""); | ||
|
|
||
| union U { | ||
| double d[4]; | ||
| Res buf; | ||
| }; | ||
| _Static_assert(__builtin_hlsl_is_intangible(U), ""); | ||
| _Static_assert(__builtin_hlsl_is_intangible(U[100]), ""); | ||
|
|
||
| class MyClass2 { | ||
| int3 ivec; | ||
| float farray[12]; | ||
| U u; | ||
| }; | ||
| _Static_assert(__builtin_hlsl_is_intangible(MyClass2), ""); | ||
| _Static_assert(__builtin_hlsl_is_intangible(MyClass2[5]), ""); | ||
|
|
||
| class Simple { | ||
| int a; | ||
| }; | ||
|
|
||
| template<typename T> struct TemplatedBuffer { | ||
| T a; | ||
| __hlsl_resource_t h; | ||
| }; | ||
| _Static_assert(__builtin_hlsl_is_intangible(TemplatedBuffer<int>), ""); | ||
|
|
||
| struct MyStruct2 : TemplatedBuffer<float> { | ||
| float x; | ||
| }; | ||
| _Static_assert(__builtin_hlsl_is_intangible(MyStruct2), ""); | ||
|
|
||
| struct MyStruct3 { | ||
| const TemplatedBuffer<float> TB[10]; | ||
| }; | ||
| _Static_assert(__builtin_hlsl_is_intangible(MyStruct3), ""); | ||
|
|
||
| template<typename T> struct SimpleTemplate { | ||
| T a; | ||
| }; | ||
| _Static_assert(__builtin_hlsl_is_intangible(SimpleTemplate<__hlsl_resource_t>), ""); | ||
| _Static_assert(!__builtin_hlsl_is_intangible(SimpleTemplate<float>), ""); | ||
|
|
||
| _Static_assert(__builtin_hlsl_is_intangible(RWBuffer<float>), ""); | ||
| _Static_assert(__builtin_hlsl_is_intangible(StructuredBuffer<Simple>), ""); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,12 +1,12 @@ | ||
| // RUN: %clang_cc1 -triple dxil-pc-shadermodel6.6-library -finclude-default-header -verify %s | ||
|
|
||
| struct Undefined; // expected-note {{forward declaration of 'Undefined'}} | ||
| _Static_assert(!__builtin_hlsl_is_intangible(Undefined), ""); // expected-error{{incomplete type 'Undefined' used in type trait expression}} | ||
|
|
||
| void fn(int X) { // expected-note {{declared here}} | ||
| // expected-error@#vla {{variable length arrays are not supported for the current target}} | ||
| // expected-error@#vla {{variable length arrays are not supported in '__builtin_hlsl_is_intangible'}} | ||
| // expected-warning@#vla {{variable length arrays in C++ are a Clang extension}} | ||
| // expected-note@#vla {{function parameter 'X' with unknown value cannot be used in a constant expression}} | ||
| _Static_assert(!__builtin_hlsl_is_intangible(int[X]), ""); // #vla | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,42 +1,42 @@ | ||
| // RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -x hlsl -o - -fsyntax-only %s -verify | ||
|
|
||
| // expected-error@+1{{binding type 't' only applies to SRV resources}} | ||
| float f1 : register(t0); | ||
|
|
||
| // expected-error@+1 {{binding type 'u' only applies to UAV resources}} | ||
| float f2 : register(u0); | ||
|
|
||
| // expected-error@+1{{binding type 'b' only applies to constant buffers. The 'bool constant' binding type is no longer supported}} | ||
| float f3 : register(b9); | ||
|
|
||
| // expected-error@+1 {{binding type 's' only applies to sampler state}} | ||
| float f4 : register(s0); | ||
|
|
||
| // expected-error@+1{{binding type 'i' ignored. The 'integer constant' binding type is no longer supported}} | ||
| float f5 : register(i9); | ||
|
|
||
| // expected-error@+1{{binding type 'x' is invalid}} | ||
| float f6 : register(x9); | ||
|
|
||
| cbuffer g_cbuffer1 { | ||
| // expected-error@+1{{binding type 'c' ignored in buffer declaration. Did you mean 'packoffset'?}} | ||
| float f7 : register(c2); | ||
| }; | ||
|
|
||
| tbuffer g_tbuffer1 { | ||
| // expected-error@+1{{binding type 'c' ignored in buffer declaration. Did you mean 'packoffset'?}} | ||
| float f8 : register(c2); | ||
| }; | ||
|
|
||
| cbuffer g_cbuffer2 { | ||
| // expected-error@+1{{binding type 'b' only applies to constant buffer resources}} | ||
| float f9 : register(b2); | ||
| }; | ||
|
|
||
| tbuffer g_tbuffer2 { | ||
| // expected-error@+1{{binding type 'i' ignored. The 'integer constant' binding type is no longer supported}} | ||
| float f10 : register(i2); | ||
| }; | ||
|
|
||
| // expected-error@+1{{binding type 'c' only applies to numeric variables in the global scope}} | ||
| RWBuffer<float> f11 : register(c3); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,9 @@ | ||
| // RUN: not %clang_cc1 -triple dxil-pc-shadermodel6.3-library -x hlsl -o - -fsyntax-only %s | FileCheck %s | ||
|
|
||
| // XFAIL: * | ||
| // This expectedly fails because RayQuery is an unsupported type. | ||
| // When it becomes supported, we should expect an error due to | ||
| // the variable type being classified as "other", and according | ||
| // to the spec, err_hlsl_unsupported_register_type_and_variable_type | ||
| // should be emitted. | ||
| RayQuery<0> r1: register(t0); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,49 +1,49 @@ | ||
| // RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -x hlsl -o - -fsyntax-only %s -verify | ||
|
|
||
| // This test validates the diagnostics that are emitted when a variable with a "resource" type | ||
| // is bound to a register using the register annotation | ||
|
|
||
|
|
||
| template<typename T> | ||
| struct MyTemplatedSRV { | ||
| __hlsl_resource_t [[hlsl::resource_class(SRV)]] x; | ||
| }; | ||
|
|
||
| struct MySRV { | ||
| __hlsl_resource_t [[hlsl::resource_class(SRV)]] x; | ||
| }; | ||
|
|
||
| struct MySampler { | ||
| __hlsl_resource_t [[hlsl::resource_class(Sampler)]] x; | ||
| }; | ||
|
|
||
| struct MyUAV { | ||
| __hlsl_resource_t [[hlsl::resource_class(UAV)]] x; | ||
| }; | ||
|
|
||
| struct MyCBuffer { | ||
| __hlsl_resource_t [[hlsl::resource_class(CBuffer)]] x; | ||
| }; | ||
|
|
||
|
|
||
| // expected-error@+1 {{binding type 'i' ignored. The 'integer constant' binding type is no longer supported}} | ||
| MySRV invalid : register(i2); | ||
|
|
||
| // expected-error@+1 {{binding type 't' only applies to SRV resources}} | ||
| MyUAV a : register(t2, space1); | ||
|
|
||
| // expected-error@+1 {{binding type 'u' only applies to UAV resources}} | ||
| MySampler b : register(u2, space1); | ||
|
|
||
| // expected-error@+1 {{binding type 'b' only applies to constant buffer resources}} | ||
| MyTemplatedSRV<int> c : register(b2); | ||
|
|
||
| // expected-error@+1 {{binding type 's' only applies to sampler state}} | ||
| MyUAV d : register(s2, space1); | ||
|
|
||
| // empty binding prefix cases: | ||
| // expected-error@+1 {{expected identifier}} | ||
| MyTemplatedSRV<int> e: register(); | ||
|
|
||
| // expected-error@+1 {{expected identifier}} | ||
| MyTemplatedSRV<int> f: register(""); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,27 +1,27 @@ | ||
| // RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -x hlsl -o - -fsyntax-only -Wno-legacy-constant-register-binding %s -verify | ||
|
|
||
| // expected-no-diagnostics | ||
| float f2 : register(b9); | ||
|
|
||
| float f3 : register(i9); | ||
|
|
||
| cbuffer g_cbuffer1 { | ||
| float f4 : register(c2); | ||
| }; | ||
|
|
||
|
|
||
| struct Eg12{ | ||
| RWBuffer<int> a; | ||
| }; | ||
|
|
||
| Eg12 e12 : register(c9); | ||
|
|
||
| Eg12 bar : register(i1); | ||
|
|
||
| struct Eg7 { | ||
| struct Bar { | ||
| float f; | ||
| }; | ||
| Bar b; | ||
| }; | ||
| Eg7 e7 : register(t0); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,62 +1,62 @@ | ||
| // RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -x hlsl -o - -fsyntax-only %s -verify | ||
|
|
||
| // valid | ||
| cbuffer cbuf { | ||
| RWBuffer<int> r : register(u0, space0); | ||
| } | ||
|
|
||
| cbuffer cbuf2 { | ||
| struct x { | ||
| // this test validates that no diagnostic is emitted on the space parameter, because | ||
| // this register annotation is not in the global scope. | ||
| // expected-error@+1 {{'register' attribute only applies to cbuffer/tbuffer and external global variables}} | ||
| RWBuffer<int> E : register(u2, space3); | ||
| }; | ||
| } | ||
|
|
||
| struct MyStruct { | ||
| RWBuffer<int> E; | ||
| }; | ||
|
|
||
| cbuffer cbuf3 { | ||
| // valid | ||
| MyStruct E : register(u2, space3); | ||
| } | ||
|
|
||
| // valid | ||
| MyStruct F : register(u3, space4); | ||
|
|
||
| cbuffer cbuf4 { | ||
| // this test validates that no diagnostic is emitted on the space parameter, because | ||
| // this register annotation is not in the global scope. | ||
| // expected-error@+1 {{binding type 'u' only applies to UAV resources}} | ||
| float a : register(u2, space3); | ||
| } | ||
|
|
||
| // expected-error@+1 {{invalid space specifier 's2' used; expected 'space' followed by an integer, like space1}} | ||
| cbuffer a : register(b0, s2) { | ||
|
|
||
| } | ||
|
|
||
| // expected-error@+1 {{invalid space specifier 'spaces' used; expected 'space' followed by an integer, like space1}} | ||
| cbuffer b : register(b2, spaces) { | ||
|
|
||
| } | ||
|
|
||
| // expected-error@+1 {{wrong argument format for hlsl attribute, use space3 instead}} | ||
| cbuffer c : register(b2, space 3) {} | ||
|
|
||
| // expected-error@+1 {{register space cannot be specified on global constants}} | ||
| int d : register(c2, space3); | ||
|
|
||
| // expected-error@+1 {{register space cannot be specified on global constants}} | ||
| int e : register(c2, space0); | ||
|
|
||
| // expected-error@+1 {{register space cannot be specified on global constants}} | ||
| int f : register(c2, space00); | ||
|
|
||
| // valid | ||
| RWBuffer<int> g : register(u2, space0); | ||
|
|
||
| // valid | ||
| RWBuffer<int> h : register(u2, space0); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,135 +1,135 @@ | ||
| // RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -x hlsl -o - -fsyntax-only %s -verify | ||
|
|
||
| template<typename T> | ||
| struct MyTemplatedUAV { | ||
| __hlsl_resource_t [[hlsl::resource_class(UAV)]] x; | ||
| }; | ||
|
|
||
| struct MySRV { | ||
| __hlsl_resource_t [[hlsl::resource_class(SRV)]] x; | ||
| }; | ||
|
|
||
| struct MySampler { | ||
| __hlsl_resource_t [[hlsl::resource_class(Sampler)]] x; | ||
| }; | ||
|
|
||
| struct MyUAV { | ||
| __hlsl_resource_t [[hlsl::resource_class(UAV)]] x; | ||
| }; | ||
|
|
||
| struct MyCBuffer { | ||
| __hlsl_resource_t [[hlsl::resource_class(CBuffer)]] x; | ||
| }; | ||
|
|
||
| // Valid: f is skipped, SRVBuf is bound to t0, UAVBuf is bound to u0 | ||
| struct Eg1 { | ||
| float f; | ||
| MySRV SRVBuf; | ||
| MyUAV UAVBuf; | ||
| }; | ||
| Eg1 e1 : register(t0) : register(u0); | ||
|
|
||
| // Valid: f is skipped, SRVBuf is bound to t0, UAVBuf is bound to u0. | ||
| // UAVBuf2 gets automatically assigned to u1 even though there is no explicit binding for u1. | ||
| struct Eg2 { | ||
| float f; | ||
| MySRV SRVBuf; | ||
| MyUAV UAVBuf; | ||
| MyUAV UAVBuf2; | ||
| }; | ||
| Eg2 e2 : register(t0) : register(u0); | ||
|
|
||
| // Valid: Bar, the struct within Eg3, has a valid resource that can be bound to t0. | ||
| struct Eg3 { | ||
| struct Bar { | ||
| MyUAV a; | ||
| }; | ||
| Bar b; | ||
| }; | ||
| Eg3 e3 : register(u0); | ||
|
|
||
| // Valid: the first sampler state object within 's' is bound to slot 5 | ||
| struct Eg4 { | ||
| MySampler s[3]; | ||
| }; | ||
|
|
||
| Eg4 e4 : register(s5); | ||
|
|
||
|
|
||
| struct Eg5 { | ||
| float f; | ||
| }; | ||
| // expected-warning@+1{{binding type 't' only applies to types containing SRV resources}} | ||
| Eg5 e5 : register(t0); | ||
|
|
||
| struct Eg6 { | ||
| float f; | ||
| }; | ||
| // expected-warning@+1{{binding type 'u' only applies to types containing UAV resources}} | ||
| Eg6 e6 : register(u0); | ||
|
|
||
| struct Eg7 { | ||
| float f; | ||
| }; | ||
| // expected-warning@+1{{binding type 'b' only applies to types containing constant buffer resources}} | ||
| Eg7 e7 : register(b0); | ||
|
|
||
| struct Eg8 { | ||
| float f; | ||
| }; | ||
| // expected-warning@+1{{binding type 's' only applies to types containing sampler state}} | ||
| Eg8 e8 : register(s0); | ||
|
|
||
| struct Eg9 { | ||
| MySRV s; | ||
| }; | ||
| // expected-warning@+1{{binding type 'c' only applies to types containing numeric types}} | ||
| Eg9 e9 : register(c0); | ||
|
|
||
| struct Eg10{ | ||
| // expected-error@+1{{'register' attribute only applies to cbuffer/tbuffer and external global variables}} | ||
| MyTemplatedUAV<int> a : register(u9); | ||
| }; | ||
| Eg10 e10; | ||
|
|
||
|
|
||
| template<typename R> | ||
| struct Eg11 { | ||
| R b; | ||
| }; | ||
| // expected-warning@+1{{binding type 'u' only applies to types containing UAV resources}} | ||
| Eg11<MySRV> e11 : register(u0); | ||
| // invalid because after template expansion, there are no valid resources inside Eg11 to bind as a UAV, only an SRV | ||
|
|
||
|
|
||
| struct Eg12{ | ||
| MySRV s1; | ||
| MySRV s2; | ||
| }; | ||
| // expected-warning@+2{{binding type 'u' only applies to types containing UAV resources}} | ||
| // expected-error@+1{{binding type 'u' cannot be applied more than once}} | ||
| Eg12 e12 : register(u9) : register(u10); | ||
|
|
||
| struct Eg13{ | ||
| MySRV s1; | ||
| MySRV s2; | ||
| }; | ||
| // expected-warning@+3{{binding type 'u' only applies to types containing UAV resources}} | ||
| // expected-error@+2{{binding type 'u' cannot be applied more than once}} | ||
| // expected-error@+1{{binding type 'u' cannot be applied more than once}} | ||
| Eg13 e13 : register(u9) : register(u10) : register(u11); | ||
|
|
||
| // expected-error@+1{{binding type 't' cannot be applied more than once}} | ||
| Eg13 e13_2 : register(t11) : register(t12); | ||
|
|
||
| struct Eg14{ | ||
| MyTemplatedUAV<int> r1; | ||
| }; | ||
| // expected-warning@+1{{binding type 't' only applies to types containing SRV resources}} | ||
| Eg14 e14 : register(t9); | ||
|
|
||
| struct Eg15 { | ||
| float f[4]; | ||
| }; | ||
| // expected no error | ||
| Eg15 e15 : register(c0); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| perl -S scan-build %* |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| perl -S c++-analyzer %* |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| perl -S ccc-analyzer %* |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,36 +1,36 @@ | ||
| ! RUN: %flang -### --target=aarch64-windows-msvc -resource-dir=%S/Inputs/resource_dir %S/Inputs/hello.f90 -v 2>&1 | FileCheck %s --check-prefixes=MSVC | ||
| ! RUN: %flang -### --target=aarch64-windows-msvc -resource-dir=%S/Inputs/resource_dir -fms-runtime-lib=static_dbg %S/Inputs/hello.f90 -v 2>&1 | FileCheck %s --check-prefixes=MSVC-DEBUG | ||
| ! RUN: %flang -### --target=aarch64-windows-msvc -resource-dir=%S/Inputs/resource_dir -fms-runtime-lib=dll %S/Inputs/hello.f90 -v 2>&1 | FileCheck %s --check-prefixes=MSVC-DLL | ||
| ! RUN: %flang -### --target=aarch64-windows-msvc -resource-dir=%S/Inputs/resource_dir -fms-runtime-lib=dll_dbg %S/Inputs/hello.f90 -v 2>&1 | FileCheck %s --check-prefixes=MSVC-DLL-DEBUG | ||
|
|
||
| ! MSVC: -fc1 | ||
| ! MSVC-SAME: --dependent-lib=clang_rt.builtins.lib | ||
| ! MSVC-SAME: -D_MT | ||
| ! MSVC-SAME: --dependent-lib=libcmt | ||
| ! MSVC-SAME: --dependent-lib=FortranRuntime.static.lib | ||
| ! MSVC-SAME: --dependent-lib=FortranDecimal.static.lib | ||
|
|
||
| ! MSVC-DEBUG: -fc1 | ||
| ! MSVC-DEBUG-SAME: --dependent-lib=clang_rt.builtins.lib | ||
| ! MSVC-DEBUG-SAME: -D_MT | ||
| ! MSVC-DEBUG-SAME: -D_DEBUG | ||
| ! MSVC-DEBUG-SAME: --dependent-lib=libcmtd | ||
| ! MSVC-DEBUG-SAME: --dependent-lib=FortranRuntime.static_dbg.lib | ||
| ! MSVC-DEBUG-SAME: --dependent-lib=FortranDecimal.static_dbg.lib | ||
|
|
||
| ! MSVC-DLL: -fc1 | ||
| ! MSVC-DLL-SAME: --dependent-lib=clang_rt.builtins.lib | ||
| ! MSVC-DLL-SAME: -D_MT | ||
| ! MSVC-DLL-SAME: -D_DLL | ||
| ! MSVC-DLL-SAME: --dependent-lib=msvcrt | ||
| ! MSVC-DLL-SAME: --dependent-lib=FortranRuntime.dynamic.lib | ||
| ! MSVC-DLL-SAME: --dependent-lib=FortranDecimal.dynamic.lib | ||
|
|
||
| ! MSVC-DLL-DEBUG: -fc1 | ||
| ! MSVC-DLL-DEBUG-SAME: --dependent-lib=clang_rt.builtins.lib | ||
| ! MSVC-DLL-DEBUG-SAME: -D_MT | ||
| ! MSVC-DLL-DEBUG-SAME: -D_DEBUG | ||
| ! MSVC-DLL-DEBUG-SAME: -D_DLL | ||
| ! MSVC-DLL-DEBUG-SAME: --dependent-lib=msvcrtd | ||
| ! MSVC-DLL-DEBUG-SAME: --dependent-lib=FortranRuntime.dynamic_dbg.lib | ||
| ! MSVC-DLL-DEBUG-SAME: --dependent-lib=FortranDecimal.dynamic_dbg.lib |