Implicit bindings will cause very confusing crashes in the backend at present, so this is intended at least partially as a stop gap until we get them implemented (see #110722). However, I do think that this is useful in the longer term as well as an off-by-default warning, as it is quite easy to miss a binding or two when using explicit bindings and the results of that can be surprisingly hard to debug. I've filed #135907 to track turning this into an off-by-default warning or removing it eventually as we see fit.
39 lines
1.1 KiB
HLSL
39 lines
1.1 KiB
HLSL
// RUN: %clang_cc1 -Wno-hlsl-implicit-binding -finclude-default-header -triple dxil-pc-shadermodel6.3-compute -fnative-half-type -emit-llvm -disable-llvm-passes -o - %s | FileCheck %s
|
|
|
|
// CHECK: %"__cblayout_$Globals" = type <{ float, float, target("dx.Layout", %__cblayout_S, 4, 0) }>
|
|
// CHECK: %__cblayout_S = type <{ float }>
|
|
|
|
// CHECK-DAG: @"$Globals.cb" = global target("dx.CBuffer", target("dx.Layout", %"__cblayout_$Globals", 20, 0, 4, 16))
|
|
// CHECK-DAG: @a = external addrspace(2) global float
|
|
// CHECK-DAG: @g = external addrspace(2) global float
|
|
// CHECK-DAG: @h = external addrspace(2) global target("dx.Layout", %__cblayout_S, 4, 0), align 4
|
|
|
|
struct EmptyStruct {
|
|
};
|
|
|
|
struct S {
|
|
RWBuffer<float> buf;
|
|
EmptyStruct es;
|
|
float ea[0];
|
|
float b;
|
|
};
|
|
|
|
float a;
|
|
RWBuffer<float> b;
|
|
EmptyStruct c;
|
|
float d[0];
|
|
RWBuffer<float> e[2];
|
|
groupshared float f;
|
|
float g;
|
|
S h;
|
|
|
|
RWBuffer<float> Buf;
|
|
|
|
[numthreads(4,1,1)]
|
|
void main() {
|
|
Buf[0] = a;
|
|
}
|
|
|
|
// CHECK: !hlsl.cbs = !{![[CB:.*]]}
|
|
// CHECK: ![[CB]] = !{ptr @"$Globals.cb", ptr addrspace(2) @a, ptr addrspace(2) @g, ptr addrspace(2) @h}
|