}
}
-static void
+static VkResult
radv_sparse_buffer_bind_memory(struct radv_device *device,
const VkSparseBufferMemoryBindInfo *bind)
{
RADV_FROM_HANDLE(radv_buffer, buffer, bind->buffer);
+ VkResult result;
for (uint32_t i = 0; i < bind->bindCount; ++i) {
struct radv_device_memory *mem = NULL;
if (bind->pBinds[i].memory != VK_NULL_HANDLE)
mem = radv_device_memory_from_handle(bind->pBinds[i].memory);
- device->ws->buffer_virtual_bind(buffer->bo,
- bind->pBinds[i].resourceOffset,
- bind->pBinds[i].size,
- mem ? mem->bo : NULL,
- bind->pBinds[i].memoryOffset);
+ result = device->ws->buffer_virtual_bind(buffer->bo,
+ bind->pBinds[i].resourceOffset,
+ bind->pBinds[i].size,
+ mem ? mem->bo : NULL,
+ bind->pBinds[i].memoryOffset);
+ if (result != VK_SUCCESS)
+ return result;
}
+
+ return VK_SUCCESS;
}
-static void
+static VkResult
radv_sparse_image_opaque_bind_memory(struct radv_device *device,
const VkSparseImageOpaqueMemoryBindInfo *bind)
{
RADV_FROM_HANDLE(radv_image, image, bind->image);
+ VkResult result;
for (uint32_t i = 0; i < bind->bindCount; ++i) {
struct radv_device_memory *mem = NULL;
if (bind->pBinds[i].memory != VK_NULL_HANDLE)
mem = radv_device_memory_from_handle(bind->pBinds[i].memory);
- device->ws->buffer_virtual_bind(image->bo,
- bind->pBinds[i].resourceOffset,
- bind->pBinds[i].size,
- mem ? mem->bo : NULL,
- bind->pBinds[i].memoryOffset);
+ result = device->ws->buffer_virtual_bind(image->bo,
+ bind->pBinds[i].resourceOffset,
+ bind->pBinds[i].size,
+ mem ? mem->bo : NULL,
+ bind->pBinds[i].memoryOffset);
+ if (result != VK_SUCCESS)
+ return result;
}
+
+ return VK_SUCCESS;
}
static VkResult
goto fail;
for (uint32_t i = 0; i < submission->buffer_bind_count; ++i) {
- radv_sparse_buffer_bind_memory(queue->device,
- submission->buffer_binds + i);
+ result = radv_sparse_buffer_bind_memory(queue->device,
+ submission->buffer_binds + i);
+ if (result != VK_SUCCESS)
+ goto fail;
}
for (uint32_t i = 0; i < submission->image_opaque_bind_count; ++i) {
- radv_sparse_image_opaque_bind_memory(queue->device,
- submission->image_opaque_binds + i);
+ result = radv_sparse_image_opaque_bind_memory(queue->device,
+ submission->image_opaque_binds + i);
+ if (result != VK_SUCCESS)
+ goto fail;
}
if (!submission->cmd_buffer_count) {
void (*buffer_get_metadata)(struct radeon_winsys_bo *bo,
struct radeon_bo_metadata *md);
- void (*buffer_virtual_bind)(struct radeon_winsys_bo *parent,
- uint64_t offset, uint64_t size,
- struct radeon_winsys_bo *bo, uint64_t bo_offset);
+ VkResult (*buffer_virtual_bind)(struct radeon_winsys_bo *parent,
+ uint64_t offset, uint64_t size,
+ struct radeon_winsys_bo *bo, uint64_t bo_offset);
VkResult (*ctx_create)(struct radeon_winsys *ws,
enum radeon_ctx_priority priority,
struct radeon_winsys_ctx **ctx);
return (a > b) ? 1 : (a < b) ? -1 : 0;
}
-static void
+static VkResult
radv_amdgpu_winsys_rebuild_bo_list(struct radv_amdgpu_winsys_bo *bo)
{
if (bo->bo_capacity < bo->range_count) {
struct radv_amdgpu_winsys_bo **bos =
realloc(bo->bos, new_count * sizeof(struct radv_amdgpu_winsys_bo *));
if (!bos)
- return;
+ return VK_ERROR_OUT_OF_HOST_MEMORY;
bo->bos = bos;
bo->bo_capacity = new_count;
}
bo->bos[final_bo_count++] = bo->bos[i];
bo->bo_count = final_bo_count;
+
+ return VK_SUCCESS;
}
-static void
+static VkResult
radv_amdgpu_winsys_bo_virtual_bind(struct radeon_winsys_bo *_parent,
uint64_t offset, uint64_t size,
struct radeon_winsys_bo *_bo, uint64_t bo_offset)
int range_count_delta, new_idx;
int first = 0, last;
struct radv_amdgpu_map_range new_first, new_last;
+ VkResult result;
assert(parent->is_virtual);
assert(!bo || !bo->is_virtual);
realloc(parent->ranges,
range_capacity * sizeof(struct radv_amdgpu_map_range));
if (!ranges)
- return;
+ return VK_ERROR_OUT_OF_HOST_MEMORY;
parent->ranges = ranges;
parent->range_capacity = range_capacity;
}
parent->range_count += range_count_delta;
- radv_amdgpu_winsys_rebuild_bo_list(parent);
+ result = radv_amdgpu_winsys_rebuild_bo_list(parent);
+ if (result != VK_SUCCESS)
+ return result;
+
+ return VK_SUCCESS;
}
static void radv_amdgpu_winsys_bo_destroy(struct radeon_winsys_bo *_bo)