Debian Codegraph @

clang/test/CodeGenHLSL/resources/default_cbuffer.hlsl

raw
1 // RUN: %clang_cc1 -finclude-default-header -triple dxil-pc-shadermodel6.3-compute -fnative-half-type -emit-llvm -disable-llvm-passes -o - %s | FileCheck %s --check-prefixes=CHECK,DXIL
2 // RUN: %clang_cc1 -finclude-default-header -triple spirv-pc-vulkan1.3-compute -fnative-half-type -emit-llvm -disable-llvm-passes -o - %s | FileCheck %s --check-prefixes=CHECK,SPIRV
3
4 // CHECK: %"__cblayout_$Globals" = type <{ float, float, target("{{.*}}.Padding", 8), %__cblayout_S }>
5 // CHECK: %__cblayout_S = type <{ float }>
6
7 // DXIL-DAG: @"$Globals.cb" = global target("dx.CBuffer", %"__cblayout_$Globals")
8 // DXIL-DAG: @a = external hidden addrspace(2) global float
9 // DXIL-DAG: @g = external hidden addrspace(2) global float
10 // DXIL-DAG: @h = external hidden addrspace(2) global %__cblayout_S, align 4
11
12 // SPIRV-DAG: @"$Globals.cb" = global target("spirv.VulkanBuffer", %"__cblayout_$Globals", 2, 0)
13 // SPIRV-DAG: @a = external hidden addrspace(12) global float
14 // SPIRV-DAG: @g = external hidden addrspace(12) global float
15 // SPIRV-DAG: @h = external hidden addrspace(12) global %__cblayout_S, align 8
16
17 struct EmptyStruct {
18 };
19
20 struct S {
21 RWBuffer<float> buf;
22 EmptyStruct es;
23 float ea[0];
24 float b;
25 };
26
27 float a;
28 RWBuffer<float> b;
29 EmptyStruct c;
30 float d[0];
31 RWBuffer<float> e[2];
32 groupshared float f;
33 float g;
34 S h;
35
36 RWBuffer<float> Buf;
37
38 [numthreads(4,1,1)]
39 void main() {
40 Buf[0] = a;
41 }
42
43 // CHECK: !hlsl.cbs = !{![[CB:.*]]}
44 // DXIL: ![[CB]] = !{ptr @"$Globals.cb", ptr addrspace(2) @a, ptr addrspace(2) @g, ptr addrspace(2) @h}
45 // SPIRV: ![[CB]] = !{ptr @"$Globals.cb", ptr addrspace(12) @a, ptr addrspace(12) @g, ptr addrspace(12) @h}