vk_free(&cmd_buffer->pool->alloc, cmd_buffer->state.attachments);
vk_free(&cmd_buffer->pool->alloc, cmd_buffer->state.subpass_sample_locs);
- if (!cmd_buffer->device->ws->cs_finalize(cmd_buffer->cs))
- return vk_error(cmd_buffer->device->instance, VK_ERROR_OUT_OF_DEVICE_MEMORY);
+ VkResult result = cmd_buffer->device->ws->cs_finalize(cmd_buffer->cs);
+ if (result != VK_SUCCESS)
+ return vk_error(cmd_buffer->device->instance, result);
cmd_buffer->status = RADV_CMD_BUFFER_STATUS_EXECUTABLE;
unsigned num_old_ib_buffers;
unsigned max_num_old_ib_buffers;
unsigned *ib_size_ptr;
- bool failed;
+ VkResult status;
bool is_chained;
int buffer_hash_table[1024];
{
struct radv_amdgpu_cs *cs = radv_amdgpu_cs(_cs);
- if (cs->failed) {
+ if (cs->status != VK_SUCCESS) {
cs->base.cdw = 0;
return;
}
realloc(cs->old_cs_buffers,
(cs->num_old_cs_buffers + 1) * sizeof(*cs->old_cs_buffers));
if (!cs->old_cs_buffers) {
- cs->failed = true;
+ cs->status = VK_ERROR_OUT_OF_HOST_MEMORY;
cs->base.cdw = 0;
return;
}
if (ib_dws > limit_dws) {
fprintf(stderr, "amdgpu: Too high number of "
"dwords to allocate\n");
- cs->failed = true;
+ cs->status = VK_ERROR_OUT_OF_HOST_MEMORY;
return;
}
}
cs->base.buf = new_buf;
cs->base.max_dw = ib_dws;
} else {
- cs->failed = true;
+ cs->status = VK_ERROR_OUT_OF_HOST_MEMORY;
cs->base.cdw = 0;
}
return;
if (!cs->ib_buffer) {
cs->base.cdw = 0;
- cs->failed = true;
+ cs->status = VK_ERROR_OUT_OF_DEVICE_MEMORY;
cs->ib_buffer = cs->old_ib_buffers[--cs->num_old_ib_buffers];
}
if (!cs->ib_mapped) {
cs->ws->base.buffer_destroy(cs->ib_buffer);
cs->base.cdw = 0;
- cs->failed = true;
+
+ /* VK_ERROR_MEMORY_MAP_FAILED is not valid for vkEndCommandBuffer. */
+ cs->status = VK_ERROR_OUT_OF_DEVICE_MEMORY;
cs->ib_buffer = cs->old_ib_buffers[--cs->num_old_ib_buffers];
}
}
-static bool radv_amdgpu_cs_finalize(struct radeon_cmdbuf *_cs)
+static VkResult radv_amdgpu_cs_finalize(struct radeon_cmdbuf *_cs)
{
struct radv_amdgpu_cs *cs = radv_amdgpu_cs(_cs);
cs->is_chained = false;
}
- return !cs->failed;
+ return cs->status;
}
static void radv_amdgpu_cs_reset(struct radeon_cmdbuf *_cs)
{
struct radv_amdgpu_cs *cs = radv_amdgpu_cs(_cs);
cs->base.cdw = 0;
- cs->failed = false;
+ cs->status = VK_SUCCESS;
for (unsigned i = 0; i < cs->num_buffers; ++i) {
unsigned hash = cs->handles[i].bo_handle &
unsigned hash;
int index = radv_amdgpu_cs_find_buffer(cs, bo);
- if (index != -1 || cs->failed)
+ if (index != -1 || cs->status != VK_SUCCESS)
return;
if (cs->num_buffers == cs->max_num_buffers) {
cs->max_num_buffers = new_count;
cs->handles = new_entries;
} else {
- cs->failed = true;
+ cs->status = VK_ERROR_OUT_OF_HOST_MEMORY;
return;
}
}