mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-04-21 14:10:37 +02:00
venus: scrub ignored fields for descriptor writes for push descriptor
Fixes: 933ca11f1a ("venus: implement vkCmdPushDescriptorSetWithTemplateKHR")
Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Corentin Noël <corentin.noel@collabora.com>
Reviewed-by: Dawn Han <dawnhan@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20191>
This commit is contained in:
parent
e1ab7629f8
commit
34b28cfb7d
3 changed files with 33 additions and 8 deletions
|
|
@ -2052,8 +2052,21 @@ vn_CmdPushDescriptorSetKHR(VkCommandBuffer commandBuffer,
|
|||
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
|
||||
|
|
|
|||
|
|
@ -799,10 +799,11 @@ vn_update_descriptor_sets_alloc(uint32_t write_count,
|
|||
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++) {
|
||||
|
|
@ -834,11 +835,15 @@ vn_update_descriptor_sets_parse_writes(uint32_t write_count,
|
|||
*/
|
||||
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];
|
||||
|
||||
|
|
@ -912,8 +917,8 @@ vn_UpdateDescriptorSets(VkDevice device,
|
|||
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");
|
||||
|
|
|
|||
|
|
@ -135,6 +135,13 @@ VK_DEFINE_NONDISP_HANDLE_CASTS(vn_descriptor_update_template,
|
|||
VkDescriptorUpdateTemplate,
|
||||
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,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue