brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.4 KiB · ea43e27 Raw
50 lines · plain
1// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -x hlsl -o - -fsyntax-only %s -verify2 3// This test validates the diagnostics that are emitted when a variable with a "resource" type4// is bound to a register using the register annotation5 6 7template<typename T>8struct MyTemplatedSRV {9  __hlsl_resource_t [[hlsl::resource_class(SRV)]] x;10};11 12struct MySRV {13  __hlsl_resource_t [[hlsl::resource_class(SRV)]] x;14};15 16struct MySampler {17  __hlsl_resource_t [[hlsl::resource_class(Sampler)]] x;18};19 20struct MyUAV {21  __hlsl_resource_t [[hlsl::resource_class(UAV)]] x;22};23 24struct MyCBuffer {25  __hlsl_resource_t [[hlsl::resource_class(CBuffer)]] x;26};27 28 29// expected-error@+1  {{binding type 'i' ignored. The 'integer constant' binding type is no longer supported}}30MySRV invalid : register(i2);31 32// expected-error@+1  {{binding type 't' only applies to SRV resources}}33MyUAV a : register(t2, space1);34 35// expected-error@+1  {{binding type 'u' only applies to UAV resources}}36MySampler b : register(u2, space1);37 38// expected-error@+1  {{binding type 'b' only applies to constant buffer resources}}39MyTemplatedSRV<int> c : register(b2);40 41// expected-error@+1  {{binding type 's' only applies to sampler state}}42MyUAV d : register(s2, space1);43 44// empty binding prefix cases:45// expected-error@+1 {{expected identifier}}46MyTemplatedSRV<int> e: register();47 48// expected-error@+1 {{expected identifier}}49MyTemplatedSRV<int> f: register("");50