Debian Codegraph @

clang/test/CodeGenHLSL/semantics/semantic.explicit-mix-builtin.hlsl

raw
1 // RUN: %clang_cc1 -triple spirv-linux-vulkan-pixel -x hlsl -emit-llvm -finclude-default-header -disable-llvm-passes -o - %s | FileCheck %s --check-prefixes=CHECK,CHECK-SPIRV
2
3 // The following code is allowed because the `SV_Position` semantic is here
4 // translated into a SPIR-V builtin. Meaning there is no implicit `Location`
5 // assignment.
6
7 struct S2 {
8 float4 a;
9 float4 b;
10 };
11
12 struct S1 {
13 float4 position : SV_Position;
14 [[vk::location(3)]] float4 color0 : COLOR0;
15 };
16
17 // CHECK-SPIRV: @SV_Position = external hidden thread_local addrspace(7) externally_initialized constant <4 x float>, !spirv.Decorations ![[#MD_0:]]
18 // CHECK-SPIRV: @COLOR0 = external hidden thread_local addrspace(7) externally_initialized constant <4 x float>, !spirv.Decorations ![[#MD_2:]]
19 // CHECK-SPIRV: @SV_Target0 = external hidden thread_local addrspace(8) global <4 x float>, !spirv.Decorations ![[#MD_4:]]
20
21 [shader("pixel")]
22 float4 main(S1 p) : SV_Target {
23 return p.position + p.color0;
24 }
25 // CHECK-SPIRV: %[[#SV_POS:]] = load <4 x float>, ptr addrspace(7) @SV_Position, align 16
26 // CHECK: %[[#TMP1:]] = insertvalue %struct.S1 poison, <4 x float> %[[#SV_POS]], 0
27 // CHECK-SPIRV: %[[#A0:]] = load <4 x float>, ptr addrspace(7) @COLOR0, align 16
28 // CHECK: %[[#TMP2:]] = insertvalue %struct.S1 %[[#TMP1]], <4 x float> %[[#A0]], 1
29 // CHECK: %[[#P:]] = alloca %struct.S1, align 16
30 // CHECK: store %struct.S1 %[[#TMP2]], ptr %[[#P]], align 16
31 // CHECK-SPIRV: %[[#R:]] = call spir_func <4 x float> @_Z4main2S1(ptr %[[#P]])
32 // CHECK-SPIRV: store <4 x float> %[[#R]], ptr addrspace(8) @SV_Target0, align 16
33
34 // CHECK-SPIRV: ![[#MD_0]] = !{![[#MD_1:]]}
35 // CHECK-SPIRV: ![[#MD_1]] = !{i32 11, i32 15}
36 // CHECK-SPIRV: ![[#MD_2]] = !{![[#MD_3:]]}
37 // CHECK-SPIRV: ![[#MD_3]] = !{i32 30, i32 3}
38 // CHECK-SPIRV: ![[#MD_4]] = !{![[#MD_5:]]}
39 // CHECK-SPIRV: ![[#MD_5]] = !{i32 30, i32 0}