mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-28 08:10:09 +01:00
radv: use vk_descriptor_type_is_dynamic
No need to open-code this one now that we have a generic helper. Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io> Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32627>
This commit is contained in:
parent
d188856ffd
commit
3b94bd03c2
2 changed files with 6 additions and 15 deletions
|
|
@ -64,8 +64,7 @@ visit_vulkan_resource_index(nir_builder *b, apply_layout_state *state, nir_intri
|
|||
unsigned stride;
|
||||
|
||||
nir_def *set_ptr;
|
||||
if (layout->binding[binding].type == VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC ||
|
||||
layout->binding[binding].type == VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC) {
|
||||
if (vk_descriptor_type_is_dynamic(layout->binding[binding].type)) {
|
||||
unsigned idx = state->layout->set[desc_set].dynamic_offset_start + layout->binding[binding].dynamic_offset_offset;
|
||||
set_ptr = get_scalar_arg(b, 1, state->args->ac.push_constants);
|
||||
offset = state->layout->push_constant_size + idx * 16;
|
||||
|
|
|
|||
|
|
@ -1393,9 +1393,7 @@ radv_update_descriptor_sets_impl(struct radv_device *device, struct radv_cmd_buf
|
|||
size_t copy_size = MIN2(src_binding_layout->size, dst_binding_layout->size);
|
||||
|
||||
for (j = 0; j < copyset->descriptorCount; ++j) {
|
||||
switch (src_binding_layout->type) {
|
||||
case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC:
|
||||
case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC: {
|
||||
if (vk_descriptor_type_is_dynamic(src_binding_layout->type)) {
|
||||
unsigned src_idx = copyset->srcArrayElement + j;
|
||||
unsigned dst_idx = copyset->dstArrayElement + j;
|
||||
struct radv_descriptor_range *src_range, *dst_range;
|
||||
|
|
@ -1405,11 +1403,9 @@ radv_update_descriptor_sets_impl(struct radv_device *device, struct radv_cmd_buf
|
|||
src_range = src_set->header.dynamic_descriptors + src_idx;
|
||||
dst_range = dst_set->header.dynamic_descriptors + dst_idx;
|
||||
*dst_range = *src_range;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
} else
|
||||
memcpy(dst_ptr, src_ptr, copy_size);
|
||||
}
|
||||
|
||||
src_ptr += src_binding_layout->size / 4;
|
||||
dst_ptr += dst_binding_layout->size / 4;
|
||||
|
||||
|
|
@ -1497,14 +1493,11 @@ radv_CreateDescriptorUpdateTemplate(VkDevice _device, const VkDescriptorUpdateTe
|
|||
|
||||
/* dst_offset is an offset into dynamic_descriptors when the descriptor
|
||||
is dynamic, and an offset into mapped_ptr otherwise */
|
||||
switch (entry->descriptorType) {
|
||||
case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC:
|
||||
case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC:
|
||||
if (vk_descriptor_type_is_dynamic(entry->descriptorType)) {
|
||||
assert(pCreateInfo->templateType == VK_DESCRIPTOR_UPDATE_TEMPLATE_TYPE_DESCRIPTOR_SET);
|
||||
dst_offset = binding_layout->dynamic_offset_offset + entry->dstArrayElement;
|
||||
dst_stride = 0; /* Not used */
|
||||
break;
|
||||
default:
|
||||
} else {
|
||||
switch (entry->descriptorType) {
|
||||
case VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER:
|
||||
case VK_DESCRIPTOR_TYPE_SAMPLER:
|
||||
|
|
@ -1524,7 +1517,6 @@ radv_CreateDescriptorUpdateTemplate(VkDevice _device, const VkDescriptorUpdateTe
|
|||
dst_offset += binding_layout->size * entry->dstArrayElement / 4;
|
||||
|
||||
dst_stride = binding_layout->size / 4;
|
||||
break;
|
||||
}
|
||||
|
||||
templ->entry[i] = (struct radv_descriptor_update_template_entry){
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue