diff options
author | Fredrik Höglund <[email protected]> | 2017-04-14 00:26:58 +0200 |
---|---|---|
committer | Bas Nieuwenhuizen <[email protected]> | 2017-04-14 23:21:24 +0200 |
commit | f95caae504a894d804257674538640a9178dceb2 (patch) | |
tree | 352b66917066ff6fccccbf6692c0aa15beba5dcd | |
parent | 220974b38dfcd557f4a6bc723e4b5d15add39f84 (diff) |
radv: add private push descriptors for meta
This allows meta to use push descriptors without disturbing user
push descriptors.
radv_meta_push_descriptor_set differs from vkCmdPushDescriptorSetKHR
in that partial updates are not supported; all descriptors used in
subsequent draw commands must be pushed at the same time.
Signed-off-by: Fredrik Höglund <[email protected]>
Reviewed-by: Bas Nieuwenhuizen <[email protected]>
-rw-r--r-- | src/amd/vulkan/radv_cmd_buffer.c | 33 | ||||
-rw-r--r-- | src/amd/vulkan/radv_private.h | 8 |
2 files changed, 41 insertions, 0 deletions
diff --git a/src/amd/vulkan/radv_cmd_buffer.c b/src/amd/vulkan/radv_cmd_buffer.c index f03e3dff349..31d04e535dc 100644 --- a/src/amd/vulkan/radv_cmd_buffer.c +++ b/src/amd/vulkan/radv_cmd_buffer.c @@ -1981,6 +1981,39 @@ static bool radv_init_push_descriptor_set(struct radv_cmd_buffer *cmd_buffer, return true; } +void radv_meta_push_descriptor_set( + struct radv_cmd_buffer* cmd_buffer, + VkPipelineBindPoint pipelineBindPoint, + VkPipelineLayout _layout, + uint32_t set, + uint32_t descriptorWriteCount, + const VkWriteDescriptorSet* pDescriptorWrites) +{ + RADV_FROM_HANDLE(radv_pipeline_layout, layout, _layout); + struct radv_descriptor_set *push_set = &cmd_buffer->meta_push_descriptors; + unsigned bo_offset; + + assert(layout->set[set].layout->flags & VK_DESCRIPTOR_SET_LAYOUT_CREATE_PUSH_DESCRIPTOR_BIT_KHR); + + push_set->size = layout->set[set].layout->size; + push_set->layout = layout->set[set].layout; + + if (!radv_cmd_buffer_upload_alloc(cmd_buffer, push_set->size, 32, + &bo_offset, + (void**) &push_set->mapped_ptr)) + return; + + push_set->va = cmd_buffer->device->ws->buffer_get_va(cmd_buffer->upload.upload_bo); + push_set->va += bo_offset; + + radv_update_descriptor_sets(cmd_buffer->device, cmd_buffer, + radv_descriptor_set_to_handle(push_set), + descriptorWriteCount, pDescriptorWrites, 0, NULL); + + cmd_buffer->state.descriptors[set] = push_set; + cmd_buffer->state.descriptors_dirty |= (1 << set); +} + void radv_CmdPushDescriptorSetKHR( VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint, diff --git a/src/amd/vulkan/radv_private.h b/src/amd/vulkan/radv_private.h index 2afc0cbedfc..bff8845bc73 100644 --- a/src/amd/vulkan/radv_private.h +++ b/src/amd/vulkan/radv_private.h @@ -787,6 +787,7 @@ struct radv_cmd_buffer { uint32_t dynamic_buffers[4 * MAX_DYNAMIC_BUFFERS]; VkShaderStageFlags push_constant_stages; struct radv_push_descriptor_set push_descriptors; + struct radv_descriptor_set meta_push_descriptors; struct radv_cmd_buffer_upload upload; @@ -1410,6 +1411,13 @@ radv_update_descriptor_set_with_template(struct radv_device *device, VkDescriptorUpdateTemplateKHR descriptorUpdateTemplate, const void *pData); +void radv_meta_push_descriptor_set(struct radv_cmd_buffer *cmd_buffer, + VkPipelineBindPoint pipelineBindPoint, + VkPipelineLayout _layout, + uint32_t set, + uint32_t descriptorWriteCount, + const VkWriteDescriptorSet *pDescriptorWrites); + void radv_initialise_cmask(struct radv_cmd_buffer *cmd_buffer, struct radv_image *image, uint32_t value); void radv_initialize_dcc(struct radv_cmd_buffer *cmd_buffer, |