Debian Codegraph @

src/kosmickrisp/vulkan/kk_descriptor_set_layout.h

raw symbols SCIP
1 /*
2 * Copyright © 2022 Collabora Ltd. and Red Hat Inc.
3 * Copyright 2025 LunarG, Inc.
4 * Copyright 2025 Google LLC
5 * SPDX-License-Identifier: MIT
6 */
7
8 #ifndef KK_DESCRIPTOR_SET_LAYOUT
9 #define KK_DESCRIPTOR_SET_LAYOUT 1
10
11 #include "kk_private.h"
12
13 #include "vk_descriptor_set_layout.h"
14 #include "vk_object.h"
15
16 #include "util/bitset.h"
17
18 struct kk_device;
19 struct kk_physical_device;
20 struct kk_sampler;
21 struct vk_pipeline_layout;
22
23 struct kk_descriptor_set_binding_layout {
24 /* The type of the descriptors in this binding */
25 VkDescriptorType type;
26
27 /* Flags provided when this binding was created */
28 VkDescriptorBindingFlags flags;
29
30 /* Number of array elements in this binding (or size in bytes for inline
31 * uniform data)
32 */
33 uint32_t array_size;
34
35 /* Offset into the descriptor buffer where this descriptor lives */
36 uint32_t offset;
37
38 /* Stride between array elements in the descriptor buffer */
39 uint8_t stride;
40
41 /* Index into the dynamic buffer binding array */
42 uint8_t dynamic_buffer_index;
43
44 /* Immutable samplers (or NULL if no immutable samplers) */
45 struct kk_sampler **immutable_samplers;
46 };
47
48 struct kk_descriptor_set_layout {
49 struct vk_descriptor_set_layout vk;
50
51 VkDescriptorSetLayoutCreateFlagBits flags;
52
53 /* Size of the descriptor buffer for this descriptor set */
54 /* Does not contain the size needed for variable count descriptors */
55 uint32_t non_variable_descriptor_buffer_size;
56
57 /* Maximum possible buffer size for this descriptor set */
58 uint32_t max_buffer_size;
59
60 /* Which dynamic buffers are UBOs */
61 BITSET_DECLARE(dynamic_ubos, KK_MAX_DYNAMIC_BUFFERS);
62
63 /* Number of bindings in this descriptor set */
64 uint32_t binding_count;
65
66 /* Number of descriptors in the layout */
67 uint32_t descriptor_count;
68
69 /* Address to the embedded sampler descriptor buffer.
70 *
71 * This is allocated from nvk_device::heap and has the size
72 * non_variable_descriptor_buffer_size.
73 */
74 uint64_t embedded_samplers_addr;
75
76 /* Bindings in this descriptor set */
77 struct kk_descriptor_set_binding_layout binding[0];
78 };
79
80 VK_DEFINE_NONDISP_HANDLE_CASTS(kk_descriptor_set_layout, vk.base,
81 VkDescriptorSetLayout,
82 VK_OBJECT_TYPE_DESCRIPTOR_SET_LAYOUT)
83
84 void kk_descriptor_stride_align_for_type(
85 VkDescriptorType type, const VkMutableDescriptorTypeListEXT *type_list,
86 uint32_t *stride, uint32_t *alignment);
87
88 static inline struct kk_descriptor_set_layout *
89 vk_to_kk_descriptor_set_layout(struct vk_descriptor_set_layout *layout)
90 {
91 return container_of(layout, struct kk_descriptor_set_layout, vk);
92 }
93
94 #endif /* KK_DESCRIPTOR_SET_LAYOUT */