mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-06 20:18:12 +02:00
radv: use the "LOW" address space for UBOs
Read-only and no sparse feedback support. Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38698>
This commit is contained in:
parent
3237666fc4
commit
0be39ce4ad
4 changed files with 18 additions and 8 deletions
|
|
@ -592,7 +592,7 @@ radv_update_descriptor_sets_impl(struct radv_device *device, struct radv_cmd_buf
|
|||
}
|
||||
case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER:
|
||||
case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER:
|
||||
radv_write_buffer_descriptor_impl(device, ptr, writeset->pBufferInfo + j);
|
||||
radv_write_buffer_descriptor_impl(device, writeset->descriptorType, ptr, writeset->pBufferInfo + j);
|
||||
break;
|
||||
case VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER:
|
||||
case VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER:
|
||||
|
|
|
|||
|
|
@ -143,7 +143,8 @@ radv_update_descriptor_set_with_template_impl(struct radv_device *device, struct
|
|||
}
|
||||
case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER:
|
||||
case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER:
|
||||
radv_write_buffer_descriptor_impl(device, pDst, (struct VkDescriptorBufferInfo *)pSrc);
|
||||
radv_write_buffer_descriptor_impl(device, templ->entry[i].descriptor_type, pDst,
|
||||
(struct VkDescriptorBufferInfo *)pSrc);
|
||||
break;
|
||||
case VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER:
|
||||
case VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER:
|
||||
|
|
|
|||
|
|
@ -144,7 +144,7 @@ radv_GetDescriptorEXT(VkDevice _device, const VkDescriptorGetInfoEXT *pDescripto
|
|||
? pDescriptorInfo->data.pUniformBuffer
|
||||
: pDescriptorInfo->data.pStorageBuffer;
|
||||
|
||||
radv_write_buffer_descriptor(device, pDescriptor, addr_info ? addr_info->address : 0,
|
||||
radv_write_buffer_descriptor(device, pDescriptorInfo->type, pDescriptor, addr_info ? addr_info->address : 0,
|
||||
addr_info ? addr_info->range : 0);
|
||||
break;
|
||||
}
|
||||
|
|
@ -242,8 +242,8 @@ radv_WriteResourceDescriptorsEXT(VkDevice _device, uint32_t resourceCount,
|
|||
case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER: {
|
||||
const VkDeviceAddressRangeEXT *addr_range = resource->data.pAddressRange;
|
||||
|
||||
radv_write_buffer_descriptor(device, host_addr_range->address, addr_range ? addr_range->address : 0,
|
||||
addr_range ? addr_range->size : 0);
|
||||
radv_write_buffer_descriptor(device, resource->type, host_addr_range->address,
|
||||
addr_range ? addr_range->address : 0, addr_range ? addr_range->size : 0);
|
||||
break;
|
||||
}
|
||||
case VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER:
|
||||
|
|
|
|||
|
|
@ -44,7 +44,8 @@ radv_write_texel_buffer_descriptor(unsigned *dst, const VkBufferView _buffer_vie
|
|||
}
|
||||
|
||||
static ALWAYS_INLINE void
|
||||
radv_write_buffer_descriptor(struct radv_device *device, unsigned *dst, uint64_t va, uint64_t range)
|
||||
radv_write_buffer_descriptor(struct radv_device *device, VkDescriptorType descriptor_type, unsigned *dst, uint64_t va,
|
||||
uint64_t range)
|
||||
{
|
||||
const struct radv_physical_device *pdev = radv_device_physical(device);
|
||||
|
||||
|
|
@ -53,6 +54,13 @@ radv_write_buffer_descriptor(struct radv_device *device, unsigned *dst, uint64_t
|
|||
return;
|
||||
}
|
||||
|
||||
if (pdev->info.compiler_info.has_smem_with_null_prt_bug && descriptor_type == VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER) {
|
||||
/* Always use the "LOW" address space for UBOs because they are read-only and sparse feedback
|
||||
* isn't possible. This avoids clearing the control bit in shaders.
|
||||
*/
|
||||
va &= ~(1ull << pdev->info.address_prt_wa_control_bit);
|
||||
}
|
||||
|
||||
/* robustBufferAccess is relaxed enough to allow this (in combination with the alignment/size
|
||||
* we return from vkGetBufferMemoryRequirements) and this allows the shader compiler to create
|
||||
* more efficient 8/16-bit buffer accesses.
|
||||
|
|
@ -61,7 +69,8 @@ radv_write_buffer_descriptor(struct radv_device *device, unsigned *dst, uint64_t
|
|||
}
|
||||
|
||||
static ALWAYS_INLINE void
|
||||
radv_write_buffer_descriptor_impl(struct radv_device *device, unsigned *dst, const VkDescriptorBufferInfo *buffer_info)
|
||||
radv_write_buffer_descriptor_impl(struct radv_device *device, VkDescriptorType descriptor_type, unsigned *dst,
|
||||
const VkDescriptorBufferInfo *buffer_info)
|
||||
{
|
||||
VK_FROM_HANDLE(radv_buffer, buffer, buffer_info->buffer);
|
||||
uint64_t va = 0, range = 0;
|
||||
|
|
@ -73,7 +82,7 @@ radv_write_buffer_descriptor_impl(struct radv_device *device, unsigned *dst, con
|
|||
assert(buffer->vk.size > 0 && range > 0);
|
||||
}
|
||||
|
||||
radv_write_buffer_descriptor(device, dst, va, range);
|
||||
radv_write_buffer_descriptor(device, descriptor_type, dst, va, range);
|
||||
}
|
||||
|
||||
static ALWAYS_INLINE void
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue