xref: /aosp_15_r20/external/mesa3d/src/asahi/vulkan/hk_image_view.h (revision 6104692788411f58d303aa86923a9ff6ecaded22)
1 /*
2  * Copyright 2024 Valve Corporation
3  * Copyright 2024 Alyssa Rosenzweig
4  * Copyright 2022-2023 Collabora Ltd. and Red Hat Inc.
5  * SPDX-License-Identifier: MIT
6  */
7 
8 #pragma once
9 
10 #include "agx_pack.h"
11 #include "hk_private.h"
12 #include "vk_image.h"
13 
14 struct hk_device;
15 
16 #define HK_MAX_PLANES      3
17 #define HK_MAX_IMAGE_DESCS (10 * HK_MAX_PLANES)
18 
19 struct hk_image_view {
20    struct vk_image_view vk;
21 
22    uint32_t descriptor_index[HK_MAX_IMAGE_DESCS];
23    uint8_t descriptor_count;
24 
25    uint8_t plane_count;
26    struct {
27       uint8_t image_plane;
28 
29       /** Descriptors used for eMRT. We delay upload since we want them
30        * contiguous in memory, although this could be reworked if we wanted.
31        */
32       struct agx_texture_packed emrt_texture;
33       struct agx_pbe_packed emrt_pbe;
34 
35       /** Index in the image descriptor table for the sampled image descriptor */
36       uint32_t sampled_desc_index;
37 
38       /** Index in the image descriptor table for the storage image descriptor */
39       uint32_t storage_desc_index;
40 
41       /** Index in the image descriptor table for the readonly storage image
42        * descriptor.
43        */
44       uint32_t ro_storage_desc_index;
45 
46       /** Index in the image descriptor table for the texture descriptor used
47        * for background programs.
48        */
49       uint32_t background_desc_index;
50       uint32_t layered_background_desc_index;
51 
52       /** Index in the image descriptor table for the texture descriptor used
53        * for input attachments.
54        */
55       uint32_t ia_desc_index;
56 
57       /** Index in the image descriptor table for the PBE descriptor used for
58        * end-of-tile programs.
59        */
60       uint32_t eot_pbe_desc_index;
61       uint32_t layered_eot_pbe_desc_index;
62    } planes[3];
63 };
64 
65 VK_DEFINE_NONDISP_HANDLE_CASTS(hk_image_view, vk.base, VkImageView,
66                                VK_OBJECT_TYPE_IMAGE_VIEW)
67