Mesa (master): radv/meta: fix restoring a push descriptor set

Fredrik Höglund fredrik at kemper.freedesktop.org
Fri May 5 23:48:13 UTC 2017


Module: Mesa
Branch: master
Commit: 5ff48581119258214801de24a327bdd6a29e0ccc
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=5ff48581119258214801de24a327bdd6a29e0ccc

Author: Fredrik Höglund <fredrik at kde.org>
Date:   Tue May  2 17:09:27 2017 +0200

radv/meta: fix restoring a push descriptor set

radv_bind_descriptor_set cannot be used to bind a push descriptor set
since a push descriptor set does not have a buffer list. However,
there is no need to add the buffers again when restoring a set, so
this fix is also an optimization.

Cc: "17.1" <mesa-stable at lists.freedesktop.org>
Signed-off-by: Fredrik Höglund <fredrik at kde.org>
Reviewed-by: Bas Nieuwenhuizen <bas at basnieuwenhuizen.nl>

---

 src/amd/vulkan/radv_cmd_buffer.c | 2 ++
 src/amd/vulkan/radv_meta.c       | 7 +++++--
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/amd/vulkan/radv_cmd_buffer.c b/src/amd/vulkan/radv_cmd_buffer.c
index edd7122125..d5e559cd4e 100644
--- a/src/amd/vulkan/radv_cmd_buffer.c
+++ b/src/amd/vulkan/radv_cmd_buffer.c
@@ -1965,6 +1965,8 @@ void radv_bind_descriptor_set(struct radv_cmd_buffer *cmd_buffer,
 {
 	struct radeon_winsys *ws = cmd_buffer->device->ws;
 
+	assert(!(set->layout->flags & VK_DESCRIPTOR_SET_LAYOUT_CREATE_PUSH_DESCRIPTOR_BIT_KHR));
+
 	cmd_buffer->state.descriptors[idx] = set;
 	cmd_buffer->state.descriptors_dirty |= (1u << idx);
 	if (!set)
diff --git a/src/amd/vulkan/radv_meta.c b/src/amd/vulkan/radv_meta.c
index aed2607c22..1fa0e53a33 100644
--- a/src/amd/vulkan/radv_meta.c
+++ b/src/amd/vulkan/radv_meta.c
@@ -63,7 +63,8 @@ radv_meta_restore(const struct radv_meta_saved_state *state,
 {
 	cmd_buffer->state.pipeline = state->old_pipeline;
 	if (state->vertex_saved) {
-		radv_bind_descriptor_set(cmd_buffer, state->old_descriptor_set0, 0);
+		cmd_buffer->state.descriptors[0] = state->old_descriptor_set0;
+	        cmd_buffer->state.descriptors_dirty |= (1u << 0);
 		memcpy(cmd_buffer->state.vertex_bindings, state->old_vertex_bindings,
 		       sizeof(state->old_vertex_bindings));
 		cmd_buffer->state.vb_dirty |= (1 << RADV_META_VERTEX_BINDING_COUNT) - 1;
@@ -122,7 +123,9 @@ radv_meta_restore_compute(const struct radv_meta_saved_compute_state *state,
 {
 	radv_CmdBindPipeline(radv_cmd_buffer_to_handle(cmd_buffer), VK_PIPELINE_BIND_POINT_COMPUTE,
 			     radv_pipeline_to_handle(state->old_pipeline));
-	radv_bind_descriptor_set(cmd_buffer, state->old_descriptor_set0, 0);
+
+	cmd_buffer->state.descriptors[0] = state->old_descriptor_set0;
+	cmd_buffer->state.descriptors_dirty |= (1u << 0);
 
 	if (push_constant_size) {
 		memcpy(cmd_buffer->push_constants, state->push_constants, push_constant_size);




More information about the mesa-commit mailing list