[Mesa-dev] [PATCH 16/16] anv/cmd_buffer: handle out of device memory during binding table emission

Iago Toral Quiroga itoral at igalia.com
Tue Mar 7 07:16:01 UTC 2017


---
 src/intel/vulkan/genX_cmd_buffer.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/intel/vulkan/genX_cmd_buffer.c b/src/intel/vulkan/genX_cmd_buffer.c
index 8b752c4..23d7493 100644
--- a/src/intel/vulkan/genX_cmd_buffer.c
+++ b/src/intel/vulkan/genX_cmd_buffer.c
@@ -1112,7 +1112,7 @@ emit_binding_table(struct anv_cmd_buffer *cmd_buffer,
    uint32_t *bt_map = bt_state->map;
 
    if (bt_state->map == NULL)
-      return VK_ERROR_OUT_OF_DEVICE_MEMORY;
+      return cmd_buffer->error_status = VK_ERROR_OUT_OF_DEVICE_MEMORY;
 
    if (stage == MESA_SHADER_COMPUTE &&
        get_cs_prog_data(cmd_buffer->state.compute_pipeline)->uses_num_work_groups) {
@@ -1295,7 +1295,7 @@ emit_samplers(struct anv_cmd_buffer *cmd_buffer,
    *state = anv_cmd_buffer_alloc_dynamic_state(cmd_buffer, size, 32);
 
    if (state->map == NULL)
-      return VK_ERROR_OUT_OF_DEVICE_MEMORY;
+      return cmd_buffer->error_status = VK_ERROR_OUT_OF_DEVICE_MEMORY;
 
    for (uint32_t s = 0; s < map->sampler_count; s++) {
       struct anv_pipeline_binding *binding = &map->sampler_to_descriptor[s];
@@ -1345,6 +1345,7 @@ flush_descriptor_sets(struct anv_cmd_buffer *cmd_buffer)
    if (result != VK_SUCCESS) {
       assert(result == VK_ERROR_OUT_OF_DEVICE_MEMORY);
 
+      cmd_buffer->error_status = VK_SUCCESS;
       result = anv_cmd_buffer_new_binding_table_block(cmd_buffer);
       assert(result == VK_SUCCESS);
 
@@ -1817,6 +1818,8 @@ flush_compute_descriptor_set(struct anv_cmd_buffer *cmd_buffer)
    result = emit_binding_table(cmd_buffer, MESA_SHADER_COMPUTE, &surfaces);
    if (result != VK_SUCCESS) {
       assert(result == VK_ERROR_OUT_OF_DEVICE_MEMORY);
+
+      cmd_buffer->error_status = VK_SUCCESS;
       result = anv_cmd_buffer_new_binding_table_block(cmd_buffer);
       assert(result == VK_SUCCESS);
 
-- 
2.7.4



More information about the mesa-dev mailing list