[Mesa-dev] [PATCH 1/2] radv: rename record_fail to record_result and use VkResult

Samuel Pitoiset samuel.pitoiset at gmail.com
Fri Aug 25 14:10:30 UTC 2017


This will allow to propagate VK_ERROR_OUT_OF_HOST_MEMORY to
vkEndCommandBuffer() when necessary.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
---
 src/amd/vulkan/radv_cmd_buffer.c | 16 ++++++++--------
 src/amd/vulkan/radv_private.h    |  2 +-
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/src/amd/vulkan/radv_cmd_buffer.c b/src/amd/vulkan/radv_cmd_buffer.c
index fe8f3f2cb8..21e2dfd9f7 100644
--- a/src/amd/vulkan/radv_cmd_buffer.c
+++ b/src/amd/vulkan/radv_cmd_buffer.c
@@ -231,7 +231,7 @@ static void  radv_reset_cmd_buffer(struct radv_cmd_buffer *cmd_buffer)
 						      cmd_buffer->upload.upload_bo, 8);
 	cmd_buffer->upload.offset = 0;
 
-	cmd_buffer->record_fail = false;
+	cmd_buffer->record_result = VK_SUCCESS;
 
 	cmd_buffer->ring_offsets_idx = -1;
 
@@ -262,7 +262,7 @@ radv_cmd_buffer_resize_upload_buf(struct radv_cmd_buffer *cmd_buffer,
 				       RADEON_FLAG_CPU_ACCESS);
 
 	if (!bo) {
-		cmd_buffer->record_fail = true;
+		cmd_buffer->record_result = VK_ERROR_OUT_OF_DEVICE_MEMORY;
 		return false;
 	}
 
@@ -271,7 +271,7 @@ radv_cmd_buffer_resize_upload_buf(struct radv_cmd_buffer *cmd_buffer,
 		upload = malloc(sizeof(*upload));
 
 		if (!upload) {
-			cmd_buffer->record_fail = true;
+			cmd_buffer->record_result = VK_ERROR_OUT_OF_DEVICE_MEMORY;
 			device->ws->buffer_destroy(bo);
 			return false;
 		}
@@ -286,7 +286,7 @@ radv_cmd_buffer_resize_upload_buf(struct radv_cmd_buffer *cmd_buffer,
 	cmd_buffer->upload.map = device->ws->buffer_map(cmd_buffer->upload.upload_bo);
 
 	if (!cmd_buffer->upload.map) {
-		cmd_buffer->record_fail = true;
+		cmd_buffer->record_result = VK_ERROR_OUT_OF_DEVICE_MEMORY;
 		return false;
 	}
 
@@ -2136,7 +2136,7 @@ static bool radv_init_push_descriptor_set(struct radv_cmd_buffer *cmd_buffer,
 
 		if (!set->mapped_ptr) {
 			cmd_buffer->push_descriptors.capacity = 0;
-			cmd_buffer->record_fail = true;
+			cmd_buffer->record_result = VK_ERROR_OUT_OF_DEVICE_MEMORY;
 			return false;
 		}
 
@@ -2252,10 +2252,10 @@ VkResult radv_EndCommandBuffer(
 		si_emit_cache_flush(cmd_buffer);
 	}
 
-	if (!cmd_buffer->device->ws->cs_finalize(cmd_buffer->cs) ||
-	    cmd_buffer->record_fail)
+	if (!cmd_buffer->device->ws->cs_finalize(cmd_buffer->cs))
 		return VK_ERROR_OUT_OF_DEVICE_MEMORY;
-	return VK_SUCCESS;
+
+	return cmd_buffer->record_result;
 }
 
 static void
diff --git a/src/amd/vulkan/radv_private.h b/src/amd/vulkan/radv_private.h
index 0e297f5b6e..cf5c853278 100644
--- a/src/amd/vulkan/radv_private.h
+++ b/src/amd/vulkan/radv_private.h
@@ -833,7 +833,7 @@ struct radv_cmd_buffer {
 	bool tess_rings_needed;
 	bool sample_positions_needed;
 
-	bool record_fail;
+	VkResult record_result;
 
 	int ring_offsets_idx; /* just used for verification */
 	uint32_t gfx9_fence_offset;
-- 
2.14.1



More information about the mesa-dev mailing list