41 lines · plain
1// RUN: %clang_cc1 -Whlsl-implicit-binding -triple dxil-pc-shadermodel6.3-library -x hlsl -o - -fsyntax-only %s -verify2 3// expected-warning@+1 {{resource has implicit register binding}}4cbuffer cb0 {5 int a;6}7 8// No warning - this is an element of the $Globals buffer not it's own binding.9float b;10 11// expected-warning@+1 {{resource has implicit register binding}}12RWBuffer<int> c;13 14// No warning - explicit binding.15RWBuffer<float> d : register(u0);16 17// expected-warning@+1 {{resource has implicit register binding}}18RWBuffer<float> dd : register(space1);19 20// No warning - explicit binding.21RWBuffer<float> ddd : register(u3, space4);22 23struct S { int x; };24// expected-warning@+1 {{resource has implicit register binding}}25StructuredBuffer<S> e;26 27// No warning - __hlsl_resource_t isn't itself a resource object.28__hlsl_resource_t [[hlsl::resource_class(SRV)]] f;29 30struct CustomSRV {31 __hlsl_resource_t [[hlsl::resource_class(SRV)]] x;32};33// expected-warning@+1 {{resource has implicit register binding}}34CustomSRV g;35 36// expected-warning@+1 {{resource has implicit register binding}}37RWBuffer<float> h[10];38 39// No warning - explicit binding.40RWBuffer<float> hh[100] : register(u4);41