summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2019-02-12 15:29:19 -0600
committerJason Ekstrand <[email protected]>2019-03-05 10:06:50 -0600
commit8ab95b849e66f3221d80a67eef2ec6e3730901a8 (patch)
treefd98b0b7509a9101d6a82883d984358736d6d850 /src
parentcab064bc10c06eb9fe92e4038d39e7c686fd1ba2 (diff)
anv: Refactor descriptor pushing a bit
Pull the common code out of the two entrypoints into the helper which fetches the push descriptor set for us. Now that it does more than just get a thing, call it anv_cmd_buffer_push_descriptor_set. Cc: "19.0" <[email protected]> Reviewed-by: Lionel Landwerlin <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/intel/vulkan/anv_cmd_buffer.c50
1 files changed, 22 insertions, 28 deletions
diff --git a/src/intel/vulkan/anv_cmd_buffer.c b/src/intel/vulkan/anv_cmd_buffer.c
index fc05a2ab5b3..d8107f86996 100644
--- a/src/intel/vulkan/anv_cmd_buffer.c
+++ b/src/intel/vulkan/anv_cmd_buffer.c
@@ -957,10 +957,11 @@ anv_cmd_buffer_get_depth_stencil_view(const struct anv_cmd_buffer *cmd_buffer)
return iview;
}
-static struct anv_push_descriptor_set *
-anv_cmd_buffer_get_push_descriptor_set(struct anv_cmd_buffer *cmd_buffer,
- VkPipelineBindPoint bind_point,
- uint32_t set)
+static struct anv_descriptor_set *
+anv_cmd_buffer_push_descriptor_set(struct anv_cmd_buffer *cmd_buffer,
+ VkPipelineBindPoint bind_point,
+ struct anv_descriptor_set_layout *layout,
+ uint32_t _set)
{
struct anv_cmd_pipeline_state *pipe_state;
if (bind_point == VK_PIPELINE_BIND_POINT_COMPUTE) {
@@ -971,7 +972,7 @@ anv_cmd_buffer_get_push_descriptor_set(struct anv_cmd_buffer *cmd_buffer,
}
struct anv_push_descriptor_set **push_set =
- &pipe_state->push_descriptors[set];
+ &pipe_state->push_descriptors[_set];
if (*push_set == NULL) {
*push_set = vk_alloc(&cmd_buffer->pool->alloc,
@@ -983,7 +984,14 @@ anv_cmd_buffer_get_push_descriptor_set(struct anv_cmd_buffer *cmd_buffer,
}
}
- return *push_set;
+ struct anv_descriptor_set *set = &(*push_set)->set;
+
+ set->layout = layout;
+ set->size = anv_descriptor_set_layout_size(layout);
+ set->buffer_view_count = layout->buffer_view_count;
+ set->buffer_views = (*push_set)->buffer_views;
+
+ return set;
}
void anv_CmdPushDescriptorSetKHR(
@@ -1001,19 +1009,12 @@ void anv_CmdPushDescriptorSetKHR(
struct anv_descriptor_set_layout *set_layout = layout->set[_set].layout;
- struct anv_push_descriptor_set *push_set =
- anv_cmd_buffer_get_push_descriptor_set(cmd_buffer,
- pipelineBindPoint, _set);
- if (!push_set)
+ struct anv_descriptor_set *set =
+ anv_cmd_buffer_push_descriptor_set(cmd_buffer, pipelineBindPoint,
+ set_layout, _set);
+ if (!set)
return;
- struct anv_descriptor_set *set = &push_set->set;
-
- set->layout = set_layout;
- set->size = anv_descriptor_set_layout_size(set_layout);
- set->buffer_view_count = set_layout->buffer_view_count;
- set->buffer_views = push_set->buffer_views;
-
/* Go through the user supplied descriptors. */
for (uint32_t i = 0; i < descriptorWriteCount; i++) {
const VkWriteDescriptorSet *write = &pDescriptorWrites[i];
@@ -1092,19 +1093,12 @@ void anv_CmdPushDescriptorSetWithTemplateKHR(
struct anv_descriptor_set_layout *set_layout = layout->set[_set].layout;
- struct anv_push_descriptor_set *push_set =
- anv_cmd_buffer_get_push_descriptor_set(cmd_buffer,
- template->bind_point, _set);
- if (!push_set)
+ struct anv_descriptor_set *set =
+ anv_cmd_buffer_push_descriptor_set(cmd_buffer, template->bind_point,
+ set_layout, _set);
+ if (!set)
return;
- struct anv_descriptor_set *set = &push_set->set;
-
- set->layout = set_layout;
- set->size = anv_descriptor_set_layout_size(set_layout);
- set->buffer_view_count = set_layout->buffer_view_count;
- set->buffer_views = push_set->buffer_views;
-
anv_descriptor_set_write_template(cmd_buffer->device, set,
&cmd_buffer->surface_state_stream,
template,