anv: allocate sparse descriptor buffers from the correct heap
When allocating a buffer normally, this flag gets to the allocator from the memory requirements, but when sparse bindings are created we were checking for them but never setting them. Fixes sparse descriptor buffers on Xe2. Makes the failure on TRTT more obvious. Fixes:c6a91f1695("anv: add new heap/pool for descriptor buffers") Fixes:692e1ab2c1("anv: get rid of the second dynamic state heap") Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31372>
This commit is contained in:
@@ -176,6 +176,16 @@ VkResult anv_CreateBuffer(
|
||||
fprintf(stderr, "=== %s %s:%d flags:0x%08x\n", __func__, __FILE__,
|
||||
__LINE__, pCreateInfo->flags);
|
||||
|
||||
if ((pCreateInfo->flags & VK_BUFFER_CREATE_SPARSE_BINDING_BIT) &&
|
||||
device->physical->sparse_type == ANV_SPARSE_TYPE_TRTT) {
|
||||
VkBufferUsageFlags2KHR usages = get_buffer_usages(pCreateInfo);
|
||||
if (usages & (VK_BUFFER_USAGE_2_SAMPLER_DESCRIPTOR_BUFFER_BIT_EXT |
|
||||
VK_BUFFER_USAGE_2_RESOURCE_DESCRIPTOR_BUFFER_BIT_EXT)) {
|
||||
return vk_errorf(device, VK_ERROR_UNKNOWN,
|
||||
"Cannot support sparse descriptor buffers with TRTT.");
|
||||
}
|
||||
}
|
||||
|
||||
/* Don't allow creating buffers bigger than our address space. The real
|
||||
* issue here is that we may align up the buffer size and we don't want
|
||||
* doing so to cause roll-over. However, no one has any business
|
||||
@@ -213,6 +223,14 @@ VkResult anv_CreateBuffer(
|
||||
client_address = *((const uint64_t *)opaque_info->opaqueCaptureDescriptorData);
|
||||
}
|
||||
|
||||
/* If this buffer will be used as a descriptor buffer, make sure we
|
||||
* allocate it on the correct heap.
|
||||
*/
|
||||
if (buffer->vk.usage & (VK_BUFFER_USAGE_2_SAMPLER_DESCRIPTOR_BUFFER_BIT_EXT |
|
||||
VK_BUFFER_USAGE_2_RESOURCE_DESCRIPTOR_BUFFER_BIT_EXT)) {
|
||||
alloc_flags |= ANV_BO_ALLOC_DYNAMIC_VISIBLE_POOL;
|
||||
}
|
||||
|
||||
VkResult result = anv_init_sparse_bindings(device, buffer->vk.size,
|
||||
&buffer->sparse_data,
|
||||
alloc_flags, client_address,
|
||||
|
||||
Reference in New Issue
Block a user