brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.8 KiB · 0be32c9 Raw
63 lines · plain
1// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -x hlsl -o - -fsyntax-only %s -verify2 3// valid4cbuffer cbuf {5    RWBuffer<int> r : register(u0, space0);6}7 8cbuffer cbuf2 {9    struct x {10        // this test validates that no diagnostic is emitted on the space parameter, because11        // this register annotation is not in the global scope.12        // expected-error@+1 {{'register' attribute only applies to cbuffer/tbuffer and external global variables}}13        RWBuffer<int> E : register(u2, space3);14    };15}16 17struct MyStruct {18    RWBuffer<int> E;19};20 21cbuffer cbuf3 {22  // valid23  MyStruct E : register(u2, space3);24}25 26// valid27MyStruct F : register(u3, space4);28 29cbuffer cbuf4 {30  // this test validates that no diagnostic is emitted on the space parameter, because31  // this register annotation is not in the global scope.32  // expected-error@+1 {{binding type 'u' only applies to UAV resources}}33  float a : register(u2, space3);34}35 36// expected-error@+1 {{invalid space specifier 's2' used; expected 'space' followed by an integer, like space1}}37cbuffer a : register(b0, s2) {38 39}40 41// expected-error@+1 {{invalid space specifier 'spaces' used; expected 'space' followed by an integer, like space1}}42cbuffer b : register(b2, spaces) {43 44}45 46// expected-error@+1 {{wrong argument format for hlsl attribute, use space3 instead}}47cbuffer c : register(b2, space 3) {}48 49// expected-error@+1 {{register space cannot be specified on global constants}}50int d : register(c2, space3);51 52// expected-error@+1 {{register space cannot be specified on global constants}}53int e : register(c2, space0);54 55// expected-error@+1 {{register space cannot be specified on global constants}}56int f : register(c2, space00);57 58// valid59RWBuffer<int> g : register(u2, space0);60 61// valid62RWBuffer<int> h : register(u2, space0);63