• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright © 2022 Collabora Ltd. and Red Hat Inc.
3  * SPDX-License-Identifier: MIT
4  */
5 #ifndef NVK_FORMAT_H
6 #define NVK_FORMAT_H 1
7 
8 #include "nvk_private.h"
9 #include "vk_format.h"
10 
11 #include "util/format/u_formats.h"
12 #include "nv_device_info.h"
13 
14 struct nvk_physical_device;
15 
16 struct nvk_va_format {
17    uint8_t bit_widths;
18    uint8_t swap_rb:1;
19    uint8_t type:7;
20 };
21 
22 bool
23 nvk_format_supports_atomics(const struct nv_device_info *dev,
24                             enum pipe_format p_format);
25 
26 const struct nvk_va_format *
27 nvk_get_va_format(const struct nvk_physical_device *pdev, VkFormat format);
28 
29 static inline enum pipe_format
nvk_format_to_pipe_format(VkFormat vkformat)30 nvk_format_to_pipe_format(VkFormat vkformat)
31 {
32    switch (vkformat) {
33    case VK_FORMAT_R10X6_UNORM_PACK16:
34    case VK_FORMAT_R12X4_UNORM_PACK16:
35       return PIPE_FORMAT_R16_UNORM;
36    case VK_FORMAT_R10X6G10X6_UNORM_2PACK16:
37    case VK_FORMAT_R12X4G12X4_UNORM_2PACK16:
38       return PIPE_FORMAT_R16G16_UNORM;
39    default:
40       return vk_format_to_pipe_format(vkformat);
41    }
42 }
43 
44 #endif
45