kronos_compute/implementation/
descriptor.rs1use crate::sys::*;
4use crate::core::*;
5use crate::ffi::*;
6use crate::implementation::icd_loader;
7
8#[no_mangle]
17pub unsafe extern "C" fn vkCreateDescriptorSetLayout(
18 device: VkDevice,
19 pCreateInfo: *const VkDescriptorSetLayoutCreateInfo,
20 pAllocator: *const VkAllocationCallbacks,
21 pSetLayout: *mut VkDescriptorSetLayout,
22) -> VkResult {
23 if device.is_null() || pCreateInfo.is_null() || pSetLayout.is_null() {
24 return VkResult::ErrorInitializationFailed;
25 }
26
27 if let Some(icd) = icd_loader::icd_for_device(device) {
28 if let Some(f) = icd.create_descriptor_set_layout { return f(device, pCreateInfo, pAllocator, pSetLayout); }
29 }
30 if let Some(icd) = super::forward::get_icd_if_enabled() {
31 if let Some(create_descriptor_set_layout) = icd.create_descriptor_set_layout { return create_descriptor_set_layout(device, pCreateInfo, pAllocator, pSetLayout); }
32 }
33 VkResult::ErrorInitializationFailed
34}
35
36#[no_mangle]
44pub unsafe extern "C" fn vkDestroyDescriptorSetLayout(
45 device: VkDevice,
46 descriptorSetLayout: VkDescriptorSetLayout,
47 pAllocator: *const VkAllocationCallbacks,
48) {
49 if device.is_null() || descriptorSetLayout.is_null() {
50 return;
51 }
52
53 if let Some(icd) = icd_loader::icd_for_device(device) {
54 if let Some(f) = icd.destroy_descriptor_set_layout { f(device, descriptorSetLayout, pAllocator); }
55 return;
56 }
57 if let Some(icd) = super::forward::get_icd_if_enabled() {
58 if let Some(destroy_descriptor_set_layout) = icd.destroy_descriptor_set_layout { destroy_descriptor_set_layout(device, descriptorSetLayout, pAllocator); }
59 }
60}
61
62#[no_mangle]
71pub unsafe extern "C" fn vkCreateDescriptorPool(
72 device: VkDevice,
73 pCreateInfo: *const VkDescriptorPoolCreateInfo,
74 pAllocator: *const VkAllocationCallbacks,
75 pDescriptorPool: *mut VkDescriptorPool,
76) -> VkResult {
77 if device.is_null() || pCreateInfo.is_null() || pDescriptorPool.is_null() {
78 return VkResult::ErrorInitializationFailed;
79 }
80
81 if let Some(icd) = icd_loader::icd_for_device(device) {
82 if let Some(f) = icd.create_descriptor_pool { return f(device, pCreateInfo, pAllocator, pDescriptorPool); }
83 }
84 if let Some(icd) = super::forward::get_icd_if_enabled() {
85 if let Some(create_descriptor_pool) = icd.create_descriptor_pool { return create_descriptor_pool(device, pCreateInfo, pAllocator, pDescriptorPool); }
86 }
87 VkResult::ErrorInitializationFailed
88}
89
90#[no_mangle]
98pub unsafe extern "C" fn vkDestroyDescriptorPool(
99 device: VkDevice,
100 descriptorPool: VkDescriptorPool,
101 pAllocator: *const VkAllocationCallbacks,
102) {
103 if device.is_null() || descriptorPool.is_null() {
104 return;
105 }
106
107 if let Some(icd) = icd_loader::icd_for_device(device) {
108 if let Some(f) = icd.destroy_descriptor_pool { f(device, descriptorPool, pAllocator); }
109 return;
110 }
111 if let Some(icd) = super::forward::get_icd_if_enabled() {
112 if let Some(destroy_descriptor_pool) = icd.destroy_descriptor_pool { destroy_descriptor_pool(device, descriptorPool, pAllocator); }
113 }
114}
115
116#[no_mangle]
124pub unsafe extern "C" fn vkResetDescriptorPool(
125 device: VkDevice,
126 descriptorPool: VkDescriptorPool,
127 flags: VkDescriptorPoolResetFlags,
128) -> VkResult {
129 if device.is_null() || descriptorPool.is_null() {
130 return VkResult::ErrorInitializationFailed;
131 }
132
133 if let Some(icd) = icd_loader::icd_for_device(device) {
134 if let Some(f) = icd.reset_descriptor_pool { return f(device, descriptorPool, flags); }
135 }
136 if let Some(icd) = super::forward::get_icd_if_enabled() {
137 if let Some(reset_descriptor_pool) = icd.reset_descriptor_pool { return reset_descriptor_pool(device, descriptorPool, flags); }
138 }
139 VkResult::ErrorInitializationFailed
140}
141
142#[no_mangle]
151pub unsafe extern "C" fn vkAllocateDescriptorSets(
152 device: VkDevice,
153 pAllocateInfo: *const VkDescriptorSetAllocateInfo,
154 pDescriptorSets: *mut VkDescriptorSet,
155) -> VkResult {
156 if device.is_null() || pAllocateInfo.is_null() || pDescriptorSets.is_null() {
157 return VkResult::ErrorInitializationFailed;
158 }
159
160 if let Some(icd) = icd_loader::icd_for_device(device) {
161 if let Some(f) = icd.allocate_descriptor_sets { return f(device, pAllocateInfo, pDescriptorSets); }
162 }
163 if let Some(icd) = super::forward::get_icd_if_enabled() {
164 if let Some(allocate_descriptor_sets) = icd.allocate_descriptor_sets { return allocate_descriptor_sets(device, pAllocateInfo, pDescriptorSets); }
165 }
166 VkResult::ErrorInitializationFailed
167}
168
169#[no_mangle]
179pub unsafe extern "C" fn vkFreeDescriptorSets(
180 device: VkDevice,
181 descriptorPool: VkDescriptorPool,
182 descriptorSetCount: u32,
183 pDescriptorSets: *const VkDescriptorSet,
184) -> VkResult {
185 if device.is_null() || descriptorPool.is_null() || pDescriptorSets.is_null() || descriptorSetCount == 0 {
186 return VkResult::ErrorInitializationFailed;
187 }
188
189 if let Some(icd) = icd_loader::icd_for_device(device) {
190 if let Some(f) = icd.free_descriptor_sets { return f(device, descriptorPool, descriptorSetCount, pDescriptorSets); }
191 }
192 if let Some(icd) = super::forward::get_icd_if_enabled() {
193 if let Some(free_descriptor_sets) = icd.free_descriptor_sets { return free_descriptor_sets(device, descriptorPool, descriptorSetCount, pDescriptorSets); }
194 }
195 VkResult::ErrorInitializationFailed
196}
197
198#[no_mangle]
208pub unsafe extern "C" fn vkUpdateDescriptorSets(
209 device: VkDevice,
210 descriptorWriteCount: u32,
211 pDescriptorWrites: *const VkWriteDescriptorSet,
212 descriptorCopyCount: u32,
213 pDescriptorCopies: *const VkCopyDescriptorSet,
214) {
215 if device.is_null() {
216 return;
217 }
218
219 if let Some(icd) = icd_loader::icd_for_device(device) {
220 if let Some(f) = icd.update_descriptor_sets { f(device, descriptorWriteCount, pDescriptorWrites, descriptorCopyCount, pDescriptorCopies); }
221 return;
222 }
223 if let Some(icd) = super::forward::get_icd_if_enabled() {
224 if let Some(update_descriptor_sets) = icd.update_descriptor_sets {
225 update_descriptor_sets(device, descriptorWriteCount, pDescriptorWrites, descriptorCopyCount, pDescriptorCopies);
226 }
227 }
228}