About Social Code
aboutsummaryrefslogtreecommitdiff
path: root/src/kosmickrisp/vulkan/kk_image_view.h
blob: 1a18c5d6f6689a25eef597f588f24f77022ccbb6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/*
 * Copyright © 2022 Collabora Ltd. and Red Hat Inc.
 * Copyright 2025 LunarG, Inc.
 * Copyright 2025 Google LLC
 * SPDX-License-Identifier: MIT
 */

#ifndef KK_IMAGE_VIEW_H
#define KK_IMAGE_VIEW_H 1

#include "kk_private.h"

#include "kosmickrisp/bridge/mtl_types.h"

#include "util/format/u_formats.h"

#include "vk_image.h"

struct kk_device;

struct kk_image_view {
   struct vk_image_view vk;

   uint8_t plane_count;
   struct {
      uint8_t image_plane;

      enum pipe_format format;

      mtl_texture *mtl_handle_sampled;
      mtl_texture
         *mtl_handle_storage; // TODO_KOSMICKRISP We can probably get rid of
                              // this once we lower 2D cubes and 3D to 2D array?

      /* Cached handle so we don't have to retrieve it from the image when we
       * render */
      mtl_texture *mtl_handle_render;

      /* Input attachment handle. Required since input attachments needs to be
       * arrays, and sampled may not be */
      mtl_texture *mtl_handle_input;

      uint64_t sampled_gpu_resource_id;
      uint64_t storage_gpu_resource_id;
      uint64_t input_gpu_resource_id;
   } planes[3];
};

VK_DEFINE_NONDISP_HANDLE_CASTS(kk_image_view, vk.base, VkImageView,
                               VK_OBJECT_TYPE_IMAGE_VIEW)

VkResult kk_image_view_init(struct kk_device *dev, struct kk_image_view *view,
                            const VkImageViewCreateInfo *pCreateInfo);

void kk_image_view_finish(struct kk_device *dev, struct kk_image_view *view);

#endif /* KK_IMAGE_VIEW_H */