• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // GENERATED FILE - DO NOT EDIT.
2 // Generated by gen_vk_internal_shaders.py using data from shaders/src/*
3 //
4 // Copyright 2020 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 namespace rx
14 {
15 namespace vk
16 {
17 namespace
18 {
19 #include "libANGLE/renderer/vulkan/shaders/gen/BlitResolve.frag.00000000.inc"
20 #include "libANGLE/renderer/vulkan/shaders/gen/BlitResolve.frag.00000001.inc"
21 #include "libANGLE/renderer/vulkan/shaders/gen/BlitResolve.frag.00000002.inc"
22 #include "libANGLE/renderer/vulkan/shaders/gen/BlitResolve.frag.00000003.inc"
23 #include "libANGLE/renderer/vulkan/shaders/gen/BlitResolve.frag.00000004.inc"
24 #include "libANGLE/renderer/vulkan/shaders/gen/BlitResolve.frag.00000005.inc"
25 #include "libANGLE/renderer/vulkan/shaders/gen/BlitResolve.frag.00000006.inc"
26 #include "libANGLE/renderer/vulkan/shaders/gen/BlitResolve.frag.00000007.inc"
27 #include "libANGLE/renderer/vulkan/shaders/gen/BlitResolve.frag.00000008.inc"
28 #include "libANGLE/renderer/vulkan/shaders/gen/BlitResolve.frag.00000009.inc"
29 #include "libANGLE/renderer/vulkan/shaders/gen/BlitResolve.frag.0000000A.inc"
30 #include "libANGLE/renderer/vulkan/shaders/gen/BlitResolve.frag.0000000B.inc"
31 #include "libANGLE/renderer/vulkan/shaders/gen/BlitResolve.frag.0000000C.inc"
32 #include "libANGLE/renderer/vulkan/shaders/gen/BlitResolve.frag.0000000D.inc"
33 #include "libANGLE/renderer/vulkan/shaders/gen/BlitResolve.frag.0000000E.inc"
34 #include "libANGLE/renderer/vulkan/shaders/gen/BlitResolve.frag.0000000F.inc"
35 #include "libANGLE/renderer/vulkan/shaders/gen/BlitResolve.frag.00000010.inc"
36 #include "libANGLE/renderer/vulkan/shaders/gen/BlitResolve.frag.00000011.inc"
37 #include "libANGLE/renderer/vulkan/shaders/gen/BlitResolve.frag.00000012.inc"
38 #include "libANGLE/renderer/vulkan/shaders/gen/BlitResolve.frag.00000013.inc"
39 #include "libANGLE/renderer/vulkan/shaders/gen/BlitResolve.frag.00000014.inc"
40 #include "libANGLE/renderer/vulkan/shaders/gen/BlitResolve.frag.00000015.inc"
41 #include "libANGLE/renderer/vulkan/shaders/gen/BlitResolve.frag.00000016.inc"
42 #include "libANGLE/renderer/vulkan/shaders/gen/BlitResolve.frag.00000017.inc"
43 #include "libANGLE/renderer/vulkan/shaders/gen/BlitResolveStencilNoExport.comp.00000000.inc"
44 #include "libANGLE/renderer/vulkan/shaders/gen/BlitResolveStencilNoExport.comp.00000001.inc"
45 #include "libANGLE/renderer/vulkan/shaders/gen/BlitResolveStencilNoExport.comp.00000002.inc"
46 #include "libANGLE/renderer/vulkan/shaders/gen/BlitResolveStencilNoExport.comp.00000003.inc"
47 #include "libANGLE/renderer/vulkan/shaders/gen/BufferUtils.comp.00000000.inc"
48 #include "libANGLE/renderer/vulkan/shaders/gen/BufferUtils.comp.00000001.inc"
49 #include "libANGLE/renderer/vulkan/shaders/gen/BufferUtils.comp.00000002.inc"
50 #include "libANGLE/renderer/vulkan/shaders/gen/BufferUtils.comp.00000003.inc"
51 #include "libANGLE/renderer/vulkan/shaders/gen/BufferUtils.comp.00000004.inc"
52 #include "libANGLE/renderer/vulkan/shaders/gen/BufferUtils.comp.00000005.inc"
53 #include "libANGLE/renderer/vulkan/shaders/gen/BufferUtils.comp.00000006.inc"
54 #include "libANGLE/renderer/vulkan/shaders/gen/BufferUtils.comp.00000007.inc"
55 #include "libANGLE/renderer/vulkan/shaders/gen/BufferUtils.comp.00000008.inc"
56 #include "libANGLE/renderer/vulkan/shaders/gen/BufferUtils.comp.00000009.inc"
57 #include "libANGLE/renderer/vulkan/shaders/gen/BufferUtils.comp.0000000A.inc"
58 #include "libANGLE/renderer/vulkan/shaders/gen/BufferUtils.comp.0000000B.inc"
59 #include "libANGLE/renderer/vulkan/shaders/gen/ConvertIndex.comp.00000000.inc"
60 #include "libANGLE/renderer/vulkan/shaders/gen/ConvertIndex.comp.00000001.inc"
61 #include "libANGLE/renderer/vulkan/shaders/gen/ConvertIndex.comp.00000002.inc"
62 #include "libANGLE/renderer/vulkan/shaders/gen/ConvertIndex.comp.00000003.inc"
63 #include "libANGLE/renderer/vulkan/shaders/gen/ConvertIndexIndirectLineLoop.comp.00000000.inc"
64 #include "libANGLE/renderer/vulkan/shaders/gen/ConvertIndexIndirectLineLoop.comp.00000001.inc"
65 #include "libANGLE/renderer/vulkan/shaders/gen/ConvertIndexIndirectLineLoop.comp.00000002.inc"
66 #include "libANGLE/renderer/vulkan/shaders/gen/ConvertIndirectLineLoop.comp.00000000.inc"
67 #include "libANGLE/renderer/vulkan/shaders/gen/ConvertVertex.comp.00000000.inc"
68 #include "libANGLE/renderer/vulkan/shaders/gen/ConvertVertex.comp.00000001.inc"
69 #include "libANGLE/renderer/vulkan/shaders/gen/ConvertVertex.comp.00000002.inc"
70 #include "libANGLE/renderer/vulkan/shaders/gen/ConvertVertex.comp.00000003.inc"
71 #include "libANGLE/renderer/vulkan/shaders/gen/ConvertVertex.comp.00000004.inc"
72 #include "libANGLE/renderer/vulkan/shaders/gen/ConvertVertex.comp.00000005.inc"
73 #include "libANGLE/renderer/vulkan/shaders/gen/ConvertVertex.comp.00000006.inc"
74 #include "libANGLE/renderer/vulkan/shaders/gen/ConvertVertex.comp.00000007.inc"
75 #include "libANGLE/renderer/vulkan/shaders/gen/ConvertVertex.comp.00000008.inc"
76 #include "libANGLE/renderer/vulkan/shaders/gen/ConvertVertex.comp.00000009.inc"
77 #include "libANGLE/renderer/vulkan/shaders/gen/ConvertVertex.comp.0000000A.inc"
78 #include "libANGLE/renderer/vulkan/shaders/gen/ConvertVertex.comp.0000000B.inc"
79 #include "libANGLE/renderer/vulkan/shaders/gen/ConvertVertex.comp.0000000C.inc"
80 #include "libANGLE/renderer/vulkan/shaders/gen/ConvertVertex.comp.0000000D.inc"
81 #include "libANGLE/renderer/vulkan/shaders/gen/ConvertVertex.comp.0000000E.inc"
82 #include "libANGLE/renderer/vulkan/shaders/gen/ConvertVertex.comp.0000000F.inc"
83 #include "libANGLE/renderer/vulkan/shaders/gen/ConvertVertex.comp.00000010.inc"
84 #include "libANGLE/renderer/vulkan/shaders/gen/FullScreenQuad.vert.00000000.inc"
85 #include "libANGLE/renderer/vulkan/shaders/gen/ImageClear.frag.00000000.inc"
86 #include "libANGLE/renderer/vulkan/shaders/gen/ImageClear.frag.00000001.inc"
87 #include "libANGLE/renderer/vulkan/shaders/gen/ImageClear.frag.00000002.inc"
88 #include "libANGLE/renderer/vulkan/shaders/gen/ImageClear.frag.00000003.inc"
89 #include "libANGLE/renderer/vulkan/shaders/gen/ImageClear.frag.00000004.inc"
90 #include "libANGLE/renderer/vulkan/shaders/gen/ImageClear.frag.00000005.inc"
91 #include "libANGLE/renderer/vulkan/shaders/gen/ImageClear.frag.00000006.inc"
92 #include "libANGLE/renderer/vulkan/shaders/gen/ImageClear.frag.00000007.inc"
93 #include "libANGLE/renderer/vulkan/shaders/gen/ImageClear.frag.00000008.inc"
94 #include "libANGLE/renderer/vulkan/shaders/gen/ImageClear.frag.00000009.inc"
95 #include "libANGLE/renderer/vulkan/shaders/gen/ImageClear.frag.0000000A.inc"
96 #include "libANGLE/renderer/vulkan/shaders/gen/ImageClear.frag.0000000B.inc"
97 #include "libANGLE/renderer/vulkan/shaders/gen/ImageClear.frag.0000000C.inc"
98 #include "libANGLE/renderer/vulkan/shaders/gen/ImageClear.frag.0000000D.inc"
99 #include "libANGLE/renderer/vulkan/shaders/gen/ImageClear.frag.0000000E.inc"
100 #include "libANGLE/renderer/vulkan/shaders/gen/ImageClear.frag.0000000F.inc"
101 #include "libANGLE/renderer/vulkan/shaders/gen/ImageClear.frag.00000010.inc"
102 #include "libANGLE/renderer/vulkan/shaders/gen/ImageClear.frag.00000011.inc"
103 #include "libANGLE/renderer/vulkan/shaders/gen/ImageClear.frag.00000012.inc"
104 #include "libANGLE/renderer/vulkan/shaders/gen/ImageClear.frag.00000013.inc"
105 #include "libANGLE/renderer/vulkan/shaders/gen/ImageClear.frag.00000014.inc"
106 #include "libANGLE/renderer/vulkan/shaders/gen/ImageClear.frag.00000015.inc"
107 #include "libANGLE/renderer/vulkan/shaders/gen/ImageClear.frag.00000016.inc"
108 #include "libANGLE/renderer/vulkan/shaders/gen/ImageClear.frag.00000017.inc"
109 #include "libANGLE/renderer/vulkan/shaders/gen/ImageCopy.frag.00000000.inc"
110 #include "libANGLE/renderer/vulkan/shaders/gen/ImageCopy.frag.00000001.inc"
111 #include "libANGLE/renderer/vulkan/shaders/gen/ImageCopy.frag.00000002.inc"
112 #include "libANGLE/renderer/vulkan/shaders/gen/ImageCopy.frag.00000003.inc"
113 #include "libANGLE/renderer/vulkan/shaders/gen/ImageCopy.frag.00000004.inc"
114 #include "libANGLE/renderer/vulkan/shaders/gen/ImageCopy.frag.00000005.inc"
115 #include "libANGLE/renderer/vulkan/shaders/gen/ImageCopy.frag.00000008.inc"
116 #include "libANGLE/renderer/vulkan/shaders/gen/ImageCopy.frag.00000009.inc"
117 #include "libANGLE/renderer/vulkan/shaders/gen/ImageCopy.frag.0000000A.inc"
118 #include "libANGLE/renderer/vulkan/shaders/gen/ImageCopy.frag.0000000B.inc"
119 #include "libANGLE/renderer/vulkan/shaders/gen/ImageCopy.frag.0000000C.inc"
120 #include "libANGLE/renderer/vulkan/shaders/gen/ImageCopy.frag.0000000D.inc"
121 #include "libANGLE/renderer/vulkan/shaders/gen/ImageCopy.frag.00000010.inc"
122 #include "libANGLE/renderer/vulkan/shaders/gen/ImageCopy.frag.00000011.inc"
123 #include "libANGLE/renderer/vulkan/shaders/gen/ImageCopy.frag.00000012.inc"
124 #include "libANGLE/renderer/vulkan/shaders/gen/ImageCopy.frag.00000013.inc"
125 #include "libANGLE/renderer/vulkan/shaders/gen/ImageCopy.frag.00000014.inc"
126 #include "libANGLE/renderer/vulkan/shaders/gen/ImageCopy.frag.00000015.inc"
127 #include "libANGLE/renderer/vulkan/shaders/gen/OverlayCull.comp.00000000.inc"
128 #include "libANGLE/renderer/vulkan/shaders/gen/OverlayCull.comp.00000001.inc"
129 #include "libANGLE/renderer/vulkan/shaders/gen/OverlayCull.comp.00000002.inc"
130 #include "libANGLE/renderer/vulkan/shaders/gen/OverlayCull.comp.00000003.inc"
131 #include "libANGLE/renderer/vulkan/shaders/gen/OverlayCull.comp.00000004.inc"
132 #include "libANGLE/renderer/vulkan/shaders/gen/OverlayCull.comp.00000005.inc"
133 #include "libANGLE/renderer/vulkan/shaders/gen/OverlayDraw.comp.00000000.inc"
134 #include "libANGLE/renderer/vulkan/shaders/gen/OverlayDraw.comp.00000001.inc"
135 
136 // This is SPIR-V binary blob and the size.
137 struct ShaderBlob
138 {
139     const uint32_t *code;
140     size_t codeSize;
141 };
142 
143 constexpr ShaderBlob kBlitResolve_frag_shaders[] = {
144     {kBlitResolve_frag_00000000, sizeof(kBlitResolve_frag_00000000)},
145     {kBlitResolve_frag_00000001, sizeof(kBlitResolve_frag_00000001)},
146     {kBlitResolve_frag_00000002, sizeof(kBlitResolve_frag_00000002)},
147     {kBlitResolve_frag_00000003, sizeof(kBlitResolve_frag_00000003)},
148     {kBlitResolve_frag_00000004, sizeof(kBlitResolve_frag_00000004)},
149     {kBlitResolve_frag_00000005, sizeof(kBlitResolve_frag_00000005)},
150     {kBlitResolve_frag_00000006, sizeof(kBlitResolve_frag_00000006)},
151     {kBlitResolve_frag_00000007, sizeof(kBlitResolve_frag_00000007)},
152     {kBlitResolve_frag_00000008, sizeof(kBlitResolve_frag_00000008)},
153     {kBlitResolve_frag_00000009, sizeof(kBlitResolve_frag_00000009)},
154     {kBlitResolve_frag_0000000A, sizeof(kBlitResolve_frag_0000000A)},
155     {kBlitResolve_frag_0000000B, sizeof(kBlitResolve_frag_0000000B)},
156     {kBlitResolve_frag_0000000C, sizeof(kBlitResolve_frag_0000000C)},
157     {kBlitResolve_frag_0000000D, sizeof(kBlitResolve_frag_0000000D)},
158     {kBlitResolve_frag_0000000E, sizeof(kBlitResolve_frag_0000000E)},
159     {kBlitResolve_frag_0000000F, sizeof(kBlitResolve_frag_0000000F)},
160     {kBlitResolve_frag_00000010, sizeof(kBlitResolve_frag_00000010)},
161     {kBlitResolve_frag_00000011, sizeof(kBlitResolve_frag_00000011)},
162     {kBlitResolve_frag_00000012, sizeof(kBlitResolve_frag_00000012)},
163     {kBlitResolve_frag_00000013, sizeof(kBlitResolve_frag_00000013)},
164     {kBlitResolve_frag_00000014, sizeof(kBlitResolve_frag_00000014)},
165     {kBlitResolve_frag_00000015, sizeof(kBlitResolve_frag_00000015)},
166     {kBlitResolve_frag_00000016, sizeof(kBlitResolve_frag_00000016)},
167     {kBlitResolve_frag_00000017, sizeof(kBlitResolve_frag_00000017)},
168 };
169 constexpr ShaderBlob kBlitResolveStencilNoExport_comp_shaders[] = {
170     {kBlitResolveStencilNoExport_comp_00000000, sizeof(kBlitResolveStencilNoExport_comp_00000000)},
171     {kBlitResolveStencilNoExport_comp_00000001, sizeof(kBlitResolveStencilNoExport_comp_00000001)},
172     {kBlitResolveStencilNoExport_comp_00000002, sizeof(kBlitResolveStencilNoExport_comp_00000002)},
173     {kBlitResolveStencilNoExport_comp_00000003, sizeof(kBlitResolveStencilNoExport_comp_00000003)},
174 };
175 constexpr ShaderBlob kBufferUtils_comp_shaders[] = {
176     {kBufferUtils_comp_00000000, sizeof(kBufferUtils_comp_00000000)},
177     {kBufferUtils_comp_00000001, sizeof(kBufferUtils_comp_00000001)},
178     {kBufferUtils_comp_00000002, sizeof(kBufferUtils_comp_00000002)},
179     {kBufferUtils_comp_00000003, sizeof(kBufferUtils_comp_00000003)},
180     {kBufferUtils_comp_00000004, sizeof(kBufferUtils_comp_00000004)},
181     {kBufferUtils_comp_00000005, sizeof(kBufferUtils_comp_00000005)},
182     {kBufferUtils_comp_00000006, sizeof(kBufferUtils_comp_00000006)},
183     {kBufferUtils_comp_00000007, sizeof(kBufferUtils_comp_00000007)},
184     {kBufferUtils_comp_00000008, sizeof(kBufferUtils_comp_00000008)},
185     {kBufferUtils_comp_00000009, sizeof(kBufferUtils_comp_00000009)},
186     {kBufferUtils_comp_0000000A, sizeof(kBufferUtils_comp_0000000A)},
187     {kBufferUtils_comp_0000000B, sizeof(kBufferUtils_comp_0000000B)},
188 };
189 constexpr ShaderBlob kConvertIndex_comp_shaders[] = {
190     {kConvertIndex_comp_00000000, sizeof(kConvertIndex_comp_00000000)},
191     {kConvertIndex_comp_00000001, sizeof(kConvertIndex_comp_00000001)},
192     {kConvertIndex_comp_00000002, sizeof(kConvertIndex_comp_00000002)},
193     {kConvertIndex_comp_00000003, sizeof(kConvertIndex_comp_00000003)},
194 };
195 constexpr ShaderBlob kConvertIndexIndirectLineLoop_comp_shaders[] = {
196     {kConvertIndexIndirectLineLoop_comp_00000000,
197      sizeof(kConvertIndexIndirectLineLoop_comp_00000000)},
198     {kConvertIndexIndirectLineLoop_comp_00000001,
199      sizeof(kConvertIndexIndirectLineLoop_comp_00000001)},
200     {kConvertIndexIndirectLineLoop_comp_00000002,
201      sizeof(kConvertIndexIndirectLineLoop_comp_00000002)},
202 };
203 constexpr ShaderBlob kConvertIndirectLineLoop_comp_shaders[] = {
204     {kConvertIndirectLineLoop_comp_00000000, sizeof(kConvertIndirectLineLoop_comp_00000000)},
205 };
206 constexpr ShaderBlob kConvertVertex_comp_shaders[] = {
207     {kConvertVertex_comp_00000000, sizeof(kConvertVertex_comp_00000000)},
208     {kConvertVertex_comp_00000001, sizeof(kConvertVertex_comp_00000001)},
209     {kConvertVertex_comp_00000002, sizeof(kConvertVertex_comp_00000002)},
210     {kConvertVertex_comp_00000003, sizeof(kConvertVertex_comp_00000003)},
211     {kConvertVertex_comp_00000004, sizeof(kConvertVertex_comp_00000004)},
212     {kConvertVertex_comp_00000005, sizeof(kConvertVertex_comp_00000005)},
213     {kConvertVertex_comp_00000006, sizeof(kConvertVertex_comp_00000006)},
214     {kConvertVertex_comp_00000007, sizeof(kConvertVertex_comp_00000007)},
215     {kConvertVertex_comp_00000008, sizeof(kConvertVertex_comp_00000008)},
216     {kConvertVertex_comp_00000009, sizeof(kConvertVertex_comp_00000009)},
217     {kConvertVertex_comp_0000000A, sizeof(kConvertVertex_comp_0000000A)},
218     {kConvertVertex_comp_0000000B, sizeof(kConvertVertex_comp_0000000B)},
219     {kConvertVertex_comp_0000000C, sizeof(kConvertVertex_comp_0000000C)},
220     {kConvertVertex_comp_0000000D, sizeof(kConvertVertex_comp_0000000D)},
221     {kConvertVertex_comp_0000000E, sizeof(kConvertVertex_comp_0000000E)},
222     {kConvertVertex_comp_0000000F, sizeof(kConvertVertex_comp_0000000F)},
223     {kConvertVertex_comp_00000010, sizeof(kConvertVertex_comp_00000010)},
224 };
225 constexpr ShaderBlob kFullScreenQuad_vert_shaders[] = {
226     {kFullScreenQuad_vert_00000000, sizeof(kFullScreenQuad_vert_00000000)},
227 };
228 constexpr ShaderBlob kImageClear_frag_shaders[] = {
229     {kImageClear_frag_00000000, sizeof(kImageClear_frag_00000000)},
230     {kImageClear_frag_00000001, sizeof(kImageClear_frag_00000001)},
231     {kImageClear_frag_00000002, sizeof(kImageClear_frag_00000002)},
232     {kImageClear_frag_00000003, sizeof(kImageClear_frag_00000003)},
233     {kImageClear_frag_00000004, sizeof(kImageClear_frag_00000004)},
234     {kImageClear_frag_00000005, sizeof(kImageClear_frag_00000005)},
235     {kImageClear_frag_00000006, sizeof(kImageClear_frag_00000006)},
236     {kImageClear_frag_00000007, sizeof(kImageClear_frag_00000007)},
237     {kImageClear_frag_00000008, sizeof(kImageClear_frag_00000008)},
238     {kImageClear_frag_00000009, sizeof(kImageClear_frag_00000009)},
239     {kImageClear_frag_0000000A, sizeof(kImageClear_frag_0000000A)},
240     {kImageClear_frag_0000000B, sizeof(kImageClear_frag_0000000B)},
241     {kImageClear_frag_0000000C, sizeof(kImageClear_frag_0000000C)},
242     {kImageClear_frag_0000000D, sizeof(kImageClear_frag_0000000D)},
243     {kImageClear_frag_0000000E, sizeof(kImageClear_frag_0000000E)},
244     {kImageClear_frag_0000000F, sizeof(kImageClear_frag_0000000F)},
245     {kImageClear_frag_00000010, sizeof(kImageClear_frag_00000010)},
246     {kImageClear_frag_00000011, sizeof(kImageClear_frag_00000011)},
247     {kImageClear_frag_00000012, sizeof(kImageClear_frag_00000012)},
248     {kImageClear_frag_00000013, sizeof(kImageClear_frag_00000013)},
249     {kImageClear_frag_00000014, sizeof(kImageClear_frag_00000014)},
250     {kImageClear_frag_00000015, sizeof(kImageClear_frag_00000015)},
251     {kImageClear_frag_00000016, sizeof(kImageClear_frag_00000016)},
252     {kImageClear_frag_00000017, sizeof(kImageClear_frag_00000017)},
253 };
254 constexpr ShaderBlob kImageCopy_frag_shaders[] = {
255     {kImageCopy_frag_00000000, sizeof(kImageCopy_frag_00000000)},
256     {kImageCopy_frag_00000001, sizeof(kImageCopy_frag_00000001)},
257     {kImageCopy_frag_00000002, sizeof(kImageCopy_frag_00000002)},
258     {kImageCopy_frag_00000003, sizeof(kImageCopy_frag_00000003)},
259     {kImageCopy_frag_00000004, sizeof(kImageCopy_frag_00000004)},
260     {kImageCopy_frag_00000005, sizeof(kImageCopy_frag_00000005)},
261     {nullptr, 0},  // 0x00000006
262     {nullptr, 0},  // 0x00000007
263     {kImageCopy_frag_00000008, sizeof(kImageCopy_frag_00000008)},
264     {kImageCopy_frag_00000009, sizeof(kImageCopy_frag_00000009)},
265     {kImageCopy_frag_0000000A, sizeof(kImageCopy_frag_0000000A)},
266     {kImageCopy_frag_0000000B, sizeof(kImageCopy_frag_0000000B)},
267     {kImageCopy_frag_0000000C, sizeof(kImageCopy_frag_0000000C)},
268     {kImageCopy_frag_0000000D, sizeof(kImageCopy_frag_0000000D)},
269     {nullptr, 0},  // 0x0000000E
270     {nullptr, 0},  // 0x0000000F
271     {kImageCopy_frag_00000010, sizeof(kImageCopy_frag_00000010)},
272     {kImageCopy_frag_00000011, sizeof(kImageCopy_frag_00000011)},
273     {kImageCopy_frag_00000012, sizeof(kImageCopy_frag_00000012)},
274     {kImageCopy_frag_00000013, sizeof(kImageCopy_frag_00000013)},
275     {kImageCopy_frag_00000014, sizeof(kImageCopy_frag_00000014)},
276     {kImageCopy_frag_00000015, sizeof(kImageCopy_frag_00000015)},
277 };
278 constexpr ShaderBlob kOverlayCull_comp_shaders[] = {
279     {kOverlayCull_comp_00000000, sizeof(kOverlayCull_comp_00000000)},
280     {kOverlayCull_comp_00000001, sizeof(kOverlayCull_comp_00000001)},
281     {kOverlayCull_comp_00000002, sizeof(kOverlayCull_comp_00000002)},
282     {kOverlayCull_comp_00000003, sizeof(kOverlayCull_comp_00000003)},
283     {kOverlayCull_comp_00000004, sizeof(kOverlayCull_comp_00000004)},
284     {kOverlayCull_comp_00000005, sizeof(kOverlayCull_comp_00000005)},
285 };
286 constexpr ShaderBlob kOverlayDraw_comp_shaders[] = {
287     {kOverlayDraw_comp_00000000, sizeof(kOverlayDraw_comp_00000000)},
288     {kOverlayDraw_comp_00000001, sizeof(kOverlayDraw_comp_00000001)},
289 };
290 
GetShader(Context * context,RefCounted<ShaderAndSerial> * shaders,const ShaderBlob * shaderBlobs,size_t shadersCount,uint32_t shaderFlags,RefCounted<ShaderAndSerial> ** shaderOut)291 angle::Result GetShader(Context *context,
292                         RefCounted<ShaderAndSerial> *shaders,
293                         const ShaderBlob *shaderBlobs,
294                         size_t shadersCount,
295                         uint32_t shaderFlags,
296                         RefCounted<ShaderAndSerial> **shaderOut)
297 {
298     ASSERT(shaderFlags < shadersCount);
299     RefCounted<ShaderAndSerial> &shader = shaders[shaderFlags];
300     *shaderOut                          = &shader;
301 
302     if (shader.get().valid())
303     {
304         return angle::Result::Continue;
305     }
306 
307     // Create shader lazily. Access will need to be locked for multi-threading.
308     const ShaderBlob &shaderCode = shaderBlobs[shaderFlags];
309     ASSERT(shaderCode.code != nullptr);
310 
311     return InitShaderAndSerial(context, &shader.get(), shaderCode.code, shaderCode.codeSize);
312 }
313 }  // anonymous namespace
314 
ShaderLibrary()315 ShaderLibrary::ShaderLibrary() {}
316 
~ShaderLibrary()317 ShaderLibrary::~ShaderLibrary() {}
318 
destroy(VkDevice device)319 void ShaderLibrary::destroy(VkDevice device)
320 {
321     for (RefCounted<ShaderAndSerial> &shader : mBlitResolve_frag_shaders)
322     {
323         shader.get().destroy(device);
324     }
325     for (RefCounted<ShaderAndSerial> &shader : mBlitResolveStencilNoExport_comp_shaders)
326     {
327         shader.get().destroy(device);
328     }
329     for (RefCounted<ShaderAndSerial> &shader : mBufferUtils_comp_shaders)
330     {
331         shader.get().destroy(device);
332     }
333     for (RefCounted<ShaderAndSerial> &shader : mConvertIndex_comp_shaders)
334     {
335         shader.get().destroy(device);
336     }
337     for (RefCounted<ShaderAndSerial> &shader : mConvertIndexIndirectLineLoop_comp_shaders)
338     {
339         shader.get().destroy(device);
340     }
341     for (RefCounted<ShaderAndSerial> &shader : mConvertIndirectLineLoop_comp_shaders)
342     {
343         shader.get().destroy(device);
344     }
345     for (RefCounted<ShaderAndSerial> &shader : mConvertVertex_comp_shaders)
346     {
347         shader.get().destroy(device);
348     }
349     for (RefCounted<ShaderAndSerial> &shader : mFullScreenQuad_vert_shaders)
350     {
351         shader.get().destroy(device);
352     }
353     for (RefCounted<ShaderAndSerial> &shader : mImageClear_frag_shaders)
354     {
355         shader.get().destroy(device);
356     }
357     for (RefCounted<ShaderAndSerial> &shader : mImageCopy_frag_shaders)
358     {
359         shader.get().destroy(device);
360     }
361     for (RefCounted<ShaderAndSerial> &shader : mOverlayCull_comp_shaders)
362     {
363         shader.get().destroy(device);
364     }
365     for (RefCounted<ShaderAndSerial> &shader : mOverlayDraw_comp_shaders)
366     {
367         shader.get().destroy(device);
368     }
369 }
370 
getBlitResolve_frag(Context * context,uint32_t shaderFlags,RefCounted<ShaderAndSerial> ** shaderOut)371 angle::Result ShaderLibrary::getBlitResolve_frag(Context *context,
372                                                  uint32_t shaderFlags,
373                                                  RefCounted<ShaderAndSerial> **shaderOut)
374 {
375     return GetShader(context, mBlitResolve_frag_shaders, kBlitResolve_frag_shaders,
376                      ArraySize(kBlitResolve_frag_shaders), shaderFlags, shaderOut);
377 }
378 
getBlitResolveStencilNoExport_comp(Context * context,uint32_t shaderFlags,RefCounted<ShaderAndSerial> ** shaderOut)379 angle::Result ShaderLibrary::getBlitResolveStencilNoExport_comp(
380     Context *context,
381     uint32_t shaderFlags,
382     RefCounted<ShaderAndSerial> **shaderOut)
383 {
384     return GetShader(context, mBlitResolveStencilNoExport_comp_shaders,
385                      kBlitResolveStencilNoExport_comp_shaders,
386                      ArraySize(kBlitResolveStencilNoExport_comp_shaders), shaderFlags, shaderOut);
387 }
388 
getBufferUtils_comp(Context * context,uint32_t shaderFlags,RefCounted<ShaderAndSerial> ** shaderOut)389 angle::Result ShaderLibrary::getBufferUtils_comp(Context *context,
390                                                  uint32_t shaderFlags,
391                                                  RefCounted<ShaderAndSerial> **shaderOut)
392 {
393     return GetShader(context, mBufferUtils_comp_shaders, kBufferUtils_comp_shaders,
394                      ArraySize(kBufferUtils_comp_shaders), shaderFlags, shaderOut);
395 }
396 
getConvertIndex_comp(Context * context,uint32_t shaderFlags,RefCounted<ShaderAndSerial> ** shaderOut)397 angle::Result ShaderLibrary::getConvertIndex_comp(Context *context,
398                                                   uint32_t shaderFlags,
399                                                   RefCounted<ShaderAndSerial> **shaderOut)
400 {
401     return GetShader(context, mConvertIndex_comp_shaders, kConvertIndex_comp_shaders,
402                      ArraySize(kConvertIndex_comp_shaders), shaderFlags, shaderOut);
403 }
404 
getConvertIndexIndirectLineLoop_comp(Context * context,uint32_t shaderFlags,RefCounted<ShaderAndSerial> ** shaderOut)405 angle::Result ShaderLibrary::getConvertIndexIndirectLineLoop_comp(
406     Context *context,
407     uint32_t shaderFlags,
408     RefCounted<ShaderAndSerial> **shaderOut)
409 {
410     return GetShader(context, mConvertIndexIndirectLineLoop_comp_shaders,
411                      kConvertIndexIndirectLineLoop_comp_shaders,
412                      ArraySize(kConvertIndexIndirectLineLoop_comp_shaders), shaderFlags, shaderOut);
413 }
414 
getConvertIndirectLineLoop_comp(Context * context,uint32_t shaderFlags,RefCounted<ShaderAndSerial> ** shaderOut)415 angle::Result ShaderLibrary::getConvertIndirectLineLoop_comp(
416     Context *context,
417     uint32_t shaderFlags,
418     RefCounted<ShaderAndSerial> **shaderOut)
419 {
420     return GetShader(context, mConvertIndirectLineLoop_comp_shaders,
421                      kConvertIndirectLineLoop_comp_shaders,
422                      ArraySize(kConvertIndirectLineLoop_comp_shaders), shaderFlags, shaderOut);
423 }
424 
getConvertVertex_comp(Context * context,uint32_t shaderFlags,RefCounted<ShaderAndSerial> ** shaderOut)425 angle::Result ShaderLibrary::getConvertVertex_comp(Context *context,
426                                                    uint32_t shaderFlags,
427                                                    RefCounted<ShaderAndSerial> **shaderOut)
428 {
429     return GetShader(context, mConvertVertex_comp_shaders, kConvertVertex_comp_shaders,
430                      ArraySize(kConvertVertex_comp_shaders), shaderFlags, shaderOut);
431 }
432 
getFullScreenQuad_vert(Context * context,uint32_t shaderFlags,RefCounted<ShaderAndSerial> ** shaderOut)433 angle::Result ShaderLibrary::getFullScreenQuad_vert(Context *context,
434                                                     uint32_t shaderFlags,
435                                                     RefCounted<ShaderAndSerial> **shaderOut)
436 {
437     return GetShader(context, mFullScreenQuad_vert_shaders, kFullScreenQuad_vert_shaders,
438                      ArraySize(kFullScreenQuad_vert_shaders), shaderFlags, shaderOut);
439 }
440 
getImageClear_frag(Context * context,uint32_t shaderFlags,RefCounted<ShaderAndSerial> ** shaderOut)441 angle::Result ShaderLibrary::getImageClear_frag(Context *context,
442                                                 uint32_t shaderFlags,
443                                                 RefCounted<ShaderAndSerial> **shaderOut)
444 {
445     return GetShader(context, mImageClear_frag_shaders, kImageClear_frag_shaders,
446                      ArraySize(kImageClear_frag_shaders), shaderFlags, shaderOut);
447 }
448 
getImageCopy_frag(Context * context,uint32_t shaderFlags,RefCounted<ShaderAndSerial> ** shaderOut)449 angle::Result ShaderLibrary::getImageCopy_frag(Context *context,
450                                                uint32_t shaderFlags,
451                                                RefCounted<ShaderAndSerial> **shaderOut)
452 {
453     return GetShader(context, mImageCopy_frag_shaders, kImageCopy_frag_shaders,
454                      ArraySize(kImageCopy_frag_shaders), shaderFlags, shaderOut);
455 }
456 
getOverlayCull_comp(Context * context,uint32_t shaderFlags,RefCounted<ShaderAndSerial> ** shaderOut)457 angle::Result ShaderLibrary::getOverlayCull_comp(Context *context,
458                                                  uint32_t shaderFlags,
459                                                  RefCounted<ShaderAndSerial> **shaderOut)
460 {
461     return GetShader(context, mOverlayCull_comp_shaders, kOverlayCull_comp_shaders,
462                      ArraySize(kOverlayCull_comp_shaders), shaderFlags, shaderOut);
463 }
464 
getOverlayDraw_comp(Context * context,uint32_t shaderFlags,RefCounted<ShaderAndSerial> ** shaderOut)465 angle::Result ShaderLibrary::getOverlayDraw_comp(Context *context,
466                                                  uint32_t shaderFlags,
467                                                  RefCounted<ShaderAndSerial> **shaderOut)
468 {
469     return GetShader(context, mOverlayDraw_comp_shaders, kOverlayDraw_comp_shaders,
470                      ArraySize(kOverlayDraw_comp_shaders), shaderFlags, shaderOut);
471 }
472 
473 }  // namespace vk
474 }  // namespace rx
475