[Mesa-dev] [PATCH 1/3] radv: add private push descriptors for meta

Fredrik Höglund fredrik at kde.org
Thu Apr 13 22:26:58 UTC 2017


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 <fredrik at kde.org>
---
 src/amd/vulkan/radv_cmd_buffer.c | 33 +++++++++++++++++++++++++++++++++
 src/amd/vulkan/radv_private.h    |  8 ++++++++
 2 files changed, 41 insertions(+)

diff --git a/src/amd/vulkan/radv_cmd_buffer.c b/src/amd/vulkan/radv_cmd_buffer.c
index f03e3dff34..31d04e535d 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 00190e7eee..a64336856f 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,
-- 
2.11.0



More information about the mesa-dev mailing list