uint32_t descriptorWriteCount,
const VkWriteDescriptorSet *pDescriptorWrites)
{
+ struct vn_command_buffer *cmd =
+ vn_command_buffer_from_handle(commandBuffer);
+ struct vn_update_descriptor_sets *update =
+ vn_update_descriptor_sets_parse_writes(
+ descriptorWriteCount, pDescriptorWrites, &cmd->allocator, layout);
+ if (!update) {
+ cmd->state = VN_COMMAND_BUFFER_STATE_INVALID;
+ vn_log(cmd->device->instance, "descriptor set push ignored due to OOM");
+ return;
+ }
+
VN_CMD_ENQUEUE(vkCmdPushDescriptorSetKHR, commandBuffer, pipelineBindPoint,
- layout, set, descriptorWriteCount, pDescriptorWrites);
+ layout, set, update->write_count, update->writes);
+
+ vk_free(&cmd->allocator, update);
}
void
return update;
}
-static struct vn_update_descriptor_sets *
+struct vn_update_descriptor_sets *
vn_update_descriptor_sets_parse_writes(uint32_t write_count,
const VkWriteDescriptorSet *writes,
- const VkAllocationCallbacks *alloc)
+ const VkAllocationCallbacks *alloc,
+ VkPipelineLayout pipeline_layout_handle)
{
uint32_t img_count = 0;
for (uint32_t i = 0; i < write_count; i++) {
*/
memcpy(update->writes, writes, sizeof(*writes) * write_count);
img_count = 0;
+ const struct vn_pipeline_layout *pipeline_layout =
+ vn_pipeline_layout_from_handle(pipeline_layout_handle);
for (uint32_t i = 0; i < write_count; i++) {
- const struct vn_descriptor_set *set =
- vn_descriptor_set_from_handle(writes[i].dstSet);
+ const struct vn_descriptor_set_layout *set_layout =
+ pipeline_layout
+ ? pipeline_layout->push_descriptor_set_layout
+ : vn_descriptor_set_from_handle(writes[i].dstSet)->layout;
const struct vn_descriptor_set_layout_binding *binding =
- &set->layout->bindings[writes[i].dstBinding];
+ &set_layout->bindings[writes[i].dstBinding];
VkWriteDescriptorSet *write = &update->writes[i];
VkDescriptorImageInfo *imgs = &update->images[img_count];
const VkAllocationCallbacks *alloc = &dev->base.base.alloc;
struct vn_update_descriptor_sets *update =
- vn_update_descriptor_sets_parse_writes(descriptorWriteCount,
- pDescriptorWrites, alloc);
+ vn_update_descriptor_sets_parse_writes(
+ descriptorWriteCount, pDescriptorWrites, alloc, VK_NULL_HANDLE);
if (!update) {
/* TODO update one-by-one? */
vn_log(dev->instance, "TODO descriptor set update ignored due to OOM");
VK_OBJECT_TYPE_DESCRIPTOR_UPDATE_TEMPLATE)
struct vn_update_descriptor_sets *
+vn_update_descriptor_sets_parse_writes(
+ uint32_t write_count,
+ const VkWriteDescriptorSet *writes,
+ const VkAllocationCallbacks *alloc,
+ VkPipelineLayout pipeline_layout_handle);
+
+struct vn_update_descriptor_sets *
vn_update_descriptor_set_with_template_locked(
struct vn_descriptor_update_template *templ,
struct vn_descriptor_set *set,