radv: add helper for setting a descriptor.
authorDave Airlie <airlied@redhat.com>
Sun, 5 Nov 2017 23:15:52 +0000 (23:15 +0000)
committerDave Airlie <airlied@redhat.com>
Mon, 6 Nov 2017 01:11:00 +0000 (01:11 +0000)
This is just a simple refactor.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
src/amd/vulkan/radv_cmd_buffer.c
src/amd/vulkan/radv_meta.c
src/amd/vulkan/radv_private.h

index d1cfe8ca0681cf82b17351ae59b86a9c0b1b9623..8d1f5fe48e385221a04e9e74bcd086d8089f7956 100644 (file)
@@ -476,6 +476,14 @@ radv_save_pipeline(struct radv_cmd_buffer *cmd_buffer,
        radv_emit_write_data_packet(cs, va, 2, data);
 }
 
+void radv_set_descriptor_set(struct radv_cmd_buffer *cmd_buffer,
+                            struct radv_descriptor_set *set,
+                            unsigned idx)
+{
+       cmd_buffer->state.descriptors[idx] = set;
+       cmd_buffer->state.descriptors_dirty |= (1u << idx);
+}
+
 static void
 radv_save_descriptors(struct radv_cmd_buffer *cmd_buffer)
 {
@@ -2319,8 +2327,7 @@ radv_bind_descriptor_set(struct radv_cmd_buffer *cmd_buffer,
 {
        struct radeon_winsys *ws = cmd_buffer->device->ws;
 
-       cmd_buffer->state.descriptors[idx] = set;
-       cmd_buffer->state.descriptors_dirty |= (1u << idx);
+       radv_set_descriptor_set(cmd_buffer, set, idx);
        if (!set)
                return;
 
@@ -2432,8 +2439,7 @@ void radv_meta_push_descriptor_set(
                                    radv_descriptor_set_to_handle(push_set),
                                    descriptorWriteCount, pDescriptorWrites, 0, NULL);
 
-       cmd_buffer->state.descriptors[set] = push_set;
-       cmd_buffer->state.descriptors_dirty |= (1u << set);
+       radv_set_descriptor_set(cmd_buffer, push_set, set);
 }
 
 void radv_CmdPushDescriptorSetKHR(
@@ -2457,8 +2463,7 @@ void radv_CmdPushDescriptorSetKHR(
                                    radv_descriptor_set_to_handle(push_set),
                                    descriptorWriteCount, pDescriptorWrites, 0, NULL);
 
-       cmd_buffer->state.descriptors[set] = push_set;
-       cmd_buffer->state.descriptors_dirty |= (1u << set);
+       radv_set_descriptor_set(cmd_buffer, push_set, set);
        cmd_buffer->state.push_descriptors_dirty = true;
 }
 
@@ -2481,8 +2486,7 @@ void radv_CmdPushDescriptorSetWithTemplateKHR(
        radv_update_descriptor_set_with_template(cmd_buffer->device, cmd_buffer, push_set,
                                                 descriptorUpdateTemplate, pData);
 
-       cmd_buffer->state.descriptors[set] = push_set;
-       cmd_buffer->state.descriptors_dirty |= (1u << set);
+       radv_set_descriptor_set(cmd_buffer, push_set, set);
        cmd_buffer->state.push_descriptors_dirty = true;
 }
 
index 3f57618ad285165ab003f65f2a54d353b202fc78..80c5eb28cbe6cff6a36a66f0b7296d2120b9ae0f 100644 (file)
@@ -124,8 +124,7 @@ radv_meta_restore(const struct radv_meta_saved_state *state,
        }
 
        if (state->flags & RADV_META_SAVE_DESCRIPTORS) {
-               cmd_buffer->state.descriptors[0] = state->old_descriptor_set0;
-               cmd_buffer->state.descriptors_dirty |= (1 << 0);
+               radv_set_descriptor_set(cmd_buffer, state->old_descriptor_set0, 0);
        }
 
        if (state->flags & RADV_META_SAVE_CONSTANTS) {
index d236588621a125fc72b9589b0584b3e3f87e29dc..8fb3496271362f871804872c1712d51fef783bce 100644 (file)
@@ -1552,6 +1552,10 @@ VkResult radv_alloc_sem_info(struct radv_winsys_sem_info *sem_info,
                             const VkSemaphore *signal_sems);
 void radv_free_sem_info(struct radv_winsys_sem_info *sem_info);
 
+void radv_set_descriptor_set(struct radv_cmd_buffer *cmd_buffer,
+                            struct radv_descriptor_set *set,
+                            unsigned idx);
+
 void
 radv_update_descriptor_sets(struct radv_device *device,
                             struct radv_cmd_buffer *cmd_buffer,