radv: Track scratch usage across pipelines & command buffers.
[mesa.git] / src / amd / vulkan / radv_formats.c
1 /*
2 * Copyright © 2016 Red Hat.
3 * Copyright © 2016 Bas Nieuwenhuizen
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the "Software"),
7 * to deal in the Software without restriction, including without limitation
8 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 * and/or sell copies of the Software, and to permit persons to whom the
10 * Software is furnished to do so, subject to the following conditions:
11 *
12 * The above copyright notice and this permission notice (including the next
13 * paragraph) shall be included in all copies or substantial portions of the
14 * Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
22 * IN THE SOFTWARE.
23 */
24
25 #include "radv_private.h"
26
27 #include "vk_format.h"
28 #include "sid.h"
29 #include "r600d_common.h"
30
31 #include "util/u_half.h"
32 #include "util/format_srgb.h"
33
34 uint32_t radv_translate_buffer_dataformat(const struct vk_format_description *desc,
35 int first_non_void)
36 {
37 unsigned type;
38 int i;
39
40 if (desc->format == VK_FORMAT_B10G11R11_UFLOAT_PACK32)
41 return V_008F0C_BUF_DATA_FORMAT_10_11_11;
42
43 if (first_non_void < 0)
44 return V_008F0C_BUF_DATA_FORMAT_INVALID;
45 type = desc->channel[first_non_void].type;
46
47 if (type == VK_FORMAT_TYPE_FIXED)
48 return V_008F0C_BUF_DATA_FORMAT_INVALID;
49 if (desc->nr_channels == 4 &&
50 desc->channel[0].size == 10 &&
51 desc->channel[1].size == 10 &&
52 desc->channel[2].size == 10 &&
53 desc->channel[3].size == 2)
54 return V_008F0C_BUF_DATA_FORMAT_2_10_10_10;
55
56 /* See whether the components are of the same size. */
57 for (i = 0; i < desc->nr_channels; i++) {
58 if (desc->channel[first_non_void].size != desc->channel[i].size)
59 return V_008F0C_BUF_DATA_FORMAT_INVALID;
60 }
61
62 switch (desc->channel[first_non_void].size) {
63 case 8:
64 switch (desc->nr_channels) {
65 case 1:
66 return V_008F0C_BUF_DATA_FORMAT_8;
67 case 2:
68 return V_008F0C_BUF_DATA_FORMAT_8_8;
69 case 4:
70 return V_008F0C_BUF_DATA_FORMAT_8_8_8_8;
71 }
72 break;
73 case 16:
74 switch (desc->nr_channels) {
75 case 1:
76 return V_008F0C_BUF_DATA_FORMAT_16;
77 case 2:
78 return V_008F0C_BUF_DATA_FORMAT_16_16;
79 case 4:
80 return V_008F0C_BUF_DATA_FORMAT_16_16_16_16;
81 }
82 break;
83 case 32:
84 /* From the Southern Islands ISA documentation about MTBUF:
85 * 'Memory reads of data in memory that is 32 or 64 bits do not
86 * undergo any format conversion.'
87 */
88 if (type != VK_FORMAT_TYPE_FLOAT &&
89 !desc->channel[first_non_void].pure_integer)
90 return V_008F0C_BUF_DATA_FORMAT_INVALID;
91
92 switch (desc->nr_channels) {
93 case 1:
94 return V_008F0C_BUF_DATA_FORMAT_32;
95 case 2:
96 return V_008F0C_BUF_DATA_FORMAT_32_32;
97 case 3:
98 return V_008F0C_BUF_DATA_FORMAT_32_32_32;
99 case 4:
100 return V_008F0C_BUF_DATA_FORMAT_32_32_32_32;
101 }
102 break;
103 }
104
105 return V_008F0C_BUF_DATA_FORMAT_INVALID;
106 }
107
108 uint32_t radv_translate_buffer_numformat(const struct vk_format_description *desc,
109 int first_non_void)
110 {
111 if (desc->format == VK_FORMAT_B10G11R11_UFLOAT_PACK32)
112 return V_008F0C_BUF_NUM_FORMAT_FLOAT;
113
114 if (first_non_void < 0)
115 return ~0;
116
117 switch (desc->channel[first_non_void].type) {
118 case VK_FORMAT_TYPE_SIGNED:
119 if (desc->channel[first_non_void].normalized)
120 return V_008F0C_BUF_NUM_FORMAT_SNORM;
121 else if (desc->channel[first_non_void].pure_integer)
122 return V_008F0C_BUF_NUM_FORMAT_SINT;
123 else
124 return V_008F0C_BUF_NUM_FORMAT_SSCALED;
125 break;
126 case VK_FORMAT_TYPE_UNSIGNED:
127 if (desc->channel[first_non_void].normalized)
128 return V_008F0C_BUF_NUM_FORMAT_UNORM;
129 else if (desc->channel[first_non_void].pure_integer)
130 return V_008F0C_BUF_NUM_FORMAT_UINT;
131 else
132 return V_008F0C_BUF_NUM_FORMAT_USCALED;
133 break;
134 case VK_FORMAT_TYPE_FLOAT:
135 default:
136 return V_008F0C_BUF_NUM_FORMAT_FLOAT;
137 }
138 }
139
140 uint32_t radv_translate_tex_dataformat(VkFormat format,
141 const struct vk_format_description *desc,
142 int first_non_void)
143 {
144 bool uniform = true;
145 int i;
146
147 if (!desc)
148 return ~0;
149 /* Colorspace (return non-RGB formats directly). */
150 switch (desc->colorspace) {
151 /* Depth stencil formats */
152 case VK_FORMAT_COLORSPACE_ZS:
153 switch (format) {
154 case VK_FORMAT_D16_UNORM:
155 return V_008F14_IMG_DATA_FORMAT_16;
156 case VK_FORMAT_D24_UNORM_S8_UINT:
157 case VK_FORMAT_X8_D24_UNORM_PACK32:
158 return V_008F14_IMG_DATA_FORMAT_8_24;
159 case VK_FORMAT_S8_UINT:
160 return V_008F14_IMG_DATA_FORMAT_8;
161 case VK_FORMAT_D32_SFLOAT:
162 return V_008F14_IMG_DATA_FORMAT_32;
163 case VK_FORMAT_D32_SFLOAT_S8_UINT:
164 return V_008F14_IMG_DATA_FORMAT_X24_8_32;
165 default:
166 goto out_unknown;
167 }
168
169 case VK_FORMAT_COLORSPACE_YUV:
170 goto out_unknown; /* TODO */
171
172 case VK_FORMAT_COLORSPACE_SRGB:
173 if (desc->nr_channels != 4 && desc->nr_channels != 1)
174 goto out_unknown;
175 break;
176
177 default:
178 break;
179 }
180
181 if (desc->layout == VK_FORMAT_LAYOUT_RGTC) {
182 switch(format) {
183 case VK_FORMAT_BC4_UNORM_BLOCK:
184 case VK_FORMAT_BC4_SNORM_BLOCK:
185 return V_008F14_IMG_DATA_FORMAT_BC4;
186 case VK_FORMAT_BC5_UNORM_BLOCK:
187 case VK_FORMAT_BC5_SNORM_BLOCK:
188 return V_008F14_IMG_DATA_FORMAT_BC5;
189 default:
190 break;
191 }
192 }
193
194 if (desc->layout == VK_FORMAT_LAYOUT_S3TC) {
195 switch(format) {
196 case VK_FORMAT_BC1_RGB_UNORM_BLOCK:
197 case VK_FORMAT_BC1_RGB_SRGB_BLOCK:
198 case VK_FORMAT_BC1_RGBA_UNORM_BLOCK:
199 case VK_FORMAT_BC1_RGBA_SRGB_BLOCK:
200 return V_008F14_IMG_DATA_FORMAT_BC1;
201 case VK_FORMAT_BC2_UNORM_BLOCK:
202 case VK_FORMAT_BC2_SRGB_BLOCK:
203 return V_008F14_IMG_DATA_FORMAT_BC2;
204 case VK_FORMAT_BC3_UNORM_BLOCK:
205 case VK_FORMAT_BC3_SRGB_BLOCK:
206 return V_008F14_IMG_DATA_FORMAT_BC3;
207 default:
208 break;
209 }
210 }
211
212 if (desc->layout == VK_FORMAT_LAYOUT_BPTC) {
213 switch(format) {
214 case VK_FORMAT_BC6H_UFLOAT_BLOCK:
215 case VK_FORMAT_BC6H_SFLOAT_BLOCK:
216 return V_008F14_IMG_DATA_FORMAT_BC6;
217 case VK_FORMAT_BC7_UNORM_BLOCK:
218 case VK_FORMAT_BC7_SRGB_BLOCK:
219 return V_008F14_IMG_DATA_FORMAT_BC7;
220 default:
221 break;
222 }
223 }
224
225 if (format == VK_FORMAT_E5B9G9R9_UFLOAT_PACK32) {
226 return V_008F14_IMG_DATA_FORMAT_5_9_9_9;
227 } else if (format == VK_FORMAT_B10G11R11_UFLOAT_PACK32) {
228 return V_008F14_IMG_DATA_FORMAT_10_11_11;
229 }
230
231 /* R8G8Bx_SNORM - TODO CxV8U8 */
232
233 /* hw cannot support mixed formats (except depth/stencil, since only
234 * depth is read).*/
235 if (desc->is_mixed && desc->colorspace != VK_FORMAT_COLORSPACE_ZS)
236 goto out_unknown;
237
238 /* See whether the components are of the same size. */
239 for (i = 1; i < desc->nr_channels; i++) {
240 uniform = uniform && desc->channel[0].size == desc->channel[i].size;
241 }
242
243 /* Non-uniform formats. */
244 if (!uniform) {
245 switch(desc->nr_channels) {
246 case 3:
247 if (desc->channel[0].size == 5 &&
248 desc->channel[1].size == 6 &&
249 desc->channel[2].size == 5) {
250 return V_008F14_IMG_DATA_FORMAT_5_6_5;
251 }
252 goto out_unknown;
253 case 4:
254 if (desc->channel[0].size == 5 &&
255 desc->channel[1].size == 5 &&
256 desc->channel[2].size == 5 &&
257 desc->channel[3].size == 1) {
258 return V_008F14_IMG_DATA_FORMAT_1_5_5_5;
259 }
260 if (desc->channel[0].size == 1 &&
261 desc->channel[1].size == 5 &&
262 desc->channel[2].size == 5 &&
263 desc->channel[3].size == 5) {
264 return V_008F14_IMG_DATA_FORMAT_5_5_5_1;
265 }
266 if (desc->channel[0].size == 10 &&
267 desc->channel[1].size == 10 &&
268 desc->channel[2].size == 10 &&
269 desc->channel[3].size == 2) {
270 /* Closed VK driver does this also no 2/10/10/10 snorm */
271 if (desc->channel[0].type == VK_FORMAT_TYPE_SIGNED &&
272 desc->channel[0].normalized)
273 goto out_unknown;
274 return V_008F14_IMG_DATA_FORMAT_2_10_10_10;
275 }
276 goto out_unknown;
277 }
278 goto out_unknown;
279 }
280
281 if (first_non_void < 0 || first_non_void > 3)
282 goto out_unknown;
283
284 /* uniform formats */
285 switch (desc->channel[first_non_void].size) {
286 case 4:
287 switch (desc->nr_channels) {
288 #if 0 /* Not supported for render targets */
289 case 2:
290 return V_008F14_IMG_DATA_FORMAT_4_4;
291 #endif
292 case 4:
293 return V_008F14_IMG_DATA_FORMAT_4_4_4_4;
294 }
295 break;
296 case 8:
297 switch (desc->nr_channels) {
298 case 1:
299 return V_008F14_IMG_DATA_FORMAT_8;
300 case 2:
301 return V_008F14_IMG_DATA_FORMAT_8_8;
302 case 4:
303 return V_008F14_IMG_DATA_FORMAT_8_8_8_8;
304 }
305 break;
306 case 16:
307 switch (desc->nr_channels) {
308 case 1:
309 return V_008F14_IMG_DATA_FORMAT_16;
310 case 2:
311 return V_008F14_IMG_DATA_FORMAT_16_16;
312 case 4:
313 return V_008F14_IMG_DATA_FORMAT_16_16_16_16;
314 }
315 break;
316 case 32:
317 switch (desc->nr_channels) {
318 case 1:
319 return V_008F14_IMG_DATA_FORMAT_32;
320 case 2:
321 return V_008F14_IMG_DATA_FORMAT_32_32;
322 #if 0 /* Not supported for render targets */
323 case 3:
324 return V_008F14_IMG_DATA_FORMAT_32_32_32;
325 #endif
326 case 4:
327 return V_008F14_IMG_DATA_FORMAT_32_32_32_32;
328 }
329 }
330
331 out_unknown:
332 /* R600_ERR("Unable to handle texformat %d %s\n", format, vk_format_name(format)); */
333 return ~0;
334 }
335
336 uint32_t radv_translate_tex_numformat(VkFormat format,
337 const struct vk_format_description *desc,
338 int first_non_void)
339 {
340 switch (format) {
341 case VK_FORMAT_D24_UNORM_S8_UINT:
342 return V_008F14_IMG_NUM_FORMAT_UNORM;
343 default:
344 if (first_non_void < 0) {
345 if (vk_format_is_compressed(format)) {
346 switch (format) {
347 case VK_FORMAT_BC1_RGB_SRGB_BLOCK:
348 case VK_FORMAT_BC1_RGBA_SRGB_BLOCK:
349 case VK_FORMAT_BC2_SRGB_BLOCK:
350 case VK_FORMAT_BC3_SRGB_BLOCK:
351 case VK_FORMAT_BC7_SRGB_BLOCK:
352 return V_008F14_IMG_NUM_FORMAT_SRGB;
353 case VK_FORMAT_BC4_SNORM_BLOCK:
354 case VK_FORMAT_BC5_SNORM_BLOCK:
355 case VK_FORMAT_BC6H_SFLOAT_BLOCK:
356 return V_008F14_IMG_NUM_FORMAT_SNORM;
357 default:
358 return V_008F14_IMG_NUM_FORMAT_UNORM;
359 }
360 } else if (desc->layout == VK_FORMAT_LAYOUT_SUBSAMPLED) {
361 return V_008F14_IMG_NUM_FORMAT_UNORM;
362 } else {
363 return V_008F14_IMG_NUM_FORMAT_FLOAT;
364 }
365 } else if (desc->colorspace == VK_FORMAT_COLORSPACE_SRGB) {
366 return V_008F14_IMG_NUM_FORMAT_SRGB;
367 } else {
368 switch (desc->channel[first_non_void].type) {
369 case VK_FORMAT_TYPE_FLOAT:
370 return V_008F14_IMG_NUM_FORMAT_FLOAT;
371 case VK_FORMAT_TYPE_SIGNED:
372 if (desc->channel[first_non_void].normalized)
373 return V_008F14_IMG_NUM_FORMAT_SNORM;
374 else if (desc->channel[first_non_void].pure_integer)
375 return V_008F14_IMG_NUM_FORMAT_SINT;
376 else
377 return V_008F14_IMG_NUM_FORMAT_SSCALED;
378 case VK_FORMAT_TYPE_UNSIGNED:
379 if (desc->channel[first_non_void].normalized)
380 return V_008F14_IMG_NUM_FORMAT_UNORM;
381 else if (desc->channel[first_non_void].pure_integer)
382 return V_008F14_IMG_NUM_FORMAT_UINT;
383 else
384 return V_008F14_IMG_NUM_FORMAT_USCALED;
385 default:
386 return V_008F14_IMG_NUM_FORMAT_UNORM;
387 }
388 }
389 }
390 }
391
392 uint32_t radv_translate_color_numformat(VkFormat format,
393 const struct vk_format_description *desc,
394 int first_non_void)
395 {
396 unsigned ntype;
397 if (first_non_void == -1 || desc->channel[first_non_void].type == VK_FORMAT_TYPE_FLOAT)
398 ntype = V_028C70_NUMBER_FLOAT;
399 else {
400 ntype = V_028C70_NUMBER_UNORM;
401 if (desc->colorspace == VK_FORMAT_COLORSPACE_SRGB)
402 ntype = V_028C70_NUMBER_SRGB;
403 else if (desc->channel[first_non_void].type == VK_FORMAT_TYPE_SIGNED) {
404 if (desc->channel[first_non_void].pure_integer) {
405 ntype = V_028C70_NUMBER_SINT;
406 } else if (desc->channel[first_non_void].normalized) {
407 ntype = V_028C70_NUMBER_SNORM;
408 } else
409 ntype = ~0u;
410 } else if (desc->channel[first_non_void].type == VK_FORMAT_TYPE_UNSIGNED) {
411 if (desc->channel[first_non_void].pure_integer) {
412 ntype = V_028C70_NUMBER_UINT;
413 } else if (desc->channel[first_non_void].normalized) {
414 ntype = V_028C70_NUMBER_UNORM;
415 } else
416 ntype = ~0u;
417 }
418 }
419 return ntype;
420 }
421
422 static bool radv_is_sampler_format_supported(VkFormat format, bool *linear_sampling)
423 {
424 const struct vk_format_description *desc = vk_format_description(format);
425 uint32_t num_format;
426 if (!desc || format == VK_FORMAT_UNDEFINED)
427 return false;
428 num_format = radv_translate_tex_numformat(format, desc,
429 vk_format_get_first_non_void_channel(format));
430
431 if (num_format == V_008F14_IMG_NUM_FORMAT_USCALED ||
432 num_format == V_008F14_IMG_NUM_FORMAT_SSCALED)
433 return false;
434
435 if (num_format == V_008F14_IMG_NUM_FORMAT_UNORM ||
436 num_format == V_008F14_IMG_NUM_FORMAT_SNORM ||
437 num_format == V_008F14_IMG_NUM_FORMAT_FLOAT ||
438 num_format == V_008F14_IMG_NUM_FORMAT_SRGB)
439 *linear_sampling = true;
440 else
441 *linear_sampling = false;
442 return radv_translate_tex_dataformat(format, vk_format_description(format),
443 vk_format_get_first_non_void_channel(format)) != ~0U;
444 }
445
446
447 static bool radv_is_storage_image_format_supported(struct radv_physical_device *physical_device,
448 VkFormat format)
449 {
450 const struct vk_format_description *desc = vk_format_description(format);
451 unsigned data_format, num_format;
452 if (!desc || format == VK_FORMAT_UNDEFINED)
453 return false;
454
455 data_format = radv_translate_tex_dataformat(format, desc,
456 vk_format_get_first_non_void_channel(format));
457 num_format = radv_translate_tex_numformat(format, desc,
458 vk_format_get_first_non_void_channel(format));
459
460 if(data_format == ~0 || num_format == ~0)
461 return false;
462
463 /* Extracted from the GCN3 ISA document. */
464 switch(num_format) {
465 case V_008F14_IMG_NUM_FORMAT_UNORM:
466 case V_008F14_IMG_NUM_FORMAT_SNORM:
467 case V_008F14_IMG_NUM_FORMAT_UINT:
468 case V_008F14_IMG_NUM_FORMAT_SINT:
469 case V_008F14_IMG_NUM_FORMAT_FLOAT:
470 break;
471 default:
472 return false;
473 }
474
475 switch(data_format) {
476 case V_008F14_IMG_DATA_FORMAT_8:
477 case V_008F14_IMG_DATA_FORMAT_16:
478 case V_008F14_IMG_DATA_FORMAT_8_8:
479 case V_008F14_IMG_DATA_FORMAT_32:
480 case V_008F14_IMG_DATA_FORMAT_16_16:
481 case V_008F14_IMG_DATA_FORMAT_10_11_11:
482 case V_008F14_IMG_DATA_FORMAT_11_11_10:
483 case V_008F14_IMG_DATA_FORMAT_10_10_10_2:
484 case V_008F14_IMG_DATA_FORMAT_2_10_10_10:
485 case V_008F14_IMG_DATA_FORMAT_8_8_8_8:
486 case V_008F14_IMG_DATA_FORMAT_32_32:
487 case V_008F14_IMG_DATA_FORMAT_16_16_16_16:
488 case V_008F14_IMG_DATA_FORMAT_32_32_32_32:
489 case V_008F14_IMG_DATA_FORMAT_5_6_5:
490 case V_008F14_IMG_DATA_FORMAT_1_5_5_5:
491 case V_008F14_IMG_DATA_FORMAT_5_5_5_1:
492 case V_008F14_IMG_DATA_FORMAT_4_4_4_4:
493 /* TODO: FMASK formats. */
494 return true;
495 default:
496 return false;
497 }
498 }
499
500 static bool radv_is_buffer_format_supported(VkFormat format)
501 {
502 const struct vk_format_description *desc = vk_format_description(format);
503 unsigned data_format, num_format;
504 if (!desc || format == VK_FORMAT_UNDEFINED)
505 return false;
506
507 data_format = radv_translate_buffer_dataformat(desc,
508 vk_format_get_first_non_void_channel(format));
509 num_format = radv_translate_buffer_numformat(desc,
510 vk_format_get_first_non_void_channel(format));
511
512 return data_format != V_008F0C_BUF_DATA_FORMAT_INVALID &&
513 num_format != ~0;
514 }
515
516 bool radv_is_colorbuffer_format_supported(VkFormat format, bool *blendable)
517 {
518 const struct vk_format_description *desc = vk_format_description(format);
519 uint32_t color_format = radv_translate_colorformat(format);
520 uint32_t color_swap = radv_translate_colorswap(format, false);
521 uint32_t color_num_format = radv_translate_color_numformat(format,
522 desc,
523 vk_format_get_first_non_void_channel(format));
524
525 if (color_num_format == V_028C70_NUMBER_UINT || color_num_format == V_028C70_NUMBER_SINT ||
526 color_format == V_028C70_COLOR_8_24 || color_format == V_028C70_COLOR_24_8 ||
527 color_format == V_028C70_COLOR_X24_8_32_FLOAT) {
528 *blendable = false;
529 } else
530 *blendable = true;
531 return color_format != V_028C70_COLOR_INVALID &&
532 color_swap != ~0U &&
533 color_num_format != ~0;
534 }
535
536 static bool radv_is_zs_format_supported(VkFormat format)
537 {
538 return radv_translate_dbformat(format) != V_028040_Z_INVALID;
539 }
540
541 static void
542 radv_physical_device_get_format_properties(struct radv_physical_device *physical_device,
543 VkFormat format,
544 VkFormatProperties *out_properties)
545 {
546 VkFormatFeatureFlags linear = 0, tiled = 0, buffer = 0;
547 const struct vk_format_description *desc = vk_format_description(format);
548 bool blendable;
549 if (!desc) {
550 out_properties->linearTilingFeatures = linear;
551 out_properties->optimalTilingFeatures = tiled;
552 out_properties->bufferFeatures = buffer;
553 return;
554 }
555
556 if (radv_is_storage_image_format_supported(physical_device, format)) {
557 tiled |= VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT;
558 linear |= VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT;
559 }
560
561 if (radv_is_buffer_format_supported(format)) {
562 buffer |= VK_FORMAT_FEATURE_VERTEX_BUFFER_BIT |
563 VK_FORMAT_FEATURE_UNIFORM_TEXEL_BUFFER_BIT |
564 VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_BIT;
565 }
566
567 if (vk_format_is_depth_or_stencil(format)) {
568 if (radv_is_zs_format_supported(format))
569 tiled |= VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT;
570 tiled |= VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT;
571 tiled |= VK_FORMAT_FEATURE_BLIT_SRC_BIT |
572 VK_FORMAT_FEATURE_BLIT_DST_BIT;
573 } else {
574 bool linear_sampling;
575 if (radv_is_sampler_format_supported(format, &linear_sampling)) {
576 linear |= VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT |
577 VK_FORMAT_FEATURE_BLIT_SRC_BIT;
578 tiled |= VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT |
579 VK_FORMAT_FEATURE_BLIT_SRC_BIT;
580 if (linear_sampling) {
581 linear |= VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT;
582 tiled |= VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT;
583 }
584 }
585 if (radv_is_colorbuffer_format_supported(format, &blendable)) {
586 linear |= VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT | VK_FORMAT_FEATURE_BLIT_DST_BIT;
587 tiled |= VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT | VK_FORMAT_FEATURE_BLIT_DST_BIT;
588 if (blendable) {
589 linear |= VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BLEND_BIT;
590 tiled |= VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BLEND_BIT;
591 }
592 }
593 }
594
595 if (format == VK_FORMAT_R32_UINT || format == VK_FORMAT_R32_SINT) {
596 buffer |= VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_ATOMIC_BIT;
597 linear |= VK_FORMAT_FEATURE_STORAGE_IMAGE_ATOMIC_BIT;
598 tiled |= VK_FORMAT_FEATURE_STORAGE_IMAGE_ATOMIC_BIT;
599 }
600
601 out_properties->linearTilingFeatures = linear;
602 out_properties->optimalTilingFeatures = tiled;
603 out_properties->bufferFeatures = buffer;
604 }
605
606 uint32_t radv_translate_colorformat(VkFormat format)
607 {
608 const struct vk_format_description *desc = vk_format_description(format);
609
610 #define HAS_SIZE(x,y,z,w) \
611 (desc->channel[0].size == (x) && desc->channel[1].size == (y) && \
612 desc->channel[2].size == (z) && desc->channel[3].size == (w))
613
614 if (format == VK_FORMAT_B10G11R11_UFLOAT_PACK32) /* isn't plain */
615 return V_028C70_COLOR_10_11_11;
616
617 if (desc->layout != VK_FORMAT_LAYOUT_PLAIN)
618 return V_028C70_COLOR_INVALID;
619
620 /* hw cannot support mixed formats (except depth/stencil, since
621 * stencil is not written to). */
622 if (desc->is_mixed && desc->colorspace != VK_FORMAT_COLORSPACE_ZS)
623 return V_028C70_COLOR_INVALID;
624
625 switch (desc->nr_channels) {
626 case 1:
627 switch (desc->channel[0].size) {
628 case 8:
629 return V_028C70_COLOR_8;
630 case 16:
631 return V_028C70_COLOR_16;
632 case 32:
633 return V_028C70_COLOR_32;
634 }
635 break;
636 case 2:
637 if (desc->channel[0].size == desc->channel[1].size) {
638 switch (desc->channel[0].size) {
639 case 8:
640 return V_028C70_COLOR_8_8;
641 case 16:
642 return V_028C70_COLOR_16_16;
643 case 32:
644 return V_028C70_COLOR_32_32;
645 }
646 } else if (HAS_SIZE(8,24,0,0)) {
647 return V_028C70_COLOR_24_8;
648 } else if (HAS_SIZE(24,8,0,0)) {
649 return V_028C70_COLOR_8_24;
650 }
651 break;
652 case 3:
653 if (HAS_SIZE(5,6,5,0)) {
654 return V_028C70_COLOR_5_6_5;
655 } else if (HAS_SIZE(32,8,24,0)) {
656 return V_028C70_COLOR_X24_8_32_FLOAT;
657 }
658 break;
659 case 4:
660 if (desc->channel[0].size == desc->channel[1].size &&
661 desc->channel[0].size == desc->channel[2].size &&
662 desc->channel[0].size == desc->channel[3].size) {
663 switch (desc->channel[0].size) {
664 case 4:
665 return V_028C70_COLOR_4_4_4_4;
666 case 8:
667 return V_028C70_COLOR_8_8_8_8;
668 case 16:
669 return V_028C70_COLOR_16_16_16_16;
670 case 32:
671 return V_028C70_COLOR_32_32_32_32;
672 }
673 } else if (HAS_SIZE(5,5,5,1)) {
674 return V_028C70_COLOR_1_5_5_5;
675 } else if (HAS_SIZE(1,5,5,5)) {
676 return V_028C70_COLOR_5_5_5_1;
677 } else if (HAS_SIZE(10,10,10,2)) {
678 return V_028C70_COLOR_2_10_10_10;
679 }
680 break;
681 }
682 return V_028C70_COLOR_INVALID;
683 }
684
685 uint32_t radv_colorformat_endian_swap(uint32_t colorformat)
686 {
687 if (0/*SI_BIG_ENDIAN*/) {
688 switch(colorformat) {
689 /* 8-bit buffers. */
690 case V_028C70_COLOR_8:
691 return V_028C70_ENDIAN_NONE;
692
693 /* 16-bit buffers. */
694 case V_028C70_COLOR_5_6_5:
695 case V_028C70_COLOR_1_5_5_5:
696 case V_028C70_COLOR_4_4_4_4:
697 case V_028C70_COLOR_16:
698 case V_028C70_COLOR_8_8:
699 return V_028C70_ENDIAN_8IN16;
700
701 /* 32-bit buffers. */
702 case V_028C70_COLOR_8_8_8_8:
703 case V_028C70_COLOR_2_10_10_10:
704 case V_028C70_COLOR_8_24:
705 case V_028C70_COLOR_24_8:
706 case V_028C70_COLOR_16_16:
707 return V_028C70_ENDIAN_8IN32;
708
709 /* 64-bit buffers. */
710 case V_028C70_COLOR_16_16_16_16:
711 return V_028C70_ENDIAN_8IN16;
712
713 case V_028C70_COLOR_32_32:
714 return V_028C70_ENDIAN_8IN32;
715
716 /* 128-bit buffers. */
717 case V_028C70_COLOR_32_32_32_32:
718 return V_028C70_ENDIAN_8IN32;
719 default:
720 return V_028C70_ENDIAN_NONE; /* Unsupported. */
721 }
722 } else {
723 return V_028C70_ENDIAN_NONE;
724 }
725 }
726
727 uint32_t radv_translate_dbformat(VkFormat format)
728 {
729 switch (format) {
730 case VK_FORMAT_D16_UNORM:
731 case VK_FORMAT_D16_UNORM_S8_UINT:
732 return V_028040_Z_16;
733 case VK_FORMAT_X8_D24_UNORM_PACK32:
734 case VK_FORMAT_D24_UNORM_S8_UINT:
735 return V_028040_Z_24; /* deprecated on SI */
736 case VK_FORMAT_D32_SFLOAT:
737 case VK_FORMAT_D32_SFLOAT_S8_UINT:
738 return V_028040_Z_32_FLOAT;
739 default:
740 return V_028040_Z_INVALID;
741 }
742 }
743
744 unsigned radv_translate_colorswap(VkFormat format, bool do_endian_swap)
745 {
746 const struct vk_format_description *desc = vk_format_description(format);
747
748 #define HAS_SWIZZLE(chan,swz) (desc->swizzle[chan] == VK_SWIZZLE_##swz)
749
750 if (format == VK_FORMAT_B10G11R11_UFLOAT_PACK32)
751 return V_0280A0_SWAP_STD;
752
753 if (desc->layout != VK_FORMAT_LAYOUT_PLAIN)
754 return ~0U;
755
756 switch (desc->nr_channels) {
757 case 1:
758 if (HAS_SWIZZLE(0,X))
759 return V_0280A0_SWAP_STD; /* X___ */
760 else if (HAS_SWIZZLE(3,X))
761 return V_0280A0_SWAP_ALT_REV; /* ___X */
762 break;
763 case 2:
764 if ((HAS_SWIZZLE(0,X) && HAS_SWIZZLE(1,Y)) ||
765 (HAS_SWIZZLE(0,X) && HAS_SWIZZLE(1,NONE)) ||
766 (HAS_SWIZZLE(0,NONE) && HAS_SWIZZLE(1,Y)))
767 return V_0280A0_SWAP_STD; /* XY__ */
768 else if ((HAS_SWIZZLE(0,Y) && HAS_SWIZZLE(1,X)) ||
769 (HAS_SWIZZLE(0,Y) && HAS_SWIZZLE(1,NONE)) ||
770 (HAS_SWIZZLE(0,NONE) && HAS_SWIZZLE(1,X)))
771 /* YX__ */
772 return (do_endian_swap ? V_0280A0_SWAP_STD : V_0280A0_SWAP_STD_REV);
773 else if (HAS_SWIZZLE(0,X) && HAS_SWIZZLE(3,Y))
774 return V_0280A0_SWAP_ALT; /* X__Y */
775 else if (HAS_SWIZZLE(0,Y) && HAS_SWIZZLE(3,X))
776 return V_0280A0_SWAP_ALT_REV; /* Y__X */
777 break;
778 case 3:
779 if (HAS_SWIZZLE(0,X))
780 return (do_endian_swap ? V_0280A0_SWAP_STD_REV : V_0280A0_SWAP_STD);
781 else if (HAS_SWIZZLE(0,Z))
782 return V_0280A0_SWAP_STD_REV; /* ZYX */
783 break;
784 case 4:
785 /* check the middle channels, the 1st and 4th channel can be NONE */
786 if (HAS_SWIZZLE(1,Y) && HAS_SWIZZLE(2,Z)) {
787 return V_0280A0_SWAP_STD; /* XYZW */
788 } else if (HAS_SWIZZLE(1,Z) && HAS_SWIZZLE(2,Y)) {
789 return V_0280A0_SWAP_STD_REV; /* WZYX */
790 } else if (HAS_SWIZZLE(1,Y) && HAS_SWIZZLE(2,X)) {
791 return V_0280A0_SWAP_ALT; /* ZYXW */
792 } else if (HAS_SWIZZLE(1,Z) && HAS_SWIZZLE(2,W)) {
793 /* YZWX */
794 if (desc->is_array)
795 return V_0280A0_SWAP_ALT_REV;
796 else
797 return (do_endian_swap ? V_0280A0_SWAP_ALT : V_0280A0_SWAP_ALT_REV);
798 }
799 break;
800 }
801 return ~0U;
802 }
803
804 bool radv_format_pack_clear_color(VkFormat format,
805 uint32_t clear_vals[2],
806 VkClearColorValue *value)
807 {
808 uint8_t r = 0, g = 0, b = 0, a = 0;
809 const struct vk_format_description *desc = vk_format_description(format);
810
811 if (vk_format_get_component_bits(format, VK_FORMAT_COLORSPACE_RGB, 0) <= 8) {
812 if (desc->colorspace == VK_FORMAT_COLORSPACE_RGB) {
813 r = float_to_ubyte(value->float32[0]);
814 g = float_to_ubyte(value->float32[1]);
815 b = float_to_ubyte(value->float32[2]);
816 a = float_to_ubyte(value->float32[3]);
817 } else if (desc->colorspace == VK_FORMAT_COLORSPACE_SRGB) {
818 r = util_format_linear_float_to_srgb_8unorm(value->float32[0]);
819 g = util_format_linear_float_to_srgb_8unorm(value->float32[1]);
820 b = util_format_linear_float_to_srgb_8unorm(value->float32[2]);
821 a = float_to_ubyte(value->float32[3]);
822 }
823 }
824 switch (format) {
825 case VK_FORMAT_R8_UNORM:
826 case VK_FORMAT_R8_SRGB:
827 clear_vals[0] = r;
828 clear_vals[1] = 0;
829 break;
830 case VK_FORMAT_R8G8_UNORM:
831 case VK_FORMAT_R8G8_SRGB:
832 clear_vals[0] = r | g << 8;
833 clear_vals[1] = 0;
834 break;
835 case VK_FORMAT_R8G8B8A8_SRGB:
836 case VK_FORMAT_R8G8B8A8_UNORM:
837 clear_vals[0] = r | g << 8 | b << 16 | a << 24;
838 clear_vals[1] = 0;
839 break;
840 case VK_FORMAT_B8G8R8A8_SRGB:
841 case VK_FORMAT_B8G8R8A8_UNORM:
842 clear_vals[0] = b | g << 8 | r << 16 | a << 24;
843 clear_vals[1] = 0;
844 break;
845 case VK_FORMAT_A8B8G8R8_UNORM_PACK32:
846 case VK_FORMAT_A8B8G8R8_SRGB_PACK32:
847 clear_vals[0] = r | g << 8 | b << 16 | a << 24;
848 clear_vals[1] = 0;
849 break;
850 case VK_FORMAT_R8_UINT:
851 clear_vals[0] = value->uint32[0] & 0xff;
852 clear_vals[1] = 0;
853 break;
854 case VK_FORMAT_R16_UINT:
855 clear_vals[0] = value->uint32[0] & 0xffff;
856 clear_vals[1] = 0;
857 break;
858 case VK_FORMAT_R8G8_UINT:
859 clear_vals[0] = value->uint32[0] & 0xff;
860 clear_vals[0] |= (value->uint32[1] & 0xff) << 8;
861 clear_vals[1] = 0;
862 break;
863 case VK_FORMAT_R8G8B8A8_UINT:
864 clear_vals[0] = value->uint32[0] & 0xff;
865 clear_vals[0] |= (value->uint32[1] & 0xff) << 8;
866 clear_vals[0] |= (value->uint32[2] & 0xff) << 16;
867 clear_vals[0] |= (value->uint32[3] & 0xff) << 24;
868 clear_vals[1] = 0;
869 break;
870 case VK_FORMAT_A8B8G8R8_UINT_PACK32:
871 clear_vals[0] = value->uint32[0] & 0xff;
872 clear_vals[0] |= (value->uint32[1] & 0xff) << 8;
873 clear_vals[0] |= (value->uint32[2] & 0xff) << 16;
874 clear_vals[0] |= (value->uint32[3] & 0xff) << 24;
875 clear_vals[1] = 0;
876 break;
877 case VK_FORMAT_R16G16_UINT:
878 clear_vals[0] = value->uint32[0] & 0xffff;
879 clear_vals[0] |= (value->uint32[1] & 0xffff) << 16;
880 clear_vals[1] = 0;
881 break;
882 case VK_FORMAT_R16G16B16A16_UINT:
883 clear_vals[0] = value->uint32[0] & 0xffff;
884 clear_vals[0] |= (value->uint32[1] & 0xffff) << 16;
885 clear_vals[1] = value->uint32[2] & 0xffff;
886 clear_vals[1] |= (value->uint32[3] & 0xffff) << 16;
887 break;
888 case VK_FORMAT_R32_UINT:
889 clear_vals[0] = value->uint32[0];
890 clear_vals[1] = 0;
891 break;
892 case VK_FORMAT_R32G32_UINT:
893 clear_vals[0] = value->uint32[0];
894 clear_vals[1] = value->uint32[1];
895 break;
896 case VK_FORMAT_R32_SINT:
897 clear_vals[0] = value->int32[0];
898 clear_vals[1] = 0;
899 break;
900 case VK_FORMAT_R16_SFLOAT:
901 clear_vals[0] = util_float_to_half(value->float32[0]);
902 clear_vals[1] = 0;
903 break;
904 case VK_FORMAT_R16G16_SFLOAT:
905 clear_vals[0] = util_float_to_half(value->float32[0]);
906 clear_vals[0] |= (uint32_t)util_float_to_half(value->float32[1]) << 16;
907 clear_vals[1] = 0;
908 break;
909 case VK_FORMAT_R16G16B16A16_SFLOAT:
910 clear_vals[0] = util_float_to_half(value->float32[0]);
911 clear_vals[0] |= (uint32_t)util_float_to_half(value->float32[1]) << 16;
912 clear_vals[1] = util_float_to_half(value->float32[2]);
913 clear_vals[1] |= (uint32_t)util_float_to_half(value->float32[3]) << 16;
914 break;
915 case VK_FORMAT_R16_UNORM:
916 clear_vals[0] = ((uint16_t)util_iround(CLAMP(value->float32[0], 0.0f, 1.0f) * 0xffff)) & 0xffff;
917 clear_vals[1] = 0;
918 break;
919 case VK_FORMAT_R16G16_UNORM:
920 clear_vals[0] = ((uint16_t)util_iround(CLAMP(value->float32[0], 0.0f, 1.0f) * 0xffff)) & 0xffff;
921 clear_vals[0] |= ((uint16_t)util_iround(CLAMP(value->float32[1], 0.0f, 1.0f) * 0xffff)) << 16;
922 clear_vals[1] = 0;
923 break;
924 case VK_FORMAT_R16G16B16A16_UNORM:
925 clear_vals[0] = ((uint16_t)util_iround(CLAMP(value->float32[0], 0.0f, 1.0f) * 0xffff)) & 0xffff;
926 clear_vals[0] |= ((uint16_t)util_iround(CLAMP(value->float32[1], 0.0f, 1.0f) * 0xffff)) << 16;
927 clear_vals[1] = ((uint16_t)util_iround(CLAMP(value->float32[2], 0.0f, 1.0f) * 0xffff)) & 0xffff;
928 clear_vals[1] |= ((uint16_t)util_iround(CLAMP(value->float32[3], 0.0f, 1.0f) * 0xffff)) << 16;
929 break;
930 case VK_FORMAT_A2B10G10R10_UNORM_PACK32:
931 /* TODO */
932 return false;
933 case VK_FORMAT_R32G32_SFLOAT:
934 clear_vals[0] = fui(value->float32[0]);
935 clear_vals[1] = fui(value->float32[1]);
936 break;
937 case VK_FORMAT_R32_SFLOAT:
938 clear_vals[1] = 0;
939 clear_vals[0] = fui(value->float32[0]);
940 break;
941 default:
942 fprintf(stderr, "failed to fast clear %d\n", format);
943 return false;
944 }
945 return true;
946 }
947
948 void radv_GetPhysicalDeviceFormatProperties(
949 VkPhysicalDevice physicalDevice,
950 VkFormat format,
951 VkFormatProperties* pFormatProperties)
952 {
953 RADV_FROM_HANDLE(radv_physical_device, physical_device, physicalDevice);
954
955 radv_physical_device_get_format_properties(physical_device,
956 format,
957 pFormatProperties);
958 }
959
960 void radv_GetPhysicalDeviceFormatProperties2KHR(
961 VkPhysicalDevice physicalDevice,
962 VkFormat format,
963 VkFormatProperties2KHR* pFormatProperties)
964 {
965 RADV_FROM_HANDLE(radv_physical_device, physical_device, physicalDevice);
966
967 radv_physical_device_get_format_properties(physical_device,
968 format,
969 &pFormatProperties->formatProperties);
970 }
971
972 VkResult radv_GetPhysicalDeviceImageFormatProperties(
973 VkPhysicalDevice physicalDevice,
974 VkFormat format,
975 VkImageType type,
976 VkImageTiling tiling,
977 VkImageUsageFlags usage,
978 VkImageCreateFlags createFlags,
979 VkImageFormatProperties* pImageFormatProperties)
980 {
981 RADV_FROM_HANDLE(radv_physical_device, physical_device, physicalDevice);
982 VkFormatProperties format_props;
983 VkFormatFeatureFlags format_feature_flags;
984 VkExtent3D maxExtent;
985 uint32_t maxMipLevels;
986 uint32_t maxArraySize;
987 VkSampleCountFlags sampleCounts = VK_SAMPLE_COUNT_1_BIT;
988
989 radv_physical_device_get_format_properties(physical_device, format,
990 &format_props);
991 if (tiling == VK_IMAGE_TILING_LINEAR) {
992 format_feature_flags = format_props.linearTilingFeatures;
993 } else if (tiling == VK_IMAGE_TILING_OPTIMAL) {
994 format_feature_flags = format_props.optimalTilingFeatures;
995 } else {
996 unreachable("bad VkImageTiling");
997 }
998
999 if (format_feature_flags == 0)
1000 goto unsupported;
1001
1002 switch (type) {
1003 default:
1004 unreachable("bad vkimage type\n");
1005 case VK_IMAGE_TYPE_1D:
1006 maxExtent.width = 16384;
1007 maxExtent.height = 1;
1008 maxExtent.depth = 1;
1009 maxMipLevels = 15; /* log2(maxWidth) + 1 */
1010 maxArraySize = 2048;
1011 break;
1012 case VK_IMAGE_TYPE_2D:
1013 maxExtent.width = 16384;
1014 maxExtent.height = 16384;
1015 maxExtent.depth = 1;
1016 maxMipLevels = 15; /* log2(maxWidth) + 1 */
1017 maxArraySize = 2048;
1018 break;
1019 case VK_IMAGE_TYPE_3D:
1020 maxExtent.width = 2048;
1021 maxExtent.height = 2048;
1022 maxExtent.depth = 2048;
1023 maxMipLevels = 12; /* log2(maxWidth) + 1 */
1024 maxArraySize = 1;
1025 break;
1026 }
1027
1028 if (tiling == VK_IMAGE_TILING_OPTIMAL &&
1029 type == VK_IMAGE_TYPE_2D &&
1030 (format_feature_flags & (VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT |
1031 VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT)) &&
1032 !(createFlags & VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT) &&
1033 !(usage & VK_IMAGE_USAGE_STORAGE_BIT)) {
1034 sampleCounts |= VK_SAMPLE_COUNT_2_BIT | VK_SAMPLE_COUNT_4_BIT | VK_SAMPLE_COUNT_8_BIT;
1035 }
1036
1037 if (usage & VK_IMAGE_USAGE_SAMPLED_BIT) {
1038 if (!(format_feature_flags & VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT)) {
1039 goto unsupported;
1040 }
1041 }
1042
1043 if (usage & VK_IMAGE_USAGE_STORAGE_BIT) {
1044 if (!(format_feature_flags & VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT)) {
1045 goto unsupported;
1046 }
1047 }
1048
1049 if (usage & VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT) {
1050 if (!(format_feature_flags & VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT)) {
1051 goto unsupported;
1052 }
1053 }
1054
1055 if (usage & VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT) {
1056 if (!(format_feature_flags & VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT)) {
1057 goto unsupported;
1058 }
1059 }
1060
1061 *pImageFormatProperties = (VkImageFormatProperties) {
1062 .maxExtent = maxExtent,
1063 .maxMipLevels = maxMipLevels,
1064 .maxArrayLayers = maxArraySize,
1065 .sampleCounts = sampleCounts,
1066
1067 /* FINISHME: Accurately calculate
1068 * VkImageFormatProperties::maxResourceSize.
1069 */
1070 .maxResourceSize = UINT32_MAX,
1071 };
1072
1073 return VK_SUCCESS;
1074 unsupported:
1075 *pImageFormatProperties = (VkImageFormatProperties) {
1076 .maxExtent = { 0, 0, 0 },
1077 .maxMipLevels = 0,
1078 .maxArrayLayers = 0,
1079 .sampleCounts = 0,
1080 .maxResourceSize = 0,
1081 };
1082
1083 return VK_ERROR_FORMAT_NOT_SUPPORTED;
1084 }
1085
1086 VkResult radv_GetPhysicalDeviceImageFormatProperties2KHR(
1087 VkPhysicalDevice physicalDevice,
1088 const VkPhysicalDeviceImageFormatInfo2KHR* pImageFormatInfo,
1089 VkImageFormatProperties2KHR *pImageFormatProperties)
1090 {
1091 return radv_GetPhysicalDeviceImageFormatProperties(physicalDevice,
1092 pImageFormatInfo->format,
1093 pImageFormatInfo->type,
1094 pImageFormatInfo->tiling,
1095 pImageFormatInfo->usage,
1096 pImageFormatInfo->flags,
1097 &pImageFormatProperties->imageFormatProperties);
1098 }
1099
1100 void radv_GetPhysicalDeviceSparseImageFormatProperties(
1101 VkPhysicalDevice physicalDevice,
1102 VkFormat format,
1103 VkImageType type,
1104 uint32_t samples,
1105 VkImageUsageFlags usage,
1106 VkImageTiling tiling,
1107 uint32_t* pNumProperties,
1108 VkSparseImageFormatProperties* pProperties)
1109 {
1110 /* Sparse images are not yet supported. */
1111 *pNumProperties = 0;
1112 }
1113
1114 void radv_GetPhysicalDeviceSparseImageFormatProperties2KHR(
1115 VkPhysicalDevice physicalDevice,
1116 const VkPhysicalDeviceSparseImageFormatInfo2KHR* pFormatInfo,
1117 uint32_t *pPropertyCount,
1118 VkSparseImageFormatProperties2KHR* pProperties)
1119 {
1120 /* Sparse images are not yet supported. */
1121 *pPropertyCount = 0;
1122 }