3 * Copyright © 2016 Red Hat.
4 * Copyright © 2016 Bas Nieuwenhuizen
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the "Software"),
8 * to deal in the Software without restriction, including without limitation
9 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 * and/or sell copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following conditions:
13 * The above copyright notice and this permission notice (including the next
14 * paragraph) shall be included in all copies or substantial portions of the
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23 * DEALINGS IN THE SOFTWARE.
26 #include "tu_private.h"
28 #include "registers/adreno_common.xml.h"
29 #include "registers/a6xx.xml.h"
31 #include "vk_format.h"
33 #include "drm-uapi/drm_fourcc.h"
35 #define TU6_FMT(vkfmt, hwfmt, swapfmt, valid) \
36 [VK_FORMAT_##vkfmt] = { \
37 .fmt = FMT6_##hwfmt, \
42 #define TU6_VTC(vk, fmt, swap) TU6_FMT(vk, fmt, swap, FMT_VERTEX | FMT_TEXTURE | FMT_COLOR)
43 #define TU6_xTC(vk, fmt, swap) TU6_FMT(vk, fmt, swap, FMT_TEXTURE | FMT_COLOR)
44 #define TU6_Vxx(vk, fmt, swap) TU6_FMT(vk, fmt, swap, FMT_VERTEX)
45 #define TU6_xTx(vk, fmt, swap) TU6_FMT(vk, fmt, swap, FMT_TEXTURE)
46 #define TU6_xxx(vk, fmt, swap) TU6_FMT(vk, NONE, WZYX, 0)
48 static const struct tu_native_format tu6_format_table
[] = {
49 TU6_xxx(UNDEFINED
, x
, x
), /* 0 */
52 TU6_xxx(R4G4_UNORM_PACK8
, 4_4_UNORM
, WZXY
), /* 1 */
55 TU6_xTC(R4G4B4A4_UNORM_PACK16
, 4_4_4_4_UNORM
, XYZW
), /* 2 */
56 TU6_xTC(B4G4R4A4_UNORM_PACK16
, 4_4_4_4_UNORM
, ZYXW
), /* 3 */
57 TU6_xTC(R5G6B5_UNORM_PACK16
, 5_6_5_UNORM
, WXYZ
), /* 4 */
58 TU6_xTC(B5G6R5_UNORM_PACK16
, 5_6_5_UNORM
, WZYX
), /* 5 */
59 TU6_xTC(R5G5B5A1_UNORM_PACK16
, 5_5_5_1_UNORM
, XYZW
), /* 6 */
60 TU6_xTC(B5G5R5A1_UNORM_PACK16
, 5_5_5_1_UNORM
, ZYXW
), /* 7 */
61 TU6_xTC(A1R5G5B5_UNORM_PACK16
, 5_5_5_1_UNORM
, WXYZ
), /* 8 */
64 TU6_VTC(R8_UNORM
, 8_UNORM
, WZYX
), /* 9 */
65 TU6_VTC(R8_SNORM
, 8_SNORM
, WZYX
), /* 10 */
66 TU6_Vxx(R8_USCALED
, 8_UINT
, WZYX
), /* 11 */
67 TU6_Vxx(R8_SSCALED
, 8_SINT
, WZYX
), /* 12 */
68 TU6_VTC(R8_UINT
, 8_UINT
, WZYX
), /* 13 */
69 TU6_VTC(R8_SINT
, 8_SINT
, WZYX
), /* 14 */
70 TU6_xTC(R8_SRGB
, 8_UNORM
, WZYX
), /* 15 */
73 TU6_VTC(R8G8_UNORM
, 8_8_UNORM
, WZYX
), /* 16 */
74 TU6_VTC(R8G8_SNORM
, 8_8_SNORM
, WZYX
), /* 17 */
75 TU6_Vxx(R8G8_USCALED
, 8_8_UINT
, WZYX
), /* 18 */
76 TU6_Vxx(R8G8_SSCALED
, 8_8_SINT
, WZYX
), /* 19 */
77 TU6_VTC(R8G8_UINT
, 8_8_UINT
, WZYX
), /* 20 */
78 TU6_VTC(R8G8_SINT
, 8_8_SINT
, WZYX
), /* 21 */
79 TU6_xTC(R8G8_SRGB
, 8_8_UNORM
, WZYX
), /* 22 */
82 TU6_Vxx(R8G8B8_UNORM
, 8_8_8_UNORM
, WZYX
), /* 23 */
83 TU6_Vxx(R8G8B8_SNORM
, 8_8_8_SNORM
, WZYX
), /* 24 */
84 TU6_Vxx(R8G8B8_USCALED
, 8_8_8_UINT
, WZYX
), /* 25 */
85 TU6_Vxx(R8G8B8_SSCALED
, 8_8_8_SINT
, WZYX
), /* 26 */
86 TU6_Vxx(R8G8B8_UINT
, 8_8_8_UINT
, WZYX
), /* 27 */
87 TU6_Vxx(R8G8B8_SINT
, 8_8_8_SINT
, WZYX
), /* 28 */
88 TU6_xxx(R8G8B8_SRGB
, 8_8_8_UNORM
, WZYX
), /* 29 */
91 TU6_xxx(B8G8R8_UNORM
, 8_8_8_UNORM
, WXYZ
), /* 30 */
92 TU6_xxx(B8G8R8_SNORM
, 8_8_8_SNORM
, WXYZ
), /* 31 */
93 TU6_xxx(B8G8R8_USCALED
, 8_8_8_UINT
, WXYZ
), /* 32 */
94 TU6_xxx(B8G8R8_SSCALED
, 8_8_8_SINT
, WXYZ
), /* 33 */
95 TU6_xxx(B8G8R8_UINT
, 8_8_8_UINT
, WXYZ
), /* 34 */
96 TU6_xxx(B8G8R8_SINT
, 8_8_8_SINT
, WXYZ
), /* 35 */
97 TU6_xxx(B8G8R8_SRGB
, 8_8_8_UNORM
, WXYZ
), /* 36 */
100 TU6_VTC(R8G8B8A8_UNORM
, 8_8_8_8_UNORM
, WZYX
), /* 37 */
101 TU6_VTC(R8G8B8A8_SNORM
, 8_8_8_8_SNORM
, WZYX
), /* 38 */
102 TU6_Vxx(R8G8B8A8_USCALED
, 8_8_8_8_UINT
, WZYX
), /* 39 */
103 TU6_Vxx(R8G8B8A8_SSCALED
, 8_8_8_8_SINT
, WZYX
), /* 40 */
104 TU6_VTC(R8G8B8A8_UINT
, 8_8_8_8_UINT
, WZYX
), /* 41 */
105 TU6_VTC(R8G8B8A8_SINT
, 8_8_8_8_SINT
, WZYX
), /* 42 */
106 TU6_xTC(R8G8B8A8_SRGB
, 8_8_8_8_UNORM
, WZYX
), /* 43 */
109 TU6_VTC(B8G8R8A8_UNORM
, 8_8_8_8_UNORM
, WXYZ
), /* 44 */
110 TU6_VTC(B8G8R8A8_SNORM
, 8_8_8_8_SNORM
, WXYZ
), /* 45 */
111 TU6_Vxx(B8G8R8A8_USCALED
, 8_8_8_8_UINT
, WXYZ
), /* 46 */
112 TU6_Vxx(B8G8R8A8_SSCALED
, 8_8_8_8_SINT
, WXYZ
), /* 47 */
113 TU6_VTC(B8G8R8A8_UINT
, 8_8_8_8_UINT
, WXYZ
), /* 48 */
114 TU6_VTC(B8G8R8A8_SINT
, 8_8_8_8_SINT
, WXYZ
), /* 49 */
115 TU6_xTC(B8G8R8A8_SRGB
, 8_8_8_8_UNORM
, WXYZ
), /* 50 */
118 TU6_VTC(A8B8G8R8_UNORM_PACK32
, 8_8_8_8_UNORM
, WZYX
), /* 51 */
119 TU6_VTC(A8B8G8R8_SNORM_PACK32
, 8_8_8_8_SNORM
, WZYX
), /* 52 */
120 TU6_Vxx(A8B8G8R8_USCALED_PACK32
, 8_8_8_8_UINT
, WZYX
), /* 53 */
121 TU6_Vxx(A8B8G8R8_SSCALED_PACK32
, 8_8_8_8_SINT
, WZYX
), /* 54 */
122 TU6_VTC(A8B8G8R8_UINT_PACK32
, 8_8_8_8_UINT
, WZYX
), /* 55 */
123 TU6_VTC(A8B8G8R8_SINT_PACK32
, 8_8_8_8_SINT
, WZYX
), /* 56 */
124 TU6_xTC(A8B8G8R8_SRGB_PACK32
, 8_8_8_8_UNORM
, WZYX
), /* 57 */
125 TU6_VTC(A2R10G10B10_UNORM_PACK32
, 10_10_10_2_UNORM
, WXYZ
), /* 58 */
126 TU6_Vxx(A2R10G10B10_SNORM_PACK32
, 10_10_10_2_SNORM
, WXYZ
), /* 59 */
127 TU6_Vxx(A2R10G10B10_USCALED_PACK32
, 10_10_10_2_UINT
, WXYZ
), /* 60 */
128 TU6_Vxx(A2R10G10B10_SSCALED_PACK32
, 10_10_10_2_SINT
, WXYZ
), /* 61 */
129 TU6_VTC(A2R10G10B10_UINT_PACK32
, 10_10_10_2_UINT
, WXYZ
), /* 62 */
130 TU6_Vxx(A2R10G10B10_SINT_PACK32
, 10_10_10_2_SINT
, WXYZ
), /* 63 */
131 TU6_VTC(A2B10G10R10_UNORM_PACK32
, 10_10_10_2_UNORM
, WZYX
), /* 64 */
132 TU6_Vxx(A2B10G10R10_SNORM_PACK32
, 10_10_10_2_SNORM
, WZYX
), /* 65 */
133 TU6_Vxx(A2B10G10R10_USCALED_PACK32
, 10_10_10_2_UINT
, WZYX
), /* 66 */
134 TU6_Vxx(A2B10G10R10_SSCALED_PACK32
, 10_10_10_2_SINT
, WZYX
), /* 67 */
135 TU6_VTC(A2B10G10R10_UINT_PACK32
, 10_10_10_2_UINT
, WZYX
), /* 68 */
136 TU6_Vxx(A2B10G10R10_SINT_PACK32
, 10_10_10_2_SINT
, WZYX
), /* 69 */
139 TU6_VTC(R16_UNORM
, 16_UNORM
, WZYX
), /* 70 */
140 TU6_VTC(R16_SNORM
, 16_SNORM
, WZYX
), /* 71 */
141 TU6_Vxx(R16_USCALED
, 16_UINT
, WZYX
), /* 72 */
142 TU6_Vxx(R16_SSCALED
, 16_SINT
, WZYX
), /* 73 */
143 TU6_VTC(R16_UINT
, 16_UINT
, WZYX
), /* 74 */
144 TU6_VTC(R16_SINT
, 16_SINT
, WZYX
), /* 75 */
145 TU6_VTC(R16_SFLOAT
, 16_FLOAT
, WZYX
), /* 76 */
148 TU6_VTC(R16G16_UNORM
, 16_16_UNORM
, WZYX
), /* 77 */
149 TU6_VTC(R16G16_SNORM
, 16_16_SNORM
, WZYX
), /* 78 */
150 TU6_Vxx(R16G16_USCALED
, 16_16_UINT
, WZYX
), /* 79 */
151 TU6_Vxx(R16G16_SSCALED
, 16_16_SINT
, WZYX
), /* 80 */
152 TU6_VTC(R16G16_UINT
, 16_16_UINT
, WZYX
), /* 81 */
153 TU6_VTC(R16G16_SINT
, 16_16_SINT
, WZYX
), /* 82 */
154 TU6_VTC(R16G16_SFLOAT
, 16_16_FLOAT
, WZYX
), /* 83 */
157 TU6_Vxx(R16G16B16_UNORM
, 16_16_16_UNORM
, WZYX
), /* 84 */
158 TU6_Vxx(R16G16B16_SNORM
, 16_16_16_SNORM
, WZYX
), /* 85 */
159 TU6_Vxx(R16G16B16_USCALED
, 16_16_16_UINT
, WZYX
), /* 86 */
160 TU6_Vxx(R16G16B16_SSCALED
, 16_16_16_SINT
, WZYX
), /* 87 */
161 TU6_Vxx(R16G16B16_UINT
, 16_16_16_UINT
, WZYX
), /* 88 */
162 TU6_Vxx(R16G16B16_SINT
, 16_16_16_SINT
, WZYX
), /* 89 */
163 TU6_Vxx(R16G16B16_SFLOAT
, 16_16_16_FLOAT
, WZYX
), /* 90 */
166 TU6_VTC(R16G16B16A16_UNORM
, 16_16_16_16_UNORM
, WZYX
), /* 91 */
167 TU6_VTC(R16G16B16A16_SNORM
, 16_16_16_16_SNORM
, WZYX
), /* 92 */
168 TU6_Vxx(R16G16B16A16_USCALED
, 16_16_16_16_UINT
, WZYX
), /* 93 */
169 TU6_Vxx(R16G16B16A16_SSCALED
, 16_16_16_16_SINT
, WZYX
), /* 94 */
170 TU6_VTC(R16G16B16A16_UINT
, 16_16_16_16_UINT
, WZYX
), /* 95 */
171 TU6_VTC(R16G16B16A16_SINT
, 16_16_16_16_SINT
, WZYX
), /* 96 */
172 TU6_VTC(R16G16B16A16_SFLOAT
, 16_16_16_16_FLOAT
, WZYX
), /* 97 */
175 TU6_VTC(R32_UINT
, 32_UINT
, WZYX
), /* 98 */
176 TU6_VTC(R32_SINT
, 32_SINT
, WZYX
), /* 99 */
177 TU6_VTC(R32_SFLOAT
, 32_FLOAT
, WZYX
), /* 100 */
180 TU6_VTC(R32G32_UINT
, 32_32_UINT
, WZYX
), /* 101 */
181 TU6_VTC(R32G32_SINT
, 32_32_SINT
, WZYX
), /* 102 */
182 TU6_VTC(R32G32_SFLOAT
, 32_32_FLOAT
, WZYX
), /* 103 */
185 TU6_Vxx(R32G32B32_UINT
, 32_32_32_UINT
, WZYX
), /* 104 */
186 TU6_Vxx(R32G32B32_SINT
, 32_32_32_SINT
, WZYX
), /* 105 */
187 TU6_Vxx(R32G32B32_SFLOAT
, 32_32_32_FLOAT
, WZYX
), /* 106 */
190 TU6_VTC(R32G32B32A32_UINT
, 32_32_32_32_UINT
, WZYX
), /* 107 */
191 TU6_VTC(R32G32B32A32_SINT
, 32_32_32_32_SINT
, WZYX
), /* 108 */
192 TU6_VTC(R32G32B32A32_SFLOAT
, 32_32_32_32_FLOAT
, WZYX
), /* 109 */
195 TU6_xxx(R64_UINT
, 64_UINT
, WZYX
), /* 110 */
196 TU6_xxx(R64_SINT
, 64_SINT
, WZYX
), /* 111 */
197 TU6_xxx(R64_SFLOAT
, 64_FLOAT
, WZYX
), /* 112 */
200 TU6_xxx(R64G64_UINT
, 64_64_UINT
, WZYX
), /* 113 */
201 TU6_xxx(R64G64_SINT
, 64_64_SINT
, WZYX
), /* 114 */
202 TU6_xxx(R64G64_SFLOAT
, 64_64_FLOAT
, WZYX
), /* 115 */
205 TU6_xxx(R64G64B64_UINT
, 64_64_64_UINT
, WZYX
), /* 116 */
206 TU6_xxx(R64G64B64_SINT
, 64_64_64_SINT
, WZYX
), /* 117 */
207 TU6_xxx(R64G64B64_SFLOAT
, 64_64_64_FLOAT
, WZYX
), /* 118 */
210 TU6_xxx(R64G64B64A64_UINT
, 64_64_64_64_UINT
, WZYX
), /* 119 */
211 TU6_xxx(R64G64B64A64_SINT
, 64_64_64_64_SINT
, WZYX
), /* 120 */
212 TU6_xxx(R64G64B64A64_SFLOAT
, 64_64_64_64_FLOAT
, WZYX
), /* 121 */
214 /* 32-bit packed float */
215 TU6_VTC(B10G11R11_UFLOAT_PACK32
, 11_11_10_FLOAT
, WZYX
), /* 122 */
216 TU6_xTx(E5B9G9R9_UFLOAT_PACK32
, 9_9_9_E5_FLOAT
, WZYX
), /* 123 */
219 TU6_xTC(D16_UNORM
, 16_UNORM
, WZYX
), /* 124 */
220 TU6_xTC(X8_D24_UNORM_PACK32
, Z24_UNORM_S8_UINT_AS_R8G8B8A8
, WZYX
), /* 125 */
221 TU6_xTC(D32_SFLOAT
, 32_FLOAT
, WZYX
), /* 126 */
222 TU6_xTC(S8_UINT
, 8_UINT
, WZYX
), /* 127 */
223 TU6_xxx(D16_UNORM_S8_UINT
, X8Z16_UNORM
, WZYX
), /* 128 */
224 TU6_xTC(D24_UNORM_S8_UINT
, Z24_UNORM_S8_UINT_AS_R8G8B8A8
, WZYX
), /* 129 */
225 TU6_xxx(D32_SFLOAT_S8_UINT
, x
, WZYX
), /* 130 */
228 TU6_xTx(BC1_RGB_UNORM_BLOCK
, DXT1
, WZYX
), /* 131 */
229 TU6_xTx(BC1_RGB_SRGB_BLOCK
, DXT1
, WZYX
), /* 132 */
230 TU6_xTx(BC1_RGBA_UNORM_BLOCK
, DXT1
, WZYX
), /* 133 */
231 TU6_xTx(BC1_RGBA_SRGB_BLOCK
, DXT1
, WZYX
), /* 134 */
232 TU6_xTx(BC2_UNORM_BLOCK
, DXT3
, WZYX
), /* 135 */
233 TU6_xTx(BC2_SRGB_BLOCK
, DXT3
, WZYX
), /* 136 */
234 TU6_xTx(BC3_UNORM_BLOCK
, DXT5
, WZYX
), /* 137 */
235 TU6_xTx(BC3_SRGB_BLOCK
, DXT5
, WZYX
), /* 138 */
236 TU6_xTx(BC4_UNORM_BLOCK
, RGTC1_UNORM
, WZYX
), /* 139 */
237 TU6_xTx(BC4_SNORM_BLOCK
, RGTC1_SNORM
, WZYX
), /* 140 */
238 TU6_xTx(BC5_UNORM_BLOCK
, RGTC2_UNORM
, WZYX
), /* 141 */
239 TU6_xTx(BC5_SNORM_BLOCK
, RGTC2_SNORM
, WZYX
), /* 142 */
240 TU6_xTx(BC6H_UFLOAT_BLOCK
, BPTC_UFLOAT
, WZYX
), /* 143 */
241 TU6_xTx(BC6H_SFLOAT_BLOCK
, BPTC_FLOAT
, WZYX
), /* 144 */
242 TU6_xTx(BC7_UNORM_BLOCK
, BPTC
, WZYX
), /* 145 */
243 TU6_xTx(BC7_SRGB_BLOCK
, BPTC
, WZYX
), /* 146 */
244 TU6_xTx(ETC2_R8G8B8_UNORM_BLOCK
, ETC2_RGB8
, WZYX
), /* 147 */
245 TU6_xTx(ETC2_R8G8B8_SRGB_BLOCK
, ETC2_RGB8
, WZYX
), /* 148 */
246 TU6_xTx(ETC2_R8G8B8A1_UNORM_BLOCK
, ETC2_RGB8A1
, WZYX
), /* 149 */
247 TU6_xTx(ETC2_R8G8B8A1_SRGB_BLOCK
, ETC2_RGB8A1
, WZYX
), /* 150 */
248 TU6_xTx(ETC2_R8G8B8A8_UNORM_BLOCK
, ETC2_RGBA8
, WZYX
), /* 151 */
249 TU6_xTx(ETC2_R8G8B8A8_SRGB_BLOCK
, ETC2_RGBA8
, WZYX
), /* 152 */
250 TU6_xTx(EAC_R11_UNORM_BLOCK
, ETC2_R11_UNORM
, WZYX
), /* 153 */
251 TU6_xTx(EAC_R11_SNORM_BLOCK
, ETC2_R11_SNORM
, WZYX
), /* 154 */
252 TU6_xTx(EAC_R11G11_UNORM_BLOCK
, ETC2_RG11_UNORM
, WZYX
), /* 155 */
253 TU6_xTx(EAC_R11G11_SNORM_BLOCK
, ETC2_RG11_SNORM
, WZYX
), /* 156 */
254 TU6_xTx(ASTC_4x4_UNORM_BLOCK
, ASTC_4x4
, WZYX
), /* 157 */
255 TU6_xTx(ASTC_4x4_SRGB_BLOCK
, ASTC_4x4
, WZYX
), /* 158 */
256 TU6_xTx(ASTC_5x4_UNORM_BLOCK
, ASTC_5x4
, WZYX
), /* 159 */
257 TU6_xTx(ASTC_5x4_SRGB_BLOCK
, ASTC_5x4
, WZYX
), /* 160 */
258 TU6_xTx(ASTC_5x5_UNORM_BLOCK
, ASTC_5x5
, WZYX
), /* 161 */
259 TU6_xTx(ASTC_5x5_SRGB_BLOCK
, ASTC_5x5
, WZYX
), /* 162 */
260 TU6_xTx(ASTC_6x5_UNORM_BLOCK
, ASTC_6x5
, WZYX
), /* 163 */
261 TU6_xTx(ASTC_6x5_SRGB_BLOCK
, ASTC_6x5
, WZYX
), /* 164 */
262 TU6_xTx(ASTC_6x6_UNORM_BLOCK
, ASTC_6x6
, WZYX
), /* 165 */
263 TU6_xTx(ASTC_6x6_SRGB_BLOCK
, ASTC_6x6
, WZYX
), /* 166 */
264 TU6_xTx(ASTC_8x5_UNORM_BLOCK
, ASTC_8x5
, WZYX
), /* 167 */
265 TU6_xTx(ASTC_8x5_SRGB_BLOCK
, ASTC_8x5
, WZYX
), /* 168 */
266 TU6_xTx(ASTC_8x6_UNORM_BLOCK
, ASTC_8x6
, WZYX
), /* 169 */
267 TU6_xTx(ASTC_8x6_SRGB_BLOCK
, ASTC_8x6
, WZYX
), /* 170 */
268 TU6_xTx(ASTC_8x8_UNORM_BLOCK
, ASTC_8x8
, WZYX
), /* 171 */
269 TU6_xTx(ASTC_8x8_SRGB_BLOCK
, ASTC_8x8
, WZYX
), /* 172 */
270 TU6_xTx(ASTC_10x5_UNORM_BLOCK
, ASTC_10x5
, WZYX
), /* 173 */
271 TU6_xTx(ASTC_10x5_SRGB_BLOCK
, ASTC_10x5
, WZYX
), /* 174 */
272 TU6_xTx(ASTC_10x6_UNORM_BLOCK
, ASTC_10x6
, WZYX
), /* 175 */
273 TU6_xTx(ASTC_10x6_SRGB_BLOCK
, ASTC_10x6
, WZYX
), /* 176 */
274 TU6_xTx(ASTC_10x8_UNORM_BLOCK
, ASTC_10x8
, WZYX
), /* 177 */
275 TU6_xTx(ASTC_10x8_SRGB_BLOCK
, ASTC_10x8
, WZYX
), /* 178 */
276 TU6_xTx(ASTC_10x10_UNORM_BLOCK
, ASTC_10x10
, WZYX
), /* 179 */
277 TU6_xTx(ASTC_10x10_SRGB_BLOCK
, ASTC_10x10
, WZYX
), /* 180 */
278 TU6_xTx(ASTC_12x10_UNORM_BLOCK
, ASTC_12x10
, WZYX
), /* 181 */
279 TU6_xTx(ASTC_12x10_SRGB_BLOCK
, ASTC_12x10
, WZYX
), /* 182 */
280 TU6_xTx(ASTC_12x12_UNORM_BLOCK
, ASTC_12x12
, WZYX
), /* 183 */
281 TU6_xTx(ASTC_12x12_SRGB_BLOCK
, ASTC_12x12
, WZYX
), /* 184 */
284 #define FMT_EXT_BASE VK_FORMAT_G8B8G8R8_422_UNORM
286 #define TU6_FMT(vkfmt, hwfmt, swapfmt, valid) \
287 [VK_FORMAT_##vkfmt - FMT_EXT_BASE] = { \
288 .fmt = FMT6_##hwfmt, \
290 .supported = valid, \
293 static const struct tu_native_format tu6_format_table_ext
[] = {
294 TU6_xTx(G8B8G8R8_422_UNORM
, R8G8R8B8_422_UNORM
, WZYX
), /* 0 */
295 TU6_xTx(B8G8R8G8_422_UNORM
, G8R8B8R8_422_UNORM
, WZYX
), /* 1 */
298 static struct tu_native_format
299 tu6_get_native_format(VkFormat format
)
301 struct tu_native_format fmt
= {};
303 if (format
< ARRAY_SIZE(tu6_format_table
)) {
304 fmt
= tu6_format_table
[format
];
305 } else if (format
>= FMT_EXT_BASE
) {
306 unsigned idx
= format
- FMT_EXT_BASE
;
307 if (idx
< ARRAY_SIZE(tu6_format_table_ext
))
308 fmt
= tu6_format_table_ext
[idx
];
311 if (fmt
.supported
&& vk_format_to_pipe_format(format
) == PIPE_FORMAT_NONE
) {
312 tu_finishme("vk_format %d missing matching pipe format.\n", format
);
313 fmt
.supported
= false;
319 struct tu_native_format
320 tu6_format_vtx(VkFormat format
)
322 struct tu_native_format fmt
= tu6_get_native_format(format
);
323 assert(fmt
.supported
& FMT_VERTEX
);
327 struct tu_native_format
328 tu6_format_color(VkFormat format
, enum a6xx_tile_mode tile_mode
)
330 struct tu_native_format fmt
= tu6_get_native_format(format
);
331 assert(fmt
.supported
& FMT_COLOR
);
333 if (fmt
.fmt
== FMT6_10_10_10_2_UNORM
)
334 fmt
.fmt
= FMT6_10_10_10_2_UNORM_DEST
;
342 struct tu_native_format
343 tu6_format_texture(VkFormat format
, enum a6xx_tile_mode tile_mode
)
345 struct tu_native_format fmt
= tu6_get_native_format(format
);
346 assert(fmt
.supported
& FMT_TEXTURE
);
349 /* different from format table when used as linear src */
350 if (format
== VK_FORMAT_R5G5B5A1_UNORM_PACK16
)
351 fmt
.fmt
= FMT6_1_5_5_5_UNORM
, fmt
.swap
= WXYZ
;
352 if (format
== VK_FORMAT_B5G5R5A1_UNORM_PACK16
)
353 fmt
.fmt
= FMT6_1_5_5_5_UNORM
, fmt
.swap
= WZYX
;
362 tu_physical_device_get_format_properties(
363 struct tu_physical_device
*physical_device
,
365 VkFormatProperties
*out_properties
)
367 VkFormatFeatureFlags linear
= 0, optimal
= 0, buffer
= 0;
368 const struct util_format_description
*desc
= vk_format_description(format
);
369 const struct tu_native_format native_fmt
= tu6_get_native_format(format
);
370 if (!desc
|| !native_fmt
.supported
) {
374 buffer
|= VK_FORMAT_FEATURE_TRANSFER_SRC_BIT
| VK_FORMAT_FEATURE_TRANSFER_DST_BIT
;
375 if (native_fmt
.supported
& FMT_VERTEX
)
376 buffer
|= VK_FORMAT_FEATURE_VERTEX_BUFFER_BIT
;
378 if (native_fmt
.supported
& FMT_TEXTURE
) {
379 optimal
|= VK_FORMAT_FEATURE_BLIT_SRC_BIT
|
380 VK_FORMAT_FEATURE_TRANSFER_SRC_BIT
|
381 VK_FORMAT_FEATURE_TRANSFER_DST_BIT
|
382 VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT
|
383 VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT
|
384 VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_MINMAX_BIT
|
385 VK_FORMAT_FEATURE_COSITED_CHROMA_SAMPLES_BIT
|
386 VK_FORMAT_FEATURE_MIDPOINT_CHROMA_SAMPLES_BIT
;
388 buffer
|= VK_FORMAT_FEATURE_UNIFORM_TEXEL_BUFFER_BIT
;
390 if (desc
->layout
!= UTIL_FORMAT_LAYOUT_SUBSAMPLED
)
391 optimal
|= VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_LINEAR_FILTER_BIT
;
393 if (physical_device
->supported_extensions
.EXT_filter_cubic
)
394 optimal
|= VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_CUBIC_BIT_EXT
;
397 if (native_fmt
.supported
& FMT_COLOR
) {
398 assert(native_fmt
.supported
& FMT_TEXTURE
);
399 optimal
|= VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT
|
400 VK_FORMAT_FEATURE_BLIT_DST_BIT
;
402 /* IBO's don't have a swap field at all, so swapped formats can't be
403 * supported, even with linear images.
405 * TODO: See if setting the swap field from the tex descriptor works,
406 * after we enable shaderStorageImageReadWithoutFormat and there are
407 * tests for these formats.
409 if (native_fmt
.swap
== WZYX
) {
410 optimal
|= VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT
;
411 buffer
|= VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_BIT
;
414 /* TODO: The blob also exposes these for R16G16_UINT/R16G16_SINT, but we
415 * don't have any tests for those.
417 if (format
== VK_FORMAT_R32_UINT
|| format
== VK_FORMAT_R32_SINT
) {
418 optimal
|= VK_FORMAT_FEATURE_STORAGE_IMAGE_ATOMIC_BIT
;
419 buffer
|= VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_ATOMIC_BIT
;
422 if (vk_format_is_float(format
) ||
423 vk_format_is_unorm(format
) ||
424 vk_format_is_snorm(format
) ||
425 vk_format_is_srgb(format
)) {
426 optimal
|= VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BLEND_BIT
;
430 /* For the most part, we can do anything with a linear image that we could
431 * do with a tiled image. However, we can't support sysmem rendering with a
432 * linear depth texture, because we don't know if there's a bit to control
433 * the tiling of the depth buffer in BYPASS mode, and the blob also
434 * disables linear depth rendering, so there's no way to discover it. We
435 * also can't force GMEM mode, because there are other situations where we
436 * have to use sysmem rendering. So follow the blob here, and only enable
437 * DEPTH_STENCIL_ATTACHMENT_BIT for the optimal features.
440 if (tu6_pipe2depth(format
) != (enum a6xx_depth_format
)~0)
441 optimal
|= VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT
;
444 out_properties
->linearTilingFeatures
= linear
;
445 out_properties
->optimalTilingFeatures
= optimal
;
446 out_properties
->bufferFeatures
= buffer
;
450 tu_GetPhysicalDeviceFormatProperties(VkPhysicalDevice physicalDevice
,
452 VkFormatProperties
*pFormatProperties
)
454 TU_FROM_HANDLE(tu_physical_device
, physical_device
, physicalDevice
);
456 tu_physical_device_get_format_properties(physical_device
, format
,
461 tu_GetPhysicalDeviceFormatProperties2(
462 VkPhysicalDevice physicalDevice
,
464 VkFormatProperties2
*pFormatProperties
)
466 TU_FROM_HANDLE(tu_physical_device
, physical_device
, physicalDevice
);
468 tu_physical_device_get_format_properties(
469 physical_device
, format
, &pFormatProperties
->formatProperties
);
471 VkDrmFormatModifierPropertiesListEXT
*list
=
472 vk_find_struct(pFormatProperties
->pNext
, DRM_FORMAT_MODIFIER_PROPERTIES_LIST_EXT
);
474 VK_OUTARRAY_MAKE(out
, list
->pDrmFormatModifierProperties
,
475 &list
->drmFormatModifierCount
);
477 vk_outarray_append(&out
, mod_props
) {
478 mod_props
->drmFormatModifier
= DRM_FORMAT_MOD_LINEAR
;
479 mod_props
->drmFormatModifierPlaneCount
= 1;
482 /* TODO: any cases where this should be disabled? */
483 vk_outarray_append(&out
, mod_props
) {
484 mod_props
->drmFormatModifier
= DRM_FORMAT_MOD_QCOM_COMPRESSED
;
485 mod_props
->drmFormatModifierPlaneCount
= 1;
491 tu_get_image_format_properties(
492 struct tu_physical_device
*physical_device
,
493 const VkPhysicalDeviceImageFormatInfo2
*info
,
494 VkImageFormatProperties
*pImageFormatProperties
,
495 VkFormatFeatureFlags
*p_feature_flags
)
497 VkFormatProperties format_props
;
498 VkFormatFeatureFlags format_feature_flags
;
499 VkExtent3D maxExtent
;
500 uint32_t maxMipLevels
;
501 uint32_t maxArraySize
;
502 VkSampleCountFlags sampleCounts
= VK_SAMPLE_COUNT_1_BIT
;
504 tu_physical_device_get_format_properties(physical_device
, info
->format
,
507 switch (info
->tiling
) {
508 case VK_IMAGE_TILING_LINEAR
:
509 format_feature_flags
= format_props
.linearTilingFeatures
;
512 case VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT
:
513 /* The only difference between optimal and linear is currently whether
514 * depth/stencil attachments are allowed on depth/stencil formats.
515 * There's no reason to allow importing depth/stencil textures, so just
516 * disallow it and then this annoying edge case goes away.
518 * TODO: If anyone cares, we could enable this by looking at the
519 * modifier and checking if it's LINEAR or not.
521 if (vk_format_is_depth_or_stencil(info
->format
))
524 assert(format_props
.optimalTilingFeatures
== format_props
.linearTilingFeatures
);
526 case VK_IMAGE_TILING_OPTIMAL
:
527 format_feature_flags
= format_props
.optimalTilingFeatures
;
530 unreachable("bad VkPhysicalDeviceImageFormatInfo2");
533 if (format_feature_flags
== 0)
536 if (info
->type
!= VK_IMAGE_TYPE_2D
&&
537 vk_format_is_depth_or_stencil(info
->format
))
540 switch (info
->type
) {
542 unreachable("bad vkimage type\n");
543 case VK_IMAGE_TYPE_1D
:
544 maxExtent
.width
= 16384;
545 maxExtent
.height
= 1;
547 maxMipLevels
= 15; /* log2(maxWidth) + 1 */
550 case VK_IMAGE_TYPE_2D
:
551 maxExtent
.width
= 16384;
552 maxExtent
.height
= 16384;
554 maxMipLevels
= 15; /* log2(maxWidth) + 1 */
557 case VK_IMAGE_TYPE_3D
:
558 maxExtent
.width
= 2048;
559 maxExtent
.height
= 2048;
560 maxExtent
.depth
= 2048;
561 maxMipLevels
= 12; /* log2(maxWidth) + 1 */
566 if (info
->tiling
== VK_IMAGE_TILING_OPTIMAL
&&
567 info
->type
== VK_IMAGE_TYPE_2D
&&
568 (format_feature_flags
&
569 (VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT
|
570 VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT
)) &&
571 !(info
->flags
& VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT
) &&
572 !(info
->usage
& VK_IMAGE_USAGE_STORAGE_BIT
)) {
573 sampleCounts
|= VK_SAMPLE_COUNT_2_BIT
| VK_SAMPLE_COUNT_4_BIT
;
574 /* note: most operations support 8 samples (GMEM render/resolve do at least)
575 * but some do not (which ones?), just disable 8 samples completely,
576 * (no 8x msaa matches the blob driver behavior)
580 if (info
->usage
& VK_IMAGE_USAGE_SAMPLED_BIT
) {
581 if (!(format_feature_flags
& VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT
)) {
586 if (info
->usage
& VK_IMAGE_USAGE_STORAGE_BIT
) {
587 if (!(format_feature_flags
& VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT
)) {
592 if (info
->usage
& VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT
) {
593 if (!(format_feature_flags
& VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT
)) {
598 if (info
->usage
& VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT
) {
599 if (!(format_feature_flags
&
600 VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT
)) {
605 *pImageFormatProperties
= (VkImageFormatProperties
) {
606 .maxExtent
= maxExtent
,
607 .maxMipLevels
= maxMipLevels
,
608 .maxArrayLayers
= maxArraySize
,
609 .sampleCounts
= sampleCounts
,
611 /* FINISHME: Accurately calculate
612 * VkImageFormatProperties::maxResourceSize.
614 .maxResourceSize
= UINT32_MAX
,
618 *p_feature_flags
= format_feature_flags
;
622 *pImageFormatProperties
= (VkImageFormatProperties
) {
623 .maxExtent
= { 0, 0, 0 },
627 .maxResourceSize
= 0,
630 return VK_ERROR_FORMAT_NOT_SUPPORTED
;
634 tu_GetPhysicalDeviceImageFormatProperties(
635 VkPhysicalDevice physicalDevice
,
638 VkImageTiling tiling
,
639 VkImageUsageFlags usage
,
640 VkImageCreateFlags createFlags
,
641 VkImageFormatProperties
*pImageFormatProperties
)
643 TU_FROM_HANDLE(tu_physical_device
, physical_device
, physicalDevice
);
645 const VkPhysicalDeviceImageFormatInfo2 info
= {
646 .sType
= VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_FORMAT_INFO_2
,
652 .flags
= createFlags
,
655 return tu_get_image_format_properties(physical_device
, &info
,
656 pImageFormatProperties
, NULL
);
660 tu_get_external_image_format_properties(
661 const struct tu_physical_device
*physical_device
,
662 const VkPhysicalDeviceImageFormatInfo2
*pImageFormatInfo
,
663 VkExternalMemoryHandleTypeFlagBits handleType
,
664 VkExternalMemoryProperties
*external_properties
)
666 VkExternalMemoryFeatureFlagBits flags
= 0;
667 VkExternalMemoryHandleTypeFlags export_flags
= 0;
668 VkExternalMemoryHandleTypeFlags compat_flags
= 0;
670 /* From the Vulkan 1.1.98 spec:
672 * If handleType is not compatible with the format, type, tiling,
673 * usage, and flags specified in VkPhysicalDeviceImageFormatInfo2,
674 * then vkGetPhysicalDeviceImageFormatProperties2 returns
675 * VK_ERROR_FORMAT_NOT_SUPPORTED.
678 switch (handleType
) {
679 case VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT
:
680 case VK_EXTERNAL_MEMORY_HANDLE_TYPE_DMA_BUF_BIT_EXT
:
681 switch (pImageFormatInfo
->type
) {
682 case VK_IMAGE_TYPE_2D
:
683 flags
= VK_EXTERNAL_MEMORY_FEATURE_DEDICATED_ONLY_BIT
|
684 VK_EXTERNAL_MEMORY_FEATURE_EXPORTABLE_BIT
|
685 VK_EXTERNAL_MEMORY_FEATURE_IMPORTABLE_BIT
;
686 compat_flags
= export_flags
=
687 VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT
|
688 VK_EXTERNAL_MEMORY_HANDLE_TYPE_DMA_BUF_BIT_EXT
;
691 return vk_errorf(physical_device
->instance
, VK_ERROR_FORMAT_NOT_SUPPORTED
,
692 "VkExternalMemoryTypeFlagBits(0x%x) unsupported for VkImageType(%d)",
693 handleType
, pImageFormatInfo
->type
);
696 case VK_EXTERNAL_MEMORY_HANDLE_TYPE_HOST_ALLOCATION_BIT_EXT
:
697 flags
= VK_EXTERNAL_MEMORY_FEATURE_IMPORTABLE_BIT
;
698 compat_flags
= VK_EXTERNAL_MEMORY_HANDLE_TYPE_HOST_ALLOCATION_BIT_EXT
;
701 return vk_errorf(physical_device
->instance
, VK_ERROR_FORMAT_NOT_SUPPORTED
,
702 "VkExternalMemoryTypeFlagBits(0x%x) unsupported",
706 *external_properties
= (VkExternalMemoryProperties
) {
707 .externalMemoryFeatures
= flags
,
708 .exportFromImportedHandleTypes
= export_flags
,
709 .compatibleHandleTypes
= compat_flags
,
716 tu_GetPhysicalDeviceImageFormatProperties2(
717 VkPhysicalDevice physicalDevice
,
718 const VkPhysicalDeviceImageFormatInfo2
*base_info
,
719 VkImageFormatProperties2
*base_props
)
721 TU_FROM_HANDLE(tu_physical_device
, physical_device
, physicalDevice
);
722 const VkPhysicalDeviceExternalImageFormatInfo
*external_info
= NULL
;
723 const VkPhysicalDeviceImageViewImageFormatInfoEXT
*image_view_info
= NULL
;
724 VkExternalImageFormatProperties
*external_props
= NULL
;
725 VkFilterCubicImageViewImageFormatPropertiesEXT
*cubic_props
= NULL
;
726 VkFormatFeatureFlags format_feature_flags
;
727 VkSamplerYcbcrConversionImageFormatProperties
*ycbcr_props
= NULL
;
730 result
= tu_get_image_format_properties(physical_device
,
731 base_info
, &base_props
->imageFormatProperties
, &format_feature_flags
);
732 if (result
!= VK_SUCCESS
)
735 /* Extract input structs */
736 vk_foreach_struct_const(s
, base_info
->pNext
)
739 case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_IMAGE_FORMAT_INFO
:
740 external_info
= (const void *) s
;
742 case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_VIEW_IMAGE_FORMAT_INFO_EXT
:
743 image_view_info
= (const void *) s
;
750 /* Extract output structs */
751 vk_foreach_struct(s
, base_props
->pNext
)
754 case VK_STRUCTURE_TYPE_EXTERNAL_IMAGE_FORMAT_PROPERTIES
:
755 external_props
= (void *) s
;
757 case VK_STRUCTURE_TYPE_FILTER_CUBIC_IMAGE_VIEW_IMAGE_FORMAT_PROPERTIES_EXT
:
758 cubic_props
= (void *) s
;
760 case VK_STRUCTURE_TYPE_SAMPLER_YCBCR_CONVERSION_IMAGE_FORMAT_PROPERTIES
:
761 ycbcr_props
= (void *) s
;
768 /* From the Vulkan 1.0.42 spec:
770 * If handleType is 0, vkGetPhysicalDeviceImageFormatProperties2 will
771 * behave as if VkPhysicalDeviceExternalImageFormatInfo was not
772 * present and VkExternalImageFormatProperties will be ignored.
774 if (external_info
&& external_info
->handleType
!= 0) {
775 result
= tu_get_external_image_format_properties(
776 physical_device
, base_info
, external_info
->handleType
,
777 &external_props
->externalMemoryProperties
);
778 if (result
!= VK_SUCCESS
)
783 /* note: blob only allows cubic filtering for 2D and 2D array views
784 * its likely we can enable it for 1D and CUBE, needs testing however
786 if ((image_view_info
->imageViewType
== VK_IMAGE_VIEW_TYPE_2D
||
787 image_view_info
->imageViewType
== VK_IMAGE_VIEW_TYPE_2D_ARRAY
) &&
788 (format_feature_flags
& VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_CUBIC_BIT_EXT
)) {
789 cubic_props
->filterCubic
= true;
790 cubic_props
->filterCubicMinmax
= true;
792 cubic_props
->filterCubic
= false;
793 cubic_props
->filterCubicMinmax
= false;
798 ycbcr_props
->combinedImageSamplerDescriptorCount
= 1;
803 if (result
== VK_ERROR_FORMAT_NOT_SUPPORTED
) {
804 /* From the Vulkan 1.0.42 spec:
806 * If the combination of parameters to
807 * vkGetPhysicalDeviceImageFormatProperties2 is not supported by
808 * the implementation for use in vkCreateImage, then all members of
809 * imageFormatProperties will be filled with zero.
811 base_props
->imageFormatProperties
= (VkImageFormatProperties
) {};
818 tu_GetPhysicalDeviceSparseImageFormatProperties(
819 VkPhysicalDevice physicalDevice
,
823 VkImageUsageFlags usage
,
824 VkImageTiling tiling
,
825 uint32_t *pNumProperties
,
826 VkSparseImageFormatProperties
*pProperties
)
828 /* Sparse images are not yet supported. */
833 tu_GetPhysicalDeviceSparseImageFormatProperties2(
834 VkPhysicalDevice physicalDevice
,
835 const VkPhysicalDeviceSparseImageFormatInfo2
*pFormatInfo
,
836 uint32_t *pPropertyCount
,
837 VkSparseImageFormatProperties2
*pProperties
)
839 /* Sparse images are not yet supported. */
844 tu_GetPhysicalDeviceExternalBufferProperties(
845 VkPhysicalDevice physicalDevice
,
846 const VkPhysicalDeviceExternalBufferInfo
*pExternalBufferInfo
,
847 VkExternalBufferProperties
*pExternalBufferProperties
)
849 VkExternalMemoryFeatureFlagBits flags
= 0;
850 VkExternalMemoryHandleTypeFlags export_flags
= 0;
851 VkExternalMemoryHandleTypeFlags compat_flags
= 0;
852 switch (pExternalBufferInfo
->handleType
) {
853 case VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT
:
854 case VK_EXTERNAL_MEMORY_HANDLE_TYPE_DMA_BUF_BIT_EXT
:
855 flags
= VK_EXTERNAL_MEMORY_FEATURE_EXPORTABLE_BIT
|
856 VK_EXTERNAL_MEMORY_FEATURE_IMPORTABLE_BIT
;
857 compat_flags
= export_flags
=
858 VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT
|
859 VK_EXTERNAL_MEMORY_HANDLE_TYPE_DMA_BUF_BIT_EXT
;
861 case VK_EXTERNAL_MEMORY_HANDLE_TYPE_HOST_ALLOCATION_BIT_EXT
:
862 flags
= VK_EXTERNAL_MEMORY_FEATURE_IMPORTABLE_BIT
;
863 compat_flags
= VK_EXTERNAL_MEMORY_HANDLE_TYPE_HOST_ALLOCATION_BIT_EXT
;
868 pExternalBufferProperties
->externalMemoryProperties
=
869 (VkExternalMemoryProperties
) {
870 .externalMemoryFeatures
= flags
,
871 .exportFromImportedHandleTypes
= export_flags
,
872 .compatibleHandleTypes
= compat_flags
,