anv: handle allocation failure in anv_batch_emit_batch()
authorIago Toral Quiroga <itoral@igalia.com>
Fri, 3 Mar 2017 10:17:03 +0000 (11:17 +0100)
committerIago Toral Quiroga <itoral@igalia.com>
Thu, 16 Mar 2017 10:40:05 +0000 (11:40 +0100)
v2:
 - Call the error handler (Topi)

Fixes:
dEQP-VK.api.out_of_host_memory.cmd_execute_commands

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
src/intel/vulkan/anv_batch_chain.c

index 3f6039e816bc1e31421c9ad66bfb26f7fd62f126..40fc2f4f899ac12802a15fd21b18c843b9c701db 100644 (file)
@@ -222,8 +222,13 @@ anv_batch_emit_batch(struct anv_batch *batch, struct anv_batch *other)
    size = other->next - other->start;
    assert(size % 4 == 0);
 
-   if (batch->next + size > batch->end)
-      batch->extend_cb(batch, batch->user_data);
+   if (batch->next + size > batch->end) {
+      VkResult result = batch->extend_cb(batch, batch->user_data);
+      if (result != VK_SUCCESS) {
+         anv_batch_set_error(batch, result);
+         return;
+      }
+   }
 
    assert(batch->next + size <= batch->end);