anv: handle allocation failure in anv_batch_emit_dwords()
authorIago Toral Quiroga <itoral@igalia.com>
Fri, 3 Mar 2017 09:56:33 +0000 (10:56 +0100)
committerIago Toral Quiroga <itoral@igalia.com>
Thu, 16 Mar 2017 10:40:05 +0000 (11:40 +0100)
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
src/intel/vulkan/anv_batch_chain.c

index 40fc2f4f899ac12802a15fd21b18c843b9c701db..c304d6dc6a50731e112a1c0342d404a349c17876 100644 (file)
@@ -195,8 +195,13 @@ anv_reloc_list_append(struct anv_reloc_list *list,
 void *
 anv_batch_emit_dwords(struct anv_batch *batch, int num_dwords)
 {
-   if (batch->next + num_dwords * 4 > batch->end)
-      batch->extend_cb(batch, batch->user_data);
+   if (batch->next + num_dwords * 4 > batch->end) {
+      VkResult result = batch->extend_cb(batch, batch->user_data);
+      if (result != VK_SUCCESS) {
+         anv_batch_set_error(batch, result);
+         return NULL;
+      }
+   }
 
    void *p = batch->next;