forked from GPUOpen-Drivers/llpc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFetchShaderSingleInput.lgc
157 lines (131 loc) · 7.74 KB
/
FetchShaderSingleInput.lgc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
; Test building the vertex shader by itself.
; RUN: lgc -mcpu=gfx802 -extract=2 - <%s | FileCheck --check-prefixes=VS-ISA,VS-NOTNGG-ISA %s
; RUN: lgc -mcpu=gfx900 -extract=2 - <%s | FileCheck --check-prefixes=VS-ISA,VS-NOTNGG-ISA %s
; RUN: lgc -mcpu=gfx1010 -extract=2 - <%s | FileCheck --check-prefixes=VS-ISA,VS-NGG-ISA %s
; VS-ISA: .p2align 8
; VS-NOTNGG-ISA-LABEL: _amdgpu_vs_main_fetchless:
; VS-NGG-ISA-LABEL: _amdgpu_gs_main_fetchless:
; VS-ISA: exp pos0
; VS-ISA: s_endpgm
; VS-ISA: .vertexInputs:
; VS-ISA: - 0
; VS-ISA: - 0
; VS-ISA: - v4f32
; Test building the vertex and fragment shaders to separate ELFs, then building the fetch shader to ISA.
; RUN: lgc -mcpu=gfx802 -extract=2 -filetype=obj -o %t.vs.elf - <%s && lgc -mcpu=gfx802 -extract=3 -filetype=obj -o %t.fs.elf - <%s && lgc -mcpu=gfx802 -extract=1 -o - -l -glue=1 %s %t.vs.elf %t.fs.elf | FileCheck -check-prefixes=FETCH-ISA,FETCH-ISA-NOTNGG %s
; RUN: lgc -mcpu=gfx900 -extract=2 -filetype=obj -o %t.vs.elf - <%s && lgc -mcpu=gfx900 -extract=3 -filetype=obj -o %t.fs.elf - <%s && lgc -mcpu=gfx900 -extract=1 -o - -l -glue=1 %s %t.vs.elf %t.fs.elf | FileCheck -check-prefixes=FETCH-ISA,FETCH-ISA-NOTNGG %s
; RUN: lgc -mcpu=gfx1010 -extract=2 -filetype=obj -o %t.vs.elf - <%s && lgc -mcpu=gfx1010 -extract=3 -filetype=obj -o %t.fs.elf - <%s && lgc -mcpu=gfx1010 -extract=1 -o - -l -glue=1 %s %t.vs.elf %t.fs.elf | FileCheck -check-prefixes=FETCH-ISA,FETCH-ISA-NGG %s
; FETCH-ISA: .p2align 8
; FETCH-ISA-NOTNGG: _amdgpu_vs_main:
; FETCH-ISA-NOTNGG-NOT: s_bfm_b32 exec
; FETCH-ISA-NOTNGG: tbuffer_load_format_x v4,
; FETCH-ISA-NOTNGG: tbuffer_load_format_x v5,
; FETCH-ISA-NOTNGG: tbuffer_load_format_x v6,
; FETCH-ISA-NGG: _amdgpu_gs_main:
; FETCH-ISA-NGG: s_bfe_u32 {{.*}}, s3, 0x70000
; FETCH-ISA-NGG: s_bfm_b32 exec
; FETCH-ISA-NGG: tbuffer_load_format_x v9,
; FETCH-ISA-NGG: tbuffer_load_format_x v10,
; FETCH-ISA-NGG: tbuffer_load_format_x v11,
; Not expecting s_endpgm on a fetch shader.
; FETCH-ISA-NOT: s_endpgm
; ----------------------------------------------------------------------
; Extract 1: The pipeline state with no shaders.
target datalayout = "e-p:64:64-p1:64:64-p2:32:32-p3:32:32-p4:64:64-p5:32:32-p6:32:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64-S32-A5-ni:7"
target triple = "amdgcn--amdpal"
!lgc.options = !{!0}
!lgc.options.VS = !{!1}
!lgc.options.FS = !{!2}
!lgc.user.data.nodes = !{!3, !4, !5, !6, !7}
!lgc.vertex.inputs = !{!8, !9, !10, !11}
!lgc.color.export.formats = !{!12}
!lgc.input.assembly.state = !{!13}
!lgc.viewport.state = !{!14}
!lgc.rasterizer.state = !{!15}
!0 = !{i32 -1094458452, i32 -1026392042, i32 2073992001, i32 497582744, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 2}
!1 = !{i32 -1960408933, i32 578719886, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 64, i32 0, i32 15, i32 3}
!2 = !{i32 -1498760258, i32 545756883, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 64, i32 0, i32 15, i32 3}
!3 = !{!"DescriptorTableVaPtr", i32 0, i32 1, i32 3}
!4 = !{!"DescriptorBuffer", i32 0, i32 4, i32 0, i32 0, i32 4}
!5 = !{!"DescriptorCombinedTexture", i32 4, i32 12, i32 0, i32 1, i32 12}
!6 = !{!"DescriptorBuffer", i32 16, i32 4, i32 0, i32 2, i32 4}
!7 = !{!"IndirectUserDataVaPtr", i32 1, i32 1, i32 4}
!8 = !{i32 0, i32 0, i32 0, i32 44, i32 13, i32 7, i32 -1}
!9 = !{i32 1, i32 0, i32 12, i32 44, i32 11, i32 7, i32 -1}
!10 = !{i32 2, i32 0, i32 20, i32 44, i32 13, i32 7, i32 -1}
!11 = !{i32 3, i32 0, i32 32, i32 44, i32 13, i32 7, i32 -1}
!12 = !{i32 16, i32 0, i32 0, i32 1}
!13 = !{i32 2, i32 3}
!14 = !{i32 1}
!15 = !{i32 0, i32 0, i32 0, i32 1}
!16 = !{i32 0}
!17 = !{i32 4}
; ----------------------------------------------------------------------
; Extract 2: The vertex shader
target datalayout = "e-p:64:64-p1:64:64-p2:32:32-p3:32:32-p4:64:64-p5:32:32-p6:32:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64-S32-A5-ni:7"
target triple = "amdgcn--amdpal"
define dllexport spir_func void @lgc.shader.VS.main() local_unnamed_addr #0 !lgc.shaderstage !5 {
.entry:
%0 = call i8 addrspace(7)* (...) @lgc.create.load.buffer.desc.p7i8(i32 0, i32 0, i32 0, i32 0)
%1 = call {}* @llvm.invariant.start.p7i8(i64 -1, i8 addrspace(7)* %0)
%2 = call <4 x float> (...) @lgc.create.read.generic.input.v4f32(i32 0, i32 0, i32 0, i32 0, i32 0, i32 undef)
%3 = bitcast i8 addrspace(7)* %0 to <4 x float> addrspace(7)*
%4 = load <4 x float>, <4 x float> addrspace(7)* %3, align 16
%5 = insertvalue [4 x <4 x float>] undef, <4 x float> %4, 0
%6 = getelementptr inbounds i8, i8 addrspace(7)* %0, i64 16
%7 = bitcast i8 addrspace(7)* %6 to <4 x float> addrspace(7)*
%8 = load <4 x float>, <4 x float> addrspace(7)* %7, align 16
%9 = insertvalue [4 x <4 x float>] %5, <4 x float> %8, 1
%10 = getelementptr inbounds i8, i8 addrspace(7)* %0, i64 32
%11 = bitcast i8 addrspace(7)* %10 to <4 x float> addrspace(7)*
%12 = load <4 x float>, <4 x float> addrspace(7)* %11, align 16
%13 = insertvalue [4 x <4 x float>] %9, <4 x float> %12, 2
%14 = getelementptr inbounds i8, i8 addrspace(7)* %0, i64 48
%15 = bitcast i8 addrspace(7)* %14 to <4 x float> addrspace(7)*
%16 = load <4 x float>, <4 x float> addrspace(7)* %15, align 16
%17 = insertvalue [4 x <4 x float>] %13, <4 x float> %16, 3
%18 = insertelement <4 x float> %2, float 1.000000e+00, i32 3
%19 = call <4 x float> (...) @lgc.create.matrix.times.vector.v4f32([4 x <4 x float>] %17, <4 x float> %18)
call void (...) @lgc.create.write.builtin.output(<4 x float> %19, i32 0, i32 0, i32 undef, i32 undef)
ret void
}
; Function Attrs: nounwind
declare <4 x float> @lgc.create.matrix.times.vector.v4f32(...) local_unnamed_addr #0
; Function Attrs: nounwind readonly
declare <4 x float> @lgc.create.read.generic.input.v4f32(...) local_unnamed_addr #1
; Function Attrs: nounwind
declare void @lgc.create.write.builtin.output(...) local_unnamed_addr #0
; Function Attrs: nounwind
declare i8 addrspace(7)* @lgc.create.load.buffer.desc.p7i8(...) local_unnamed_addr #0
; Function Attrs: argmemonly nounwind willreturn
declare {}* @llvm.invariant.start.p7i8(i64 immarg, i8 addrspace(7)* nocapture) #2
attributes #0 = { nounwind }
attributes #1 = { nounwind readonly }
attributes #2 = { argmemonly nounwind willreturn }
!lgc.unlinked = !{!0}
!lgc.options = !{!1}
!lgc.options.VS = !{!2}
!0 = !{i32 1}
!1 = !{i32 -622916388, i32 -2087703020, i32 1994742363, i32 -303531948, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 2}
!2 = !{i32 -1960408933, i32 578719886, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 64, i32 0, i32 0, i32 3}
!5 = !{i32 1}
; ----------------------------------------------------------------------
; Extract 3: The fragment shader
target datalayout = "e-p:64:64-p1:64:64-p2:32:32-p3:32:32-p4:64:64-p5:32:32-p6:32:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64-S32-A5-ni:7"
target triple = "amdgcn--amdpal"
define dllexport spir_func void @lgc.shader.FS.main() local_unnamed_addr #0 !lgc.shaderstage !5 {
.entry:
call void (...) @lgc.create.write.generic.output(<4 x float> <float 0.000000e+00, float 1.000000e+00, float 0.000000e+00, float 1.000000e+00>, i32 0, i32 0, i32 0, i32 0, i32 0, i32 undef)
ret void
}
declare void @lgc.create.write.generic.output(...) local_unnamed_addr #0
attributes #0 = { nounwind }
!lgc.unlinked = !{!0}
!lgc.options = !{!1}
!lgc.options.FS = !{!2}
!lgc.color.export.formats = !{!3}
!0 = !{i32 1}
!1 = !{i32 1741946712, i32 -2129783189, i32 -1703433192, i32 1078647447, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 2}
!2 = !{i32 -1498760258, i32 545756883, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 64, i32 0, i32 0, i32 3}
!3 = !{i32 14, i32 7}
!5 = !{i32 6}