radv: Dirty all descriptors sets when changing the pipeline.
authorBas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Fri, 2 Jun 2017 22:01:36 +0000 (00:01 +0200)
committerBas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Sat, 3 Jun 2017 20:24:37 +0000 (22:24 +0200)
Sets could have been ignored during previous descriptor set flush
due to the shader not using them and therefore no SGPR being assigned.

Signed-off-by: Bas Nieuwenhuizen <basni@google.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Fixes: ae61ddabe8c "radv: move userdata sgpr ownership to compiler side."
src/amd/vulkan/radv_cmd_buffer.c
src/amd/vulkan/radv_meta.c

index 0f7b754da97198a797f9ec101fc44f89f1d32cb6..6826ec5aa3762f3b6f5f8f2d6d1fd13829ff8692 100644 (file)
@@ -2186,6 +2186,13 @@ radv_emit_compute_pipeline(struct radv_cmd_buffer *cmd_buffer)
        assert(cmd_buffer->cs->cdw <= cdw_max);
 }
 
+static void radv_mark_descriptor_sets_dirty(struct radv_cmd_buffer *cmd_buffer)
+{
+       for (unsigned i = 0; i < MAX_SETS; i++) {
+               if (cmd_buffer->state.descriptors[i])
+                       cmd_buffer->state.descriptors_dirty |= (1u << i);
+       }
+}
 
 void radv_CmdBindPipeline(
        VkCommandBuffer                             commandBuffer,
@@ -2195,10 +2202,7 @@ void radv_CmdBindPipeline(
        RADV_FROM_HANDLE(radv_cmd_buffer, cmd_buffer, commandBuffer);
        RADV_FROM_HANDLE(radv_pipeline, pipeline, _pipeline);
 
-       for (unsigned i = 0; i < MAX_SETS; i++) {
-               if (cmd_buffer->state.descriptors[i])
-                       cmd_buffer->state.descriptors_dirty |= (1u << i);
-       }
+       radv_mark_descriptor_sets_dirty(cmd_buffer);
 
        switch (pipelineBindPoint) {
        case VK_PIPELINE_BIND_POINT_COMPUTE:
@@ -2207,6 +2211,9 @@ void radv_CmdBindPipeline(
                break;
        case VK_PIPELINE_BIND_POINT_GRAPHICS:
                cmd_buffer->state.pipeline = pipeline;
+               if (!pipeline)
+                       break;
+
                cmd_buffer->state.vertex_descriptors_dirty = true;
                cmd_buffer->state.dirty |= RADV_CMD_DIRTY_PIPELINE;
                cmd_buffer->push_constant_stages |= pipeline->active_stages;
@@ -2369,7 +2376,6 @@ void radv_CmdSetStencilReference(
        cmd_buffer->state.dirty |= RADV_CMD_DIRTY_DYNAMIC_STENCIL_REFERENCE;
 }
 
-
 void radv_CmdExecuteCommands(
        VkCommandBuffer                             commandBuffer,
        uint32_t                                    commandBufferCount,
@@ -2414,6 +2420,7 @@ void radv_CmdExecuteCommands(
                primary->state.dirty |= RADV_CMD_DIRTY_DYNAMIC_ALL;
                primary->state.last_primitive_reset_en = -1;
                primary->state.last_primitive_reset_index = 0;
+               radv_mark_descriptor_sets_dirty(primary);
        }
 }
 
index 4f359bd6a9d9436f71fc6e0f3e9446aa1b9568ea..263181a57f2f0b4b922255517ed099808c1227bf 100644 (file)
@@ -50,9 +50,9 @@ void
 radv_meta_restore(const struct radv_meta_saved_state *state,
                  struct radv_cmd_buffer *cmd_buffer)
 {
-       cmd_buffer->state.pipeline = state->old_pipeline;
+       radv_CmdBindPipeline(radv_cmd_buffer_to_handle(cmd_buffer), VK_PIPELINE_BIND_POINT_GRAPHICS,
+                            radv_pipeline_to_handle(state->old_pipeline));
        cmd_buffer->state.descriptors[0] = state->old_descriptor_set0;
-       cmd_buffer->state.descriptors_dirty |= (1u << 0);
        if (state->vertex_saved) {
                memcpy(cmd_buffer->state.vertex_bindings, state->old_vertex_bindings,
                       sizeof(state->old_vertex_bindings));
@@ -114,7 +114,6 @@ radv_meta_restore_compute(const struct radv_meta_saved_compute_state *state,
                             radv_pipeline_to_handle(state->old_pipeline));
 
        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);