summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2017-12-15 12:33:34 -0800
committerEmil Velikov <[email protected]>2018-01-26 19:53:00 +0000
commitbde35c09dee9c2d95b2d8ad296fcba0f304f80fd (patch)
treebd25143b749b2c7807eed183600167a7e4eed7b7
parent064fbf718094dc04cb8c23c39e406402815d4990 (diff)
anv/cmd_buffer: Refactor ensure_push_descriptor_set
It's now a function which returns the push descriptor set. Since we set the error on the command buffer, returning the error is a little redundant. Returning the descriptor set (or NULL on error) is more convenient. Tested-by: Józef Kucia <[email protected]> Reviewed-by: Topi Pohjolainen <[email protected]> Cc: "18.0" <[email protected]> (cherry picked from commit 90cceaa9dd3b12e039a131a50c6866dce04e7fb2)
-rw-r--r--src/intel/vulkan/anv_cmd_buffer.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/src/intel/vulkan/anv_cmd_buffer.c b/src/intel/vulkan/anv_cmd_buffer.c
index dd505637c3f..e5366fd95c0 100644
--- a/src/intel/vulkan/anv_cmd_buffer.c
+++ b/src/intel/vulkan/anv_cmd_buffer.c
@@ -835,9 +835,9 @@ anv_cmd_buffer_get_depth_stencil_view(const struct anv_cmd_buffer *cmd_buffer)
return iview;
}
-static VkResult
-anv_cmd_buffer_ensure_push_descriptor_set(struct anv_cmd_buffer *cmd_buffer,
- uint32_t set)
+static struct anv_push_descriptor_set *
+anv_cmd_buffer_get_push_descriptor_set(struct anv_cmd_buffer *cmd_buffer,
+ uint32_t set)
{
struct anv_push_descriptor_set **push_set =
&cmd_buffer->state.push_descriptors[set];
@@ -848,11 +848,11 @@ anv_cmd_buffer_ensure_push_descriptor_set(struct anv_cmd_buffer *cmd_buffer,
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
if (*push_set == NULL) {
anv_batch_set_error(&cmd_buffer->batch, VK_ERROR_OUT_OF_HOST_MEMORY);
- return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
+ return NULL;
}
}
- return VK_SUCCESS;
+ return *push_set;
}
void anv_CmdPushDescriptorSetKHR(
@@ -873,10 +873,11 @@ void anv_CmdPushDescriptorSetKHR(
const struct anv_descriptor_set_layout *set_layout =
layout->set[_set].layout;
- if (anv_cmd_buffer_ensure_push_descriptor_set(cmd_buffer, _set) != VK_SUCCESS)
- return;
struct anv_push_descriptor_set *push_set =
- cmd_buffer->state.push_descriptors[_set];
+ anv_cmd_buffer_get_push_descriptor_set(cmd_buffer, _set);
+ if (!push_set)
+ return;
+
struct anv_descriptor_set *set = &push_set->set;
set->layout = set_layout;
@@ -964,10 +965,11 @@ void anv_CmdPushDescriptorSetWithTemplateKHR(
const struct anv_descriptor_set_layout *set_layout =
layout->set[_set].layout;
- if (anv_cmd_buffer_ensure_push_descriptor_set(cmd_buffer, _set) != VK_SUCCESS)
- return;
struct anv_push_descriptor_set *push_set =
- cmd_buffer->state.push_descriptors[_set];
+ anv_cmd_buffer_get_push_descriptor_set(cmd_buffer, _set);
+ if (!push_set)
+ return;
+
struct anv_descriptor_set *set = &push_set->set;
set->layout = set_layout;