diff options
author | Jordan Justen <jordan.l.justen@intel.com> | 2023-10-11 12:56:45 -0700 |
---|---|---|
committer | Jordan Justen <jordan.l.justen@intel.com> | 2023-10-12 14:15:18 -0700 |
commit | e58f8d2b62bc80519f46250d5889603d49584a5d (patch) | |
tree | 85f84971c9f0af768e89ac97d28a41b3d147e545 | |
parent | 63d2836e474dafc581ffc4f572aa2327471d2e33 (diff) |
anv/batch: Assert that extend_cb is non-NULL if the batch is out of spaceanv-simple-batch-out-of-space
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
-rw-r--r-- | src/intel/vulkan/anv_batch_chain.c | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/src/intel/vulkan/anv_batch_chain.c b/src/intel/vulkan/anv_batch_chain.c index fef06a78f0b..26597c06426 100644 --- a/src/intel/vulkan/anv_batch_chain.c +++ b/src/intel/vulkan/anv_batch_chain.c @@ -151,16 +151,23 @@ anv_reloc_list_append(struct anv_reloc_list *list, * Functions related to anv_batch *-----------------------------------------------------------------------*/ +static VkResult +anv_extend_batch(struct anv_batch *batch, uint32_t size) +{ + assert(batch->extend_cb != NULL); + VkResult result = batch->extend_cb(batch, size, batch->user_data); + if (result != VK_SUCCESS) + return anv_batch_set_error(batch, result); + return result; +} + void * anv_batch_emit_dwords(struct anv_batch *batch, int num_dwords) { uint32_t size = num_dwords * 4; if (batch->next + size > batch->end) { - VkResult result = batch->extend_cb(batch, size, batch->user_data); - if (result != VK_SUCCESS) { - anv_batch_set_error(batch, result); + if (anv_extend_batch(batch, size) != VK_SUCCESS) return NULL; - } } void *p = batch->next; @@ -176,11 +183,9 @@ VkResult anv_batch_emit_ensure_space(struct anv_batch *batch, uint32_t size) { if (batch->next + size > batch->end) { - VkResult result = batch->extend_cb(batch, size, batch->user_data); - if (result != VK_SUCCESS) { - anv_batch_set_error(batch, result); + VkResult result = anv_extend_batch(batch, size); + if (result != VK_SUCCESS) return result; - } } assert(batch->next + size <= batch->end); @@ -214,11 +219,8 @@ anv_batch_emit_batch(struct anv_batch *batch, struct anv_batch *other) assert(size % 4 == 0); if (batch->next + size > batch->end) { - VkResult result = batch->extend_cb(batch, size, batch->user_data); - if (result != VK_SUCCESS) { - anv_batch_set_error(batch, result); + if (anv_extend_batch(batch, size) != VK_SUCCESS) return; - } } assert(batch->next + size <= batch->end); |