Debian Codegraph @

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

raw
1 // RUN: %clang_cc1 -triple spirv-linux-vulkan-vertex -x hlsl -emit-llvm -finclude-default-header -disable-llvm-passes -o - %s | FileCheck %s
2
3 // This is almost the same as semantic.explicit-mix-builtin.hlsl, except this
4 // time we build a vertex shader. This means the SV_Position semantic output
5 // is also a BuiltIn, This means we can mix implicit and explicit location
6 // assignment.
7 struct S1 {
8 float4 position : SV_Position;
9 [[vk::location(3)]] float4 color : A;
10 };
11
12 // CHECK: @SV_Position0 = external hidden thread_local addrspace(7) externally_initialized constant <4 x float>, !spirv.Decorations ![[#MD_0:]]
13 // CHECK: @SV_Position = external hidden thread_local addrspace(8) global <4 x float>, !spirv.Decorations ![[#MD_2:]]
14 // CHECK: @A0 = external hidden thread_local addrspace(8) global <4 x float>, !spirv.Decorations ![[#MD_0]]
15
16 [shader("vertex")]
17 S1 main1(float4 position : SV_Position) {
18 S1 output;
19 output.position = position;
20 output.color = position;
21 return output;
22 }
23
24 // CHECK: ![[#MD_0]] = !{![[#MD_1:]]}
25 // CHECK: ![[#MD_1]] = !{i32 30, i32 0}
26 // | `-> Location index
27 // `-> SPIR-V decoration 'Location'
28 // CHECK: ![[#MD_2]] = !{![[#MD_3:]]}
29 // CHECK: ![[#MD_3]] = !{i32 11, i32 0}
30 // | `-> BuiltIn 'Position'
31 // `-> SPIR-V decoration 'BuiltIn'