v3dv/descriptor: take into account pPushConstantRanges

Push constant tests were still working without taking this into
account because we can't really fine graine how much we allocate for
them.

For now we only use them to know if we should allocate/fill the ubo
for push constants or not.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
This commit is contained in:
Alejandro Piñeiro
2020-03-04 15:38:55 +01:00
committed by Marge Bot
parent d734dba8a4
commit cb7f148020
3 changed files with 13 additions and 1 deletions
@@ -64,6 +64,15 @@ v3dv_CreatePipelineLayout(VkDevice _device,
}
}
layout->push_constant_size = 0;
for (unsigned i = 0; i < pCreateInfo->pushConstantRangeCount; ++i) {
const VkPushConstantRange *range = pCreateInfo->pPushConstantRanges + i;
layout->push_constant_size =
MAX2(layout->push_constant_size, range->offset + range->size);
}
layout->push_constant_size = align(layout->push_constant_size, 4096);
layout->dynamic_offset_count = dynamic_offset_count;
*pPipelineLayout = v3dv_pipeline_layout_to_handle(layout);
+2
View File
@@ -822,6 +822,8 @@ struct v3dv_pipeline_layout {
uint32_t num_sets;
uint32_t dynamic_offset_count;
uint32_t push_constant_size;
};
struct v3dv_descriptor_map {
+2 -1
View File
@@ -96,7 +96,8 @@ get_descriptor(struct v3dv_descriptor_state *descriptor_state,
static void
check_push_constants_ubo(struct v3dv_cmd_buffer *cmd_buffer)
{
if (!(cmd_buffer->state.dirty & V3DV_CMD_DIRTY_PUSH_CONSTANTS))
if (!(cmd_buffer->state.dirty & V3DV_CMD_DIRTY_PUSH_CONSTANTS) ||
cmd_buffer->state.pipeline->layout->push_constant_size == 0)
return;
if (cmd_buffer->push_constants_descriptor.bo == NULL) {