1 // GENERATED FILE - DO NOT EDIT.
2 // Generated by gen_vk_internal_shaders.py using data from shaders/src/*
3 //
4 // Copyright 2018 The ANGLE Project Authors. All rights reserved.
5 // Use of this source code is governed by a BSD-style license that can be
6 // found in the LICENSE file.
7 //
8 // vk_internal_shaders_autogen.cpp:
9 // Pre-generated shader library for the ANGLE Vulkan back-end.
10
11 #include "libANGLE/renderer/vulkan/vk_internal_shaders_autogen.h"
12
13 #define USE_SYSTEM_ZLIB
14 #include "compression_utils_portable.h"
15
16 namespace rx
17 {
18 namespace vk
19 {
20 namespace
21 {
22 #include "libANGLE/renderer/vulkan/shaders/gen/BlitResolve.frag.00000000.inc"
23 #include "libANGLE/renderer/vulkan/shaders/gen/BlitResolve.frag.00000001.inc"
24 #include "libANGLE/renderer/vulkan/shaders/gen/BlitResolve.frag.00000002.inc"
25 #include "libANGLE/renderer/vulkan/shaders/gen/BlitResolve.frag.00000003.inc"
26 #include "libANGLE/renderer/vulkan/shaders/gen/BlitResolve.frag.00000004.inc"
27 #include "libANGLE/renderer/vulkan/shaders/gen/BlitResolve.frag.00000005.inc"
28 #include "libANGLE/renderer/vulkan/shaders/gen/BlitResolve.frag.00000006.inc"
29 #include "libANGLE/renderer/vulkan/shaders/gen/BlitResolve.frag.00000007.inc"
30 #include "libANGLE/renderer/vulkan/shaders/gen/BlitResolve.frag.00000008.inc"
31 #include "libANGLE/renderer/vulkan/shaders/gen/BlitResolve.frag.00000009.inc"
32 #include "libANGLE/renderer/vulkan/shaders/gen/BlitResolve.frag.0000000A.inc"
33 #include "libANGLE/renderer/vulkan/shaders/gen/BlitResolve.frag.0000000B.inc"
34 #include "libANGLE/renderer/vulkan/shaders/gen/BlitResolve.frag.0000000C.inc"
35 #include "libANGLE/renderer/vulkan/shaders/gen/BlitResolve.frag.0000000D.inc"
36 #include "libANGLE/renderer/vulkan/shaders/gen/BlitResolve.frag.0000000E.inc"
37 #include "libANGLE/renderer/vulkan/shaders/gen/BlitResolve.frag.0000000F.inc"
38 #include "libANGLE/renderer/vulkan/shaders/gen/BlitResolve.frag.00000010.inc"
39 #include "libANGLE/renderer/vulkan/shaders/gen/BlitResolve.frag.00000011.inc"
40 #include "libANGLE/renderer/vulkan/shaders/gen/BlitResolve.frag.00000012.inc"
41 #include "libANGLE/renderer/vulkan/shaders/gen/BlitResolve.frag.00000013.inc"
42 #include "libANGLE/renderer/vulkan/shaders/gen/BlitResolve.frag.00000014.inc"
43 #include "libANGLE/renderer/vulkan/shaders/gen/BlitResolve.frag.00000015.inc"
44 #include "libANGLE/renderer/vulkan/shaders/gen/BlitResolve.frag.00000016.inc"
45 #include "libANGLE/renderer/vulkan/shaders/gen/BlitResolve.frag.00000017.inc"
46 #include "libANGLE/renderer/vulkan/shaders/gen/BlitResolveStencilNoExport.comp.00000000.inc"
47 #include "libANGLE/renderer/vulkan/shaders/gen/BlitResolveStencilNoExport.comp.00000001.inc"
48 #include "libANGLE/renderer/vulkan/shaders/gen/BlitResolveStencilNoExport.comp.00000002.inc"
49 #include "libANGLE/renderer/vulkan/shaders/gen/BlitResolveStencilNoExport.comp.00000003.inc"
50 #include "libANGLE/renderer/vulkan/shaders/gen/ConvertIndex.comp.00000000.inc"
51 #include "libANGLE/renderer/vulkan/shaders/gen/ConvertIndex.comp.00000001.inc"
52 #include "libANGLE/renderer/vulkan/shaders/gen/ConvertIndex.comp.00000002.inc"
53 #include "libANGLE/renderer/vulkan/shaders/gen/ConvertIndex.comp.00000003.inc"
54 #include "libANGLE/renderer/vulkan/shaders/gen/ConvertIndexIndirectLineLoop.comp.00000000.inc"
55 #include "libANGLE/renderer/vulkan/shaders/gen/ConvertIndexIndirectLineLoop.comp.00000001.inc"
56 #include "libANGLE/renderer/vulkan/shaders/gen/ConvertIndexIndirectLineLoop.comp.00000002.inc"
57 #include "libANGLE/renderer/vulkan/shaders/gen/ConvertIndirectLineLoop.comp.00000000.inc"
58 #include "libANGLE/renderer/vulkan/shaders/gen/ConvertVertex.comp.00000000.inc"
59 #include "libANGLE/renderer/vulkan/shaders/gen/ConvertVertex.comp.00000001.inc"
60 #include "libANGLE/renderer/vulkan/shaders/gen/ConvertVertex.comp.00000002.inc"
61 #include "libANGLE/renderer/vulkan/shaders/gen/ConvertVertex.comp.00000003.inc"
62 #include "libANGLE/renderer/vulkan/shaders/gen/ConvertVertex.comp.00000004.inc"
63 #include "libANGLE/renderer/vulkan/shaders/gen/ConvertVertex.comp.00000005.inc"
64 #include "libANGLE/renderer/vulkan/shaders/gen/ConvertVertex.comp.00000006.inc"
65 #include "libANGLE/renderer/vulkan/shaders/gen/ConvertVertex.comp.00000007.inc"
66 #include "libANGLE/renderer/vulkan/shaders/gen/FullScreenQuad.vert.00000000.inc"
67 #include "libANGLE/renderer/vulkan/shaders/gen/GenerateMipmap.comp.00000000.inc"
68 #include "libANGLE/renderer/vulkan/shaders/gen/GenerateMipmap.comp.00000001.inc"
69 #include "libANGLE/renderer/vulkan/shaders/gen/GenerateMipmap.comp.00000002.inc"
70 #include "libANGLE/renderer/vulkan/shaders/gen/GenerateMipmap.comp.00000003.inc"
71 #include "libANGLE/renderer/vulkan/shaders/gen/GenerateMipmap.comp.00000004.inc"
72 #include "libANGLE/renderer/vulkan/shaders/gen/GenerateMipmap.comp.00000005.inc"
73 #include "libANGLE/renderer/vulkan/shaders/gen/GenerateMipmap.comp.00000006.inc"
74 #include "libANGLE/renderer/vulkan/shaders/gen/GenerateMipmap.comp.00000007.inc"
75 #include "libANGLE/renderer/vulkan/shaders/gen/GenerateMipmap.comp.00000008.inc"
76 #include "libANGLE/renderer/vulkan/shaders/gen/GenerateMipmap.comp.00000009.inc"
77 #include "libANGLE/renderer/vulkan/shaders/gen/ImageClear.frag.00000000.inc"
78 #include "libANGLE/renderer/vulkan/shaders/gen/ImageClear.frag.00000001.inc"
79 #include "libANGLE/renderer/vulkan/shaders/gen/ImageClear.frag.00000002.inc"
80 #include "libANGLE/renderer/vulkan/shaders/gen/ImageClear.frag.00000003.inc"
81 #include "libANGLE/renderer/vulkan/shaders/gen/ImageClear.frag.00000004.inc"
82 #include "libANGLE/renderer/vulkan/shaders/gen/ImageClear.frag.00000005.inc"
83 #include "libANGLE/renderer/vulkan/shaders/gen/ImageClear.frag.00000006.inc"
84 #include "libANGLE/renderer/vulkan/shaders/gen/ImageClear.frag.00000007.inc"
85 #include "libANGLE/renderer/vulkan/shaders/gen/ImageClear.frag.00000008.inc"
86 #include "libANGLE/renderer/vulkan/shaders/gen/ImageClear.frag.00000009.inc"
87 #include "libANGLE/renderer/vulkan/shaders/gen/ImageClear.frag.0000000A.inc"
88 #include "libANGLE/renderer/vulkan/shaders/gen/ImageClear.frag.0000000B.inc"
89 #include "libANGLE/renderer/vulkan/shaders/gen/ImageClear.frag.0000000C.inc"
90 #include "libANGLE/renderer/vulkan/shaders/gen/ImageClear.frag.0000000D.inc"
91 #include "libANGLE/renderer/vulkan/shaders/gen/ImageClear.frag.0000000E.inc"
92 #include "libANGLE/renderer/vulkan/shaders/gen/ImageClear.frag.0000000F.inc"
93 #include "libANGLE/renderer/vulkan/shaders/gen/ImageClear.frag.00000010.inc"
94 #include "libANGLE/renderer/vulkan/shaders/gen/ImageClear.frag.00000011.inc"
95 #include "libANGLE/renderer/vulkan/shaders/gen/ImageClear.frag.00000012.inc"
96 #include "libANGLE/renderer/vulkan/shaders/gen/ImageClear.frag.00000013.inc"
97 #include "libANGLE/renderer/vulkan/shaders/gen/ImageClear.frag.00000014.inc"
98 #include "libANGLE/renderer/vulkan/shaders/gen/ImageClear.frag.00000015.inc"
99 #include "libANGLE/renderer/vulkan/shaders/gen/ImageClear.frag.00000016.inc"
100 #include "libANGLE/renderer/vulkan/shaders/gen/ImageClear.frag.00000017.inc"
101 #include "libANGLE/renderer/vulkan/shaders/gen/ImageClear.frag.00000018.inc"
102 #include "libANGLE/renderer/vulkan/shaders/gen/ImageClear.frag.00000019.inc"
103 #include "libANGLE/renderer/vulkan/shaders/gen/ImageClear.frag.0000001A.inc"
104 #include "libANGLE/renderer/vulkan/shaders/gen/ImageClear.frag.0000001B.inc"
105 #include "libANGLE/renderer/vulkan/shaders/gen/ImageClear.frag.0000001C.inc"
106 #include "libANGLE/renderer/vulkan/shaders/gen/ImageClear.frag.0000001D.inc"
107 #include "libANGLE/renderer/vulkan/shaders/gen/ImageClear.frag.0000001E.inc"
108 #include "libANGLE/renderer/vulkan/shaders/gen/ImageClear.frag.0000001F.inc"
109 #include "libANGLE/renderer/vulkan/shaders/gen/ImageClear.frag.00000020.inc"
110 #include "libANGLE/renderer/vulkan/shaders/gen/ImageClear.frag.00000021.inc"
111 #include "libANGLE/renderer/vulkan/shaders/gen/ImageClear.frag.00000022.inc"
112 #include "libANGLE/renderer/vulkan/shaders/gen/ImageClear.frag.00000023.inc"
113 #include "libANGLE/renderer/vulkan/shaders/gen/ImageClear.frag.00000024.inc"
114 #include "libANGLE/renderer/vulkan/shaders/gen/ImageClear.frag.00000025.inc"
115 #include "libANGLE/renderer/vulkan/shaders/gen/ImageClear.frag.00000026.inc"
116 #include "libANGLE/renderer/vulkan/shaders/gen/ImageClear.frag.00000027.inc"
117 #include "libANGLE/renderer/vulkan/shaders/gen/ImageClear.frag.00000028.inc"
118 #include "libANGLE/renderer/vulkan/shaders/gen/ImageClear.frag.00000029.inc"
119 #include "libANGLE/renderer/vulkan/shaders/gen/ImageClear.frag.0000002A.inc"
120 #include "libANGLE/renderer/vulkan/shaders/gen/ImageClear.frag.0000002B.inc"
121 #include "libANGLE/renderer/vulkan/shaders/gen/ImageClear.frag.0000002C.inc"
122 #include "libANGLE/renderer/vulkan/shaders/gen/ImageClear.frag.0000002D.inc"
123 #include "libANGLE/renderer/vulkan/shaders/gen/ImageClear.frag.0000002E.inc"
124 #include "libANGLE/renderer/vulkan/shaders/gen/ImageClear.frag.0000002F.inc"
125 #include "libANGLE/renderer/vulkan/shaders/gen/ImageCopy.frag.00000000.inc"
126 #include "libANGLE/renderer/vulkan/shaders/gen/ImageCopy.frag.00000001.inc"
127 #include "libANGLE/renderer/vulkan/shaders/gen/ImageCopy.frag.00000002.inc"
128 #include "libANGLE/renderer/vulkan/shaders/gen/ImageCopy.frag.00000004.inc"
129 #include "libANGLE/renderer/vulkan/shaders/gen/ImageCopy.frag.00000005.inc"
130 #include "libANGLE/renderer/vulkan/shaders/gen/ImageCopy.frag.00000006.inc"
131 #include "libANGLE/renderer/vulkan/shaders/gen/ImageCopy.frag.00000008.inc"
132 #include "libANGLE/renderer/vulkan/shaders/gen/ImageCopy.frag.00000009.inc"
133 #include "libANGLE/renderer/vulkan/shaders/gen/ImageCopy.frag.0000000A.inc"
134 #include "libANGLE/renderer/vulkan/shaders/gen/ImageCopy.frag.00000010.inc"
135 #include "libANGLE/renderer/vulkan/shaders/gen/ImageCopy.frag.00000011.inc"
136 #include "libANGLE/renderer/vulkan/shaders/gen/ImageCopy.frag.00000012.inc"
137 #include "libANGLE/renderer/vulkan/shaders/gen/ImageCopy.frag.00000014.inc"
138 #include "libANGLE/renderer/vulkan/shaders/gen/ImageCopy.frag.00000015.inc"
139 #include "libANGLE/renderer/vulkan/shaders/gen/ImageCopy.frag.00000016.inc"
140 #include "libANGLE/renderer/vulkan/shaders/gen/ImageCopy.frag.00000018.inc"
141 #include "libANGLE/renderer/vulkan/shaders/gen/ImageCopy.frag.00000019.inc"
142 #include "libANGLE/renderer/vulkan/shaders/gen/ImageCopy.frag.0000001A.inc"
143 #include "libANGLE/renderer/vulkan/shaders/gen/ImageCopy.frag.00000020.inc"
144 #include "libANGLE/renderer/vulkan/shaders/gen/ImageCopy.frag.00000021.inc"
145 #include "libANGLE/renderer/vulkan/shaders/gen/ImageCopy.frag.00000022.inc"
146 #include "libANGLE/renderer/vulkan/shaders/gen/ImageCopy.frag.00000024.inc"
147 #include "libANGLE/renderer/vulkan/shaders/gen/ImageCopy.frag.00000025.inc"
148 #include "libANGLE/renderer/vulkan/shaders/gen/ImageCopy.frag.00000026.inc"
149 #include "libANGLE/renderer/vulkan/shaders/gen/ImageCopy.frag.00000028.inc"
150 #include "libANGLE/renderer/vulkan/shaders/gen/ImageCopy.frag.00000029.inc"
151 #include "libANGLE/renderer/vulkan/shaders/gen/ImageCopy.frag.0000002A.inc"
152 #include "libANGLE/renderer/vulkan/shaders/gen/OverlayCull.comp.00000000.inc"
153 #include "libANGLE/renderer/vulkan/shaders/gen/OverlayCull.comp.00000001.inc"
154 #include "libANGLE/renderer/vulkan/shaders/gen/OverlayCull.comp.00000002.inc"
155 #include "libANGLE/renderer/vulkan/shaders/gen/OverlayCull.comp.00000003.inc"
156 #include "libANGLE/renderer/vulkan/shaders/gen/OverlayCull.comp.00000004.inc"
157 #include "libANGLE/renderer/vulkan/shaders/gen/OverlayCull.comp.00000005.inc"
158 #include "libANGLE/renderer/vulkan/shaders/gen/OverlayDraw.comp.00000000.inc"
159 #include "libANGLE/renderer/vulkan/shaders/gen/OverlayDraw.comp.00000001.inc"
160
161 // This is compressed SPIR-V binary blob and size
162 struct CompressedShaderBlob
163 {
164 const uint8_t *code;
165 uint32_t size;
166 };
167
168 constexpr CompressedShaderBlob kBlitResolve_frag_shaders[] = {
169 {kBlitResolve_frag_00000000, sizeof(kBlitResolve_frag_00000000)},
170 {kBlitResolve_frag_00000001, sizeof(kBlitResolve_frag_00000001)},
171 {kBlitResolve_frag_00000002, sizeof(kBlitResolve_frag_00000002)},
172 {kBlitResolve_frag_00000003, sizeof(kBlitResolve_frag_00000003)},
173 {kBlitResolve_frag_00000004, sizeof(kBlitResolve_frag_00000004)},
174 {kBlitResolve_frag_00000005, sizeof(kBlitResolve_frag_00000005)},
175 {kBlitResolve_frag_00000006, sizeof(kBlitResolve_frag_00000006)},
176 {kBlitResolve_frag_00000007, sizeof(kBlitResolve_frag_00000007)},
177 {kBlitResolve_frag_00000008, sizeof(kBlitResolve_frag_00000008)},
178 {kBlitResolve_frag_00000009, sizeof(kBlitResolve_frag_00000009)},
179 {kBlitResolve_frag_0000000A, sizeof(kBlitResolve_frag_0000000A)},
180 {kBlitResolve_frag_0000000B, sizeof(kBlitResolve_frag_0000000B)},
181 {kBlitResolve_frag_0000000C, sizeof(kBlitResolve_frag_0000000C)},
182 {kBlitResolve_frag_0000000D, sizeof(kBlitResolve_frag_0000000D)},
183 {kBlitResolve_frag_0000000E, sizeof(kBlitResolve_frag_0000000E)},
184 {kBlitResolve_frag_0000000F, sizeof(kBlitResolve_frag_0000000F)},
185 {kBlitResolve_frag_00000010, sizeof(kBlitResolve_frag_00000010)},
186 {kBlitResolve_frag_00000011, sizeof(kBlitResolve_frag_00000011)},
187 {kBlitResolve_frag_00000012, sizeof(kBlitResolve_frag_00000012)},
188 {kBlitResolve_frag_00000013, sizeof(kBlitResolve_frag_00000013)},
189 {kBlitResolve_frag_00000014, sizeof(kBlitResolve_frag_00000014)},
190 {kBlitResolve_frag_00000015, sizeof(kBlitResolve_frag_00000015)},
191 {kBlitResolve_frag_00000016, sizeof(kBlitResolve_frag_00000016)},
192 {kBlitResolve_frag_00000017, sizeof(kBlitResolve_frag_00000017)},
193 };
194 constexpr CompressedShaderBlob kBlitResolveStencilNoExport_comp_shaders[] = {
195 {kBlitResolveStencilNoExport_comp_00000000, sizeof(kBlitResolveStencilNoExport_comp_00000000)},
196 {kBlitResolveStencilNoExport_comp_00000001, sizeof(kBlitResolveStencilNoExport_comp_00000001)},
197 {kBlitResolveStencilNoExport_comp_00000002, sizeof(kBlitResolveStencilNoExport_comp_00000002)},
198 {kBlitResolveStencilNoExport_comp_00000003, sizeof(kBlitResolveStencilNoExport_comp_00000003)},
199 };
200 constexpr CompressedShaderBlob kConvertIndex_comp_shaders[] = {
201 {kConvertIndex_comp_00000000, sizeof(kConvertIndex_comp_00000000)},
202 {kConvertIndex_comp_00000001, sizeof(kConvertIndex_comp_00000001)},
203 {kConvertIndex_comp_00000002, sizeof(kConvertIndex_comp_00000002)},
204 {kConvertIndex_comp_00000003, sizeof(kConvertIndex_comp_00000003)},
205 };
206 constexpr CompressedShaderBlob kConvertIndexIndirectLineLoop_comp_shaders[] = {
207 {kConvertIndexIndirectLineLoop_comp_00000000,
208 sizeof(kConvertIndexIndirectLineLoop_comp_00000000)},
209 {kConvertIndexIndirectLineLoop_comp_00000001,
210 sizeof(kConvertIndexIndirectLineLoop_comp_00000001)},
211 {kConvertIndexIndirectLineLoop_comp_00000002,
212 sizeof(kConvertIndexIndirectLineLoop_comp_00000002)},
213 };
214 constexpr CompressedShaderBlob kConvertIndirectLineLoop_comp_shaders[] = {
215 {kConvertIndirectLineLoop_comp_00000000, sizeof(kConvertIndirectLineLoop_comp_00000000)},
216 };
217 constexpr CompressedShaderBlob kConvertVertex_comp_shaders[] = {
218 {kConvertVertex_comp_00000000, sizeof(kConvertVertex_comp_00000000)},
219 {kConvertVertex_comp_00000001, sizeof(kConvertVertex_comp_00000001)},
220 {kConvertVertex_comp_00000002, sizeof(kConvertVertex_comp_00000002)},
221 {kConvertVertex_comp_00000003, sizeof(kConvertVertex_comp_00000003)},
222 {kConvertVertex_comp_00000004, sizeof(kConvertVertex_comp_00000004)},
223 {kConvertVertex_comp_00000005, sizeof(kConvertVertex_comp_00000005)},
224 {kConvertVertex_comp_00000006, sizeof(kConvertVertex_comp_00000006)},
225 {kConvertVertex_comp_00000007, sizeof(kConvertVertex_comp_00000007)},
226 };
227 constexpr CompressedShaderBlob kFullScreenQuad_vert_shaders[] = {
228 {kFullScreenQuad_vert_00000000, sizeof(kFullScreenQuad_vert_00000000)},
229 };
230 constexpr CompressedShaderBlob kGenerateMipmap_comp_shaders[] = {
231 {kGenerateMipmap_comp_00000000, sizeof(kGenerateMipmap_comp_00000000)},
232 {kGenerateMipmap_comp_00000001, sizeof(kGenerateMipmap_comp_00000001)},
233 {kGenerateMipmap_comp_00000002, sizeof(kGenerateMipmap_comp_00000002)},
234 {kGenerateMipmap_comp_00000003, sizeof(kGenerateMipmap_comp_00000003)},
235 {kGenerateMipmap_comp_00000004, sizeof(kGenerateMipmap_comp_00000004)},
236 {kGenerateMipmap_comp_00000005, sizeof(kGenerateMipmap_comp_00000005)},
237 {kGenerateMipmap_comp_00000006, sizeof(kGenerateMipmap_comp_00000006)},
238 {kGenerateMipmap_comp_00000007, sizeof(kGenerateMipmap_comp_00000007)},
239 {kGenerateMipmap_comp_00000008, sizeof(kGenerateMipmap_comp_00000008)},
240 {kGenerateMipmap_comp_00000009, sizeof(kGenerateMipmap_comp_00000009)},
241 };
242 constexpr CompressedShaderBlob kImageClear_frag_shaders[] = {
243 {kImageClear_frag_00000000, sizeof(kImageClear_frag_00000000)},
244 {kImageClear_frag_00000001, sizeof(kImageClear_frag_00000001)},
245 {kImageClear_frag_00000002, sizeof(kImageClear_frag_00000002)},
246 {kImageClear_frag_00000003, sizeof(kImageClear_frag_00000003)},
247 {kImageClear_frag_00000004, sizeof(kImageClear_frag_00000004)},
248 {kImageClear_frag_00000005, sizeof(kImageClear_frag_00000005)},
249 {kImageClear_frag_00000006, sizeof(kImageClear_frag_00000006)},
250 {kImageClear_frag_00000007, sizeof(kImageClear_frag_00000007)},
251 {kImageClear_frag_00000008, sizeof(kImageClear_frag_00000008)},
252 {kImageClear_frag_00000009, sizeof(kImageClear_frag_00000009)},
253 {kImageClear_frag_0000000A, sizeof(kImageClear_frag_0000000A)},
254 {kImageClear_frag_0000000B, sizeof(kImageClear_frag_0000000B)},
255 {kImageClear_frag_0000000C, sizeof(kImageClear_frag_0000000C)},
256 {kImageClear_frag_0000000D, sizeof(kImageClear_frag_0000000D)},
257 {kImageClear_frag_0000000E, sizeof(kImageClear_frag_0000000E)},
258 {kImageClear_frag_0000000F, sizeof(kImageClear_frag_0000000F)},
259 {kImageClear_frag_00000010, sizeof(kImageClear_frag_00000010)},
260 {kImageClear_frag_00000011, sizeof(kImageClear_frag_00000011)},
261 {kImageClear_frag_00000012, sizeof(kImageClear_frag_00000012)},
262 {kImageClear_frag_00000013, sizeof(kImageClear_frag_00000013)},
263 {kImageClear_frag_00000014, sizeof(kImageClear_frag_00000014)},
264 {kImageClear_frag_00000015, sizeof(kImageClear_frag_00000015)},
265 {kImageClear_frag_00000016, sizeof(kImageClear_frag_00000016)},
266 {kImageClear_frag_00000017, sizeof(kImageClear_frag_00000017)},
267 {kImageClear_frag_00000018, sizeof(kImageClear_frag_00000018)},
268 {kImageClear_frag_00000019, sizeof(kImageClear_frag_00000019)},
269 {kImageClear_frag_0000001A, sizeof(kImageClear_frag_0000001A)},
270 {kImageClear_frag_0000001B, sizeof(kImageClear_frag_0000001B)},
271 {kImageClear_frag_0000001C, sizeof(kImageClear_frag_0000001C)},
272 {kImageClear_frag_0000001D, sizeof(kImageClear_frag_0000001D)},
273 {kImageClear_frag_0000001E, sizeof(kImageClear_frag_0000001E)},
274 {kImageClear_frag_0000001F, sizeof(kImageClear_frag_0000001F)},
275 {kImageClear_frag_00000020, sizeof(kImageClear_frag_00000020)},
276 {kImageClear_frag_00000021, sizeof(kImageClear_frag_00000021)},
277 {kImageClear_frag_00000022, sizeof(kImageClear_frag_00000022)},
278 {kImageClear_frag_00000023, sizeof(kImageClear_frag_00000023)},
279 {kImageClear_frag_00000024, sizeof(kImageClear_frag_00000024)},
280 {kImageClear_frag_00000025, sizeof(kImageClear_frag_00000025)},
281 {kImageClear_frag_00000026, sizeof(kImageClear_frag_00000026)},
282 {kImageClear_frag_00000027, sizeof(kImageClear_frag_00000027)},
283 {kImageClear_frag_00000028, sizeof(kImageClear_frag_00000028)},
284 {kImageClear_frag_00000029, sizeof(kImageClear_frag_00000029)},
285 {kImageClear_frag_0000002A, sizeof(kImageClear_frag_0000002A)},
286 {kImageClear_frag_0000002B, sizeof(kImageClear_frag_0000002B)},
287 {kImageClear_frag_0000002C, sizeof(kImageClear_frag_0000002C)},
288 {kImageClear_frag_0000002D, sizeof(kImageClear_frag_0000002D)},
289 {kImageClear_frag_0000002E, sizeof(kImageClear_frag_0000002E)},
290 {kImageClear_frag_0000002F, sizeof(kImageClear_frag_0000002F)},
291 };
292 constexpr CompressedShaderBlob kImageCopy_frag_shaders[] = {
293 {kImageCopy_frag_00000000, sizeof(kImageCopy_frag_00000000)},
294 {kImageCopy_frag_00000001, sizeof(kImageCopy_frag_00000001)},
295 {kImageCopy_frag_00000002, sizeof(kImageCopy_frag_00000002)},
296 {nullptr, 0}, // 0x00000003
297 {kImageCopy_frag_00000004, sizeof(kImageCopy_frag_00000004)},
298 {kImageCopy_frag_00000005, sizeof(kImageCopy_frag_00000005)},
299 {kImageCopy_frag_00000006, sizeof(kImageCopy_frag_00000006)},
300 {nullptr, 0}, // 0x00000007
301 {kImageCopy_frag_00000008, sizeof(kImageCopy_frag_00000008)},
302 {kImageCopy_frag_00000009, sizeof(kImageCopy_frag_00000009)},
303 {kImageCopy_frag_0000000A, sizeof(kImageCopy_frag_0000000A)},
304 {nullptr, 0}, // 0x0000000B
305 {nullptr, 0}, // 0x0000000C
306 {nullptr, 0}, // 0x0000000D
307 {nullptr, 0}, // 0x0000000E
308 {nullptr, 0}, // 0x0000000F
309 {kImageCopy_frag_00000010, sizeof(kImageCopy_frag_00000010)},
310 {kImageCopy_frag_00000011, sizeof(kImageCopy_frag_00000011)},
311 {kImageCopy_frag_00000012, sizeof(kImageCopy_frag_00000012)},
312 {nullptr, 0}, // 0x00000013
313 {kImageCopy_frag_00000014, sizeof(kImageCopy_frag_00000014)},
314 {kImageCopy_frag_00000015, sizeof(kImageCopy_frag_00000015)},
315 {kImageCopy_frag_00000016, sizeof(kImageCopy_frag_00000016)},
316 {nullptr, 0}, // 0x00000017
317 {kImageCopy_frag_00000018, sizeof(kImageCopy_frag_00000018)},
318 {kImageCopy_frag_00000019, sizeof(kImageCopy_frag_00000019)},
319 {kImageCopy_frag_0000001A, sizeof(kImageCopy_frag_0000001A)},
320 {nullptr, 0}, // 0x0000001B
321 {nullptr, 0}, // 0x0000001C
322 {nullptr, 0}, // 0x0000001D
323 {nullptr, 0}, // 0x0000001E
324 {nullptr, 0}, // 0x0000001F
325 {kImageCopy_frag_00000020, sizeof(kImageCopy_frag_00000020)},
326 {kImageCopy_frag_00000021, sizeof(kImageCopy_frag_00000021)},
327 {kImageCopy_frag_00000022, sizeof(kImageCopy_frag_00000022)},
328 {nullptr, 0}, // 0x00000023
329 {kImageCopy_frag_00000024, sizeof(kImageCopy_frag_00000024)},
330 {kImageCopy_frag_00000025, sizeof(kImageCopy_frag_00000025)},
331 {kImageCopy_frag_00000026, sizeof(kImageCopy_frag_00000026)},
332 {nullptr, 0}, // 0x00000027
333 {kImageCopy_frag_00000028, sizeof(kImageCopy_frag_00000028)},
334 {kImageCopy_frag_00000029, sizeof(kImageCopy_frag_00000029)},
335 {kImageCopy_frag_0000002A, sizeof(kImageCopy_frag_0000002A)},
336 };
337 constexpr CompressedShaderBlob kOverlayCull_comp_shaders[] = {
338 {kOverlayCull_comp_00000000, sizeof(kOverlayCull_comp_00000000)},
339 {kOverlayCull_comp_00000001, sizeof(kOverlayCull_comp_00000001)},
340 {kOverlayCull_comp_00000002, sizeof(kOverlayCull_comp_00000002)},
341 {kOverlayCull_comp_00000003, sizeof(kOverlayCull_comp_00000003)},
342 {kOverlayCull_comp_00000004, sizeof(kOverlayCull_comp_00000004)},
343 {kOverlayCull_comp_00000005, sizeof(kOverlayCull_comp_00000005)},
344 };
345 constexpr CompressedShaderBlob kOverlayDraw_comp_shaders[] = {
346 {kOverlayDraw_comp_00000000, sizeof(kOverlayDraw_comp_00000000)},
347 {kOverlayDraw_comp_00000001, sizeof(kOverlayDraw_comp_00000001)},
348 };
349
GetShader(Context * context,RefCounted<ShaderAndSerial> * shaders,const CompressedShaderBlob * compressedShaderBlobs,size_t shadersCount,uint32_t shaderFlags,RefCounted<ShaderAndSerial> ** shaderOut)350 angle::Result GetShader(Context *context,
351 RefCounted<ShaderAndSerial> *shaders,
352 const CompressedShaderBlob *compressedShaderBlobs,
353 size_t shadersCount,
354 uint32_t shaderFlags,
355 RefCounted<ShaderAndSerial> **shaderOut)
356 {
357 ASSERT(shaderFlags < shadersCount);
358 RefCounted<ShaderAndSerial> &shader = shaders[shaderFlags];
359 *shaderOut = &shader;
360
361 if (shader.get().valid())
362 {
363 return angle::Result::Continue;
364 }
365
366 // Create shader lazily. Access will need to be locked for multi-threading.
367 const CompressedShaderBlob &compressedShaderCode = compressedShaderBlobs[shaderFlags];
368 ASSERT(compressedShaderCode.code != nullptr);
369
370 uLong uncompressedSize = zlib_internal::GetGzipUncompressedSize(compressedShaderCode.code,
371 compressedShaderCode.size);
372 std::vector<uint32_t> shaderCode((uncompressedSize + 3) / 4, 0);
373
374 // Note: we assume a little-endian environment throughout ANGLE.
375 int zResult = zlib_internal::GzipUncompressHelper(
376 reinterpret_cast<uint8_t *>(shaderCode.data()), &uncompressedSize,
377 compressedShaderCode.code, compressedShaderCode.size);
378
379 if (zResult != Z_OK)
380 {
381 ERR() << "Failure to decompressed internal shader: " << zResult << "\n";
382 return angle::Result::Stop;
383 }
384
385 return InitShaderAndSerial(context, &shader.get(), shaderCode.data(), shaderCode.size() * 4);
386 }
387 } // anonymous namespace
388
ShaderLibrary()389 ShaderLibrary::ShaderLibrary() {}
390
~ShaderLibrary()391 ShaderLibrary::~ShaderLibrary() {}
392
destroy(VkDevice device)393 void ShaderLibrary::destroy(VkDevice device)
394 {
395 for (RefCounted<ShaderAndSerial> &shader : mBlitResolve_frag_shaders)
396 {
397 shader.get().destroy(device);
398 }
399 for (RefCounted<ShaderAndSerial> &shader : mBlitResolveStencilNoExport_comp_shaders)
400 {
401 shader.get().destroy(device);
402 }
403 for (RefCounted<ShaderAndSerial> &shader : mConvertIndex_comp_shaders)
404 {
405 shader.get().destroy(device);
406 }
407 for (RefCounted<ShaderAndSerial> &shader : mConvertIndexIndirectLineLoop_comp_shaders)
408 {
409 shader.get().destroy(device);
410 }
411 for (RefCounted<ShaderAndSerial> &shader : mConvertIndirectLineLoop_comp_shaders)
412 {
413 shader.get().destroy(device);
414 }
415 for (RefCounted<ShaderAndSerial> &shader : mConvertVertex_comp_shaders)
416 {
417 shader.get().destroy(device);
418 }
419 for (RefCounted<ShaderAndSerial> &shader : mFullScreenQuad_vert_shaders)
420 {
421 shader.get().destroy(device);
422 }
423 for (RefCounted<ShaderAndSerial> &shader : mGenerateMipmap_comp_shaders)
424 {
425 shader.get().destroy(device);
426 }
427 for (RefCounted<ShaderAndSerial> &shader : mImageClear_frag_shaders)
428 {
429 shader.get().destroy(device);
430 }
431 for (RefCounted<ShaderAndSerial> &shader : mImageCopy_frag_shaders)
432 {
433 shader.get().destroy(device);
434 }
435 for (RefCounted<ShaderAndSerial> &shader : mOverlayCull_comp_shaders)
436 {
437 shader.get().destroy(device);
438 }
439 for (RefCounted<ShaderAndSerial> &shader : mOverlayDraw_comp_shaders)
440 {
441 shader.get().destroy(device);
442 }
443 }
444
getBlitResolve_frag(Context * context,uint32_t shaderFlags,RefCounted<ShaderAndSerial> ** shaderOut)445 angle::Result ShaderLibrary::getBlitResolve_frag(Context *context,
446 uint32_t shaderFlags,
447 RefCounted<ShaderAndSerial> **shaderOut)
448 {
449 return GetShader(context, mBlitResolve_frag_shaders, kBlitResolve_frag_shaders,
450 ArraySize(kBlitResolve_frag_shaders), shaderFlags, shaderOut);
451 }
452
getBlitResolveStencilNoExport_comp(Context * context,uint32_t shaderFlags,RefCounted<ShaderAndSerial> ** shaderOut)453 angle::Result ShaderLibrary::getBlitResolveStencilNoExport_comp(
454 Context *context,
455 uint32_t shaderFlags,
456 RefCounted<ShaderAndSerial> **shaderOut)
457 {
458 return GetShader(context, mBlitResolveStencilNoExport_comp_shaders,
459 kBlitResolveStencilNoExport_comp_shaders,
460 ArraySize(kBlitResolveStencilNoExport_comp_shaders), shaderFlags, shaderOut);
461 }
462
getConvertIndex_comp(Context * context,uint32_t shaderFlags,RefCounted<ShaderAndSerial> ** shaderOut)463 angle::Result ShaderLibrary::getConvertIndex_comp(Context *context,
464 uint32_t shaderFlags,
465 RefCounted<ShaderAndSerial> **shaderOut)
466 {
467 return GetShader(context, mConvertIndex_comp_shaders, kConvertIndex_comp_shaders,
468 ArraySize(kConvertIndex_comp_shaders), shaderFlags, shaderOut);
469 }
470
getConvertIndexIndirectLineLoop_comp(Context * context,uint32_t shaderFlags,RefCounted<ShaderAndSerial> ** shaderOut)471 angle::Result ShaderLibrary::getConvertIndexIndirectLineLoop_comp(
472 Context *context,
473 uint32_t shaderFlags,
474 RefCounted<ShaderAndSerial> **shaderOut)
475 {
476 return GetShader(context, mConvertIndexIndirectLineLoop_comp_shaders,
477 kConvertIndexIndirectLineLoop_comp_shaders,
478 ArraySize(kConvertIndexIndirectLineLoop_comp_shaders), shaderFlags, shaderOut);
479 }
480
getConvertIndirectLineLoop_comp(Context * context,uint32_t shaderFlags,RefCounted<ShaderAndSerial> ** shaderOut)481 angle::Result ShaderLibrary::getConvertIndirectLineLoop_comp(
482 Context *context,
483 uint32_t shaderFlags,
484 RefCounted<ShaderAndSerial> **shaderOut)
485 {
486 return GetShader(context, mConvertIndirectLineLoop_comp_shaders,
487 kConvertIndirectLineLoop_comp_shaders,
488 ArraySize(kConvertIndirectLineLoop_comp_shaders), shaderFlags, shaderOut);
489 }
490
getConvertVertex_comp(Context * context,uint32_t shaderFlags,RefCounted<ShaderAndSerial> ** shaderOut)491 angle::Result ShaderLibrary::getConvertVertex_comp(Context *context,
492 uint32_t shaderFlags,
493 RefCounted<ShaderAndSerial> **shaderOut)
494 {
495 return GetShader(context, mConvertVertex_comp_shaders, kConvertVertex_comp_shaders,
496 ArraySize(kConvertVertex_comp_shaders), shaderFlags, shaderOut);
497 }
498
getFullScreenQuad_vert(Context * context,uint32_t shaderFlags,RefCounted<ShaderAndSerial> ** shaderOut)499 angle::Result ShaderLibrary::getFullScreenQuad_vert(Context *context,
500 uint32_t shaderFlags,
501 RefCounted<ShaderAndSerial> **shaderOut)
502 {
503 return GetShader(context, mFullScreenQuad_vert_shaders, kFullScreenQuad_vert_shaders,
504 ArraySize(kFullScreenQuad_vert_shaders), shaderFlags, shaderOut);
505 }
506
getGenerateMipmap_comp(Context * context,uint32_t shaderFlags,RefCounted<ShaderAndSerial> ** shaderOut)507 angle::Result ShaderLibrary::getGenerateMipmap_comp(Context *context,
508 uint32_t shaderFlags,
509 RefCounted<ShaderAndSerial> **shaderOut)
510 {
511 return GetShader(context, mGenerateMipmap_comp_shaders, kGenerateMipmap_comp_shaders,
512 ArraySize(kGenerateMipmap_comp_shaders), shaderFlags, shaderOut);
513 }
514
getImageClear_frag(Context * context,uint32_t shaderFlags,RefCounted<ShaderAndSerial> ** shaderOut)515 angle::Result ShaderLibrary::getImageClear_frag(Context *context,
516 uint32_t shaderFlags,
517 RefCounted<ShaderAndSerial> **shaderOut)
518 {
519 return GetShader(context, mImageClear_frag_shaders, kImageClear_frag_shaders,
520 ArraySize(kImageClear_frag_shaders), shaderFlags, shaderOut);
521 }
522
getImageCopy_frag(Context * context,uint32_t shaderFlags,RefCounted<ShaderAndSerial> ** shaderOut)523 angle::Result ShaderLibrary::getImageCopy_frag(Context *context,
524 uint32_t shaderFlags,
525 RefCounted<ShaderAndSerial> **shaderOut)
526 {
527 return GetShader(context, mImageCopy_frag_shaders, kImageCopy_frag_shaders,
528 ArraySize(kImageCopy_frag_shaders), shaderFlags, shaderOut);
529 }
530
getOverlayCull_comp(Context * context,uint32_t shaderFlags,RefCounted<ShaderAndSerial> ** shaderOut)531 angle::Result ShaderLibrary::getOverlayCull_comp(Context *context,
532 uint32_t shaderFlags,
533 RefCounted<ShaderAndSerial> **shaderOut)
534 {
535 return GetShader(context, mOverlayCull_comp_shaders, kOverlayCull_comp_shaders,
536 ArraySize(kOverlayCull_comp_shaders), shaderFlags, shaderOut);
537 }
538
getOverlayDraw_comp(Context * context,uint32_t shaderFlags,RefCounted<ShaderAndSerial> ** shaderOut)539 angle::Result ShaderLibrary::getOverlayDraw_comp(Context *context,
540 uint32_t shaderFlags,
541 RefCounted<ShaderAndSerial> **shaderOut)
542 {
543 return GetShader(context, mOverlayDraw_comp_shaders, kOverlayDraw_comp_shaders,
544 ArraySize(kOverlayDraw_comp_shaders), shaderFlags, shaderOut);
545 }
546
547 } // namespace vk
548 } // namespace rx
549