1 /* 2 * Copyright © 2024 Valve Corporation 3 * 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: 10 * 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 13 * Software. 14 * 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 21 * IN THE SOFTWARE. 22 */ 23 24 #ifndef VK_DEVICE_GENERATED_COMMANDS_H 25 #define VK_DEVICE_GENERATED_COMMANDS_H 26 27 #include <vulkan/vulkan_core.h> 28 #include "vk_object.h" 29 30 enum mesa_vk_dgc_types { 31 MESA_VK_DGC_IES, 32 MESA_VK_DGC_PC, 33 MESA_VK_DGC_SI, 34 MESA_VK_DGC_IB, 35 MESA_VK_DGC_VB, 36 MESA_VK_DGC_DRAW, 37 MESA_VK_DGC_DRAW_INDEXED, 38 MESA_VK_DGC_DRAW_MESH, 39 MESA_VK_DGC_DISPATCH, 40 MESA_VK_DGC_RT, 41 }; 42 43 struct vk_indirect_command_vertex_layout { 44 uint32_t binding; 45 uint32_t src_offset_B; 46 }; 47 48 struct vk_indirect_command_push_constant_layout { 49 VkShaderStageFlags stages; 50 uint32_t dst_offset_B; 51 uint32_t src_offset_B; 52 uint32_t size_B; 53 }; 54 55 /* this struct must come first in the parent class, 56 * the final member of the parent class must be 57 VkIndirectCommandsLayoutTokenEXT tokens[0]; 58 */ 59 struct vk_indirect_command_layout { 60 struct vk_object_base base; 61 62 /* mask of mesa_vk_dgc_types */ 63 uint32_t dgc_info; 64 65 VkPipelineLayout layout; 66 67 VkIndirectCommandsLayoutUsageFlagsEXT usage; 68 VkShaderStageFlags stages; 69 70 size_t stride; 71 72 uint32_t vertex_bindings; 73 74 uint32_t ies_src_offset_B; 75 bool is_shaders; 76 77 bool delete_layout; 78 79 bool index_mode_is_dx; 80 uint32_t index_src_offset_B; 81 82 uint32_t draw_src_offset_B; 83 bool draw_count; 84 85 uint32_t dispatch_src_offset_B; 86 87 unsigned token_count; 88 89 struct vk_indirect_command_push_constant_layout si_layout; 90 91 uint32_t n_pc_layouts; 92 struct vk_indirect_command_push_constant_layout *pc_layouts; 93 94 uint32_t n_vb_layouts; 95 struct vk_indirect_command_vertex_layout *vb_layouts; 96 }; 97 98 void * 99 vk_indirect_command_layout_create(struct vk_device *device, 100 const VkIndirectCommandsLayoutCreateInfoEXT* pCreateInfo, 101 const VkAllocationCallbacks* pAllocator, 102 size_t struct_size); 103 104 void 105 vk_indirect_command_layout_destroy(struct vk_device *device, 106 const VkAllocationCallbacks *pAllocator, 107 struct vk_indirect_command_layout *elayout); 108 109 #endif /* VK_DEVICE_GENERATED_COMMANDS_H */ 110