| 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 "hk_private.h" |
| 11 |
|
| 12 |
#include "vk_descriptor_set_layout.h" |
| 13 |
#include "vk_object.h" |
| 14 |
|
| 15 |
struct hk_device; |
| 16 |
struct hk_physical_device; |
| 17 |
struct hk_sampler; |
| 18 |
struct vk_pipeline_layout; |
| 19 |
|
| 20 |
struct hk_descriptor_set_binding_layout { |
| 21 |
/* The type of the descriptors in this binding */ |
| 22 |
VkDescriptorType type; |
| 23 |
|
| 24 |
/* Flags provided when this binding was created */ |
| 25 |
VkDescriptorBindingFlags flags; |
| 26 |
|
| 27 |
/* Number of array elements in this binding (or size in bytes for inline |
| 28 |
* uniform data) |
| 29 |
*/ |
| 30 |
uint32_t array_size; |
| 31 |
|
| 32 |
/* Offset into the descriptor buffer where this descriptor lives */ |
| 33 |
uint32_t offset; |
| 34 |
|
| 35 |
/* Stride between array elements in the descriptor buffer */ |
| 36 |
uint8_t stride; |
| 37 |
|
| 38 |
/* Index into the dynamic buffer binding array */ |
| 39 |
uint8_t dynamic_buffer_index; |
| 40 |
|
| 41 |
/* Immutable samplers (or NULL if no immutable samplers) */ |
| 42 |
struct hk_sampler **immutable_samplers; |
| 43 |
}; |
| 44 |
|
| 45 |
struct hk_descriptor_set_layout { |
| 46 |
struct vk_descriptor_set_layout vk; |
| 47 |
|
| 48 |
/* Size of the descriptor buffer for this descriptor set */ |
| 49 |
/* Does not contain the size needed for variable count descriptors */ |
| 50 |
uint32_t non_variable_descriptor_buffer_size; |
| 51 |
|
| 52 |
/* Number of bindings in this descriptor set */ |
| 53 |
uint32_t binding_count; |
| 54 |
|
| 55 |
/* Bindings in this descriptor set */ |
| 56 |
struct hk_descriptor_set_binding_layout binding[0]; |
| 57 |
}; |
| 58 |
|
| 59 |
VK_DEFINE_NONDISP_HANDLE_CASTS(hk_descriptor_set_layout, vk.base, |
| 60 |
VkDescriptorSetLayout, |
| 61 |
VK_OBJECT_TYPE_DESCRIPTOR_SET_LAYOUT) |
| 62 |
|
| 63 |
void hk_descriptor_stride_align_for_type( |
| 64 |
const struct hk_physical_device *pdev, VkDescriptorType type, |
| 65 |
const VkMutableDescriptorTypeListEXT *type_list, uint32_t *stride, |
| 66 |
uint32_t *alignment); |
| 67 |
|
| 68 |
static inline struct hk_descriptor_set_layout * |
| 69 |
vk_to_hk_descriptor_set_layout(struct vk_descriptor_set_layout *layout) |
| 70 |
{ |
| 71 |
return container_of(layout, struct hk_descriptor_set_layout, vk); |
| 72 |
} |