diff options
Diffstat (limited to 'src/amd/vulkan/radv_cmd_buffer.c')
-rw-r--r-- | src/amd/vulkan/radv_cmd_buffer.c | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/src/amd/vulkan/radv_cmd_buffer.c b/src/amd/vulkan/radv_cmd_buffer.c index 8d1f5fe48e3..6f5d4441ef6 100644 --- a/src/amd/vulkan/radv_cmd_buffer.c +++ b/src/amd/vulkan/radv_cmd_buffer.c @@ -480,8 +480,13 @@ 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->descriptors[idx] = set; + if (set) + cmd_buffer->state.valid_descriptors |= (1u << idx); + else + cmd_buffer->state.valid_descriptors &= ~(1u << idx); cmd_buffer->state.descriptors_dirty |= (1u << idx); + } static void @@ -491,17 +496,14 @@ radv_save_descriptors(struct radv_cmd_buffer *cmd_buffer) struct radeon_winsys_cs *cs = cmd_buffer->cs; uint32_t data[MAX_SETS * 2] = {}; uint64_t va; - + unsigned i; va = radv_buffer_get_va(device->trace_bo) + 24; MAYBE_UNUSED unsigned cdw_max = radeon_check_space(device->ws, cmd_buffer->cs, 4 + MAX_SETS * 2); - for (int i = 0; i < MAX_SETS; i++) { - struct radv_descriptor_set *set = cmd_buffer->state.descriptors[i]; - if (!set) - continue; - + for_each_bit(i, cmd_buffer->state.valid_descriptors) { + struct radv_descriptor_set *set = cmd_buffer->descriptors[i]; data[i * 2] = (uintptr_t)set; data[i * 2 + 1] = (uintptr_t)set >> 32; } @@ -1660,8 +1662,8 @@ radv_flush_indirect_descriptor_sets(struct radv_cmd_buffer *cmd_buffer) for (unsigned i = 0; i < MAX_SETS; i++) { uint32_t *uptr = ((uint32_t *)ptr) + i * 2; uint64_t set_va = 0; - struct radv_descriptor_set *set = cmd_buffer->state.descriptors[i]; - if (set) + struct radv_descriptor_set *set = cmd_buffer->descriptors[i]; + if (cmd_buffer->state.valid_descriptors & (1u << i)) set_va = set->va; uptr[0] = set_va & 0xffffffff; uptr[1] = set_va >> 32; @@ -1719,8 +1721,8 @@ radv_flush_descriptors(struct radv_cmd_buffer *cmd_buffer, MAX_SETS * MESA_SHADER_STAGES * 4); for_each_bit(i, cmd_buffer->state.descriptors_dirty) { - struct radv_descriptor_set *set = cmd_buffer->state.descriptors[i]; - if (!set) + struct radv_descriptor_set *set = cmd_buffer->descriptors[i]; + if (!(cmd_buffer->state.valid_descriptors & (1u << i))) continue; radv_emit_descriptor_set_userdata(cmd_buffer, stages, set, i); @@ -2571,10 +2573,7 @@ radv_emit_compute_pipeline(struct radv_cmd_buffer *cmd_buffer) 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); - } + cmd_buffer->state.descriptors_dirty |= cmd_buffer->state.valid_descriptors; } void radv_CmdBindPipeline( |