1 /*
2  * Copyright © 2017 Intel Corporation
3  * Copyright © 2022 Collabora, Ltd
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining a
6  * copy of this software and associated documentation files (the "Software"),
7  * to deal in the Software without restriction, including without limitation
8  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9  * and/or sell copies of the Software, and to permit persons to whom the
10  * Software is furnished to do so, subject to the following conditions:
11  *
12  * The above copyright notice and this permission notice (including the next
13  * paragraph) shall be included in all copies or substantial portions of the
14  * Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
19  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
22  * IN THE SOFTWARE.
23  */
24 #ifndef VK_DESCRIPTOR_UPDATE_TEMPLATE_H
25 #define VK_DESCRIPTOR_UPDATE_TEMPLATE_H
26 
27 #include "vk_object.h"
28 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 
33 struct vk_descriptor_template_entry {
34    /** VkDescriptorUpdateTemplateEntry::descriptorType */
35    VkDescriptorType type;
36 
37    /** VkDescriptorUpdateTemplateEntry::dstBinding */
38    uint32_t binding;
39 
40    /** VkDescriptorUpdateTemplateEntry::dstArrayElement */
41    uint32_t array_element;
42 
43    /** VkDescriptorUpdateTemplateEntry::descriptorCount */
44    uint32_t array_count;
45 
46    /** VkDescriptorUpdateTemplateEntry::offset
47     *
48     * Offset into the user provided data */
49    size_t offset;
50 
51    /** VkDescriptorUpdateTemplateEntry::stride
52     *
53     * Stride between elements into the user provided data
54     */
55    size_t stride;
56 };
57 
58 struct vk_descriptor_update_template {
59    struct vk_object_base base;
60 
61    /** VkDescriptorUpdateTemplateCreateInfo::templateType */
62    VkDescriptorUpdateTemplateType type;
63 
64    /** VkDescriptorUpdateTemplateCreateInfo::pipelineBindPoint */
65    VkPipelineBindPoint bind_point;
66 
67    /** VkDescriptorUpdateTemplateCreateInfo::set
68     *
69     * The descriptor set this template corresponds to. This value is only
70     * valid if the template was created with the templateType
71     * VK_DESCRIPTOR_UPDATE_TEMPLATE_TYPE_DESCRIPTOR_SET.
72     */
73    uint8_t set;
74 
75    /** VkDescriptorUpdateTemplateCreateInfo::descriptorUpdateEntryCount */
76    uint32_t entry_count;
77 
78    /** Entries of the template */
79    struct vk_descriptor_template_entry entries[0];
80 };
81 
82 VK_DEFINE_NONDISP_HANDLE_CASTS(vk_descriptor_update_template, base,
83                                VkDescriptorUpdateTemplate,
84                                VK_OBJECT_TYPE_DESCRIPTOR_UPDATE_TEMPLATE)
85 
86 #ifdef __cplusplus
87 }
88 #endif
89 
90 #endif /* VK_DESCRIPTOR_UPDATE_TEMPLATE_H */
91