brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.5 KiB · afd7d40 Raw
71 lines · plain
1// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -x hlsl -o - -fsyntax-only %s -verify2 3template<typename T>4struct MyTemplatedSRV {5  __hlsl_resource_t [[hlsl::resource_class(SRV)]] x;6};7 8// valid, The register keyword in this statement isn't binding a resource, rather it is9// specifying a constant register binding offset within the $Globals cbuffer, which is legacy behavior from DX9.10float a : register(c0);11 12// expected-error@+1 {{binding type 'i' ignored. The 'integer constant' binding type is no longer supported}}13cbuffer b : register(i0) {14 15}16 17// expected-error@+1 {{register number should be an integer}}18cbuffer c : register(bf, s2) {19 20}21 22// expected-error@+1 {{expected identifier}}23cbuffer A : register() {}24 25// expected-error@+1 {{invalid space specifier 'space' used; expected 'space' followed by an integer, like space1}}26cbuffer B : register(space) {}27 28// expected-error@+1 {{wrong argument format for hlsl attribute, use b2 instead}}29cbuffer C : register(b 2) {}30 31// expected-error@+1 {{wrong argument format for hlsl attribute, use b2 instead}}32cbuffer D : register(b 2, space3) {}33 34// expected-error@+1 {{expected <numeric_constant>}}35cbuffer E : register(u-1) {};36 37// expected-error@+1 {{'register' attribute only applies to cbuffer/tbuffer and external global variables}}38static MyTemplatedSRV<float> U : register(u5);39 40// expected-error@+1 {{'register' attribute only applies to cbuffer/tbuffer and external global variables}}41static float sa : register(c1);42 43float x[2] : register(c2); // valid44float y[2][2] : register(c3); // valid45float z[2][2][3] : register(c4); // valid46 47// expected-error@+1 {{binding type 'c' only applies to numeric variables in the global scope}}48groupshared float fa[10] : register(c5);49 50void foo() {51  // expected-error@+1 {{'register' attribute only applies to cbuffer/tbuffer and external global variables}}52  MyTemplatedSRV<float> U : register(u3);53}54void foo2() {55  // expected-error@+1 {{'register' attribute only applies to cbuffer/tbuffer and external global variables}}56  extern MyTemplatedSRV<float> U2 : register(u5);57}58 59// expected-error@+1 {{'register' attribute only applies to cbuffer/tbuffer and external global variables}}60void bar(MyTemplatedSRV<float> U : register(u3)) {61 62}63 64struct S {65  // expected-error@+1 {{'register' attribute only applies to cbuffer/tbuffer and external global variables}}66  MyTemplatedSRV<float> U : register(u3);67};68 69// expected-error@+1 {{binding type 'z' is invalid}}70MyTemplatedSRV<float> U3 : register(z5);71