2 * Copyright © 2016 Bas Nieuwenhuizen
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
24 #ifndef RADV_DESCRIPTOR_SET_H
25 #define RADV_DESCRIPTOR_SET_H
27 #include <vulkan/vulkan.h>
31 struct radv_descriptor_set_binding_layout
{
32 VkDescriptorType type
;
34 /* Number of array elements in this binding */
38 uint16_t dynamic_offset_offset
;
40 uint16_t dynamic_offset_count
;
41 /* redundant with the type, each for a single array element */
44 /* Offset in the radv_descriptor_set_layout of the immutable samplers, or 0
45 * if there are no immutable samplers. */
46 uint32_t immutable_samplers_offset
;
47 bool immutable_samplers_equal
;
50 struct radv_descriptor_set_layout
{
51 /* The create flags for this descriptor set layout */
52 VkDescriptorSetLayoutCreateFlags flags
;
54 /* Number of bindings in this descriptor set */
55 uint32_t binding_count
;
57 /* Total size of the descriptor set with room for all array entries */
60 /* Shader stages affected by this descriptor set */
61 uint16_t shader_stages
;
62 uint16_t dynamic_shader_stages
;
64 /* Number of dynamic offsets used by this descriptor set */
65 uint16_t dynamic_offset_count
;
67 bool has_immutable_samplers
;
69 /* Bindings in this descriptor set */
70 struct radv_descriptor_set_binding_layout binding
[0];
73 struct radv_pipeline_layout
{
75 struct radv_descriptor_set_layout
*layout
;
77 uint32_t dynamic_offset_start
;
81 uint32_t push_constant_size
;
82 uint32_t dynamic_offset_count
;
84 unsigned char sha1
[20];
87 static inline const uint32_t *
88 radv_immutable_samplers(const struct radv_descriptor_set_layout
*set
,
89 const struct radv_descriptor_set_binding_layout
*binding
) {
90 return (const uint32_t*)((const char*)set
+ binding
->immutable_samplers_offset
);
92 #endif /* RADV_DESCRIPTOR_SET_H */