mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-02-24 20:20:31 +01:00
zink: cleanup zink_pipeline_layout_create
move the hashing to the caller, since it's not related to this. Additionally, remove dependance on zink_program argument. Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19163>
This commit is contained in:
parent
0f070923e8
commit
a0c6286485
3 changed files with 14 additions and 15 deletions
|
|
@ -457,7 +457,9 @@ zink_descriptor_program_init(struct zink_context *ctx, struct zink_program *pg)
|
|||
}
|
||||
pg->dd.binding_usage = has_bindings;
|
||||
if (!has_bindings && !push_count && !pg->dd.bindless) {
|
||||
pg->layout = zink_pipeline_layout_create(screen, pg, &pg->compat_id);
|
||||
pg->layout = zink_pipeline_layout_create(screen, pg->dsl, pg->num_dsl, pg->is_compute);
|
||||
if (pg->layout)
|
||||
pg->compat_id = _mesa_hash_data(pg->dsl, pg->num_dsl * sizeof(pg->dsl[0]));
|
||||
return !!pg->layout;
|
||||
}
|
||||
|
||||
|
|
@ -521,9 +523,10 @@ zink_descriptor_program_init(struct zink_context *ctx, struct zink_program *pg)
|
|||
pg->dd.binding_usage |= BITFIELD_MASK(ZINK_DESCRIPTOR_BASE_TYPES);
|
||||
}
|
||||
|
||||
pg->layout = zink_pipeline_layout_create(screen, pg, &pg->compat_id);
|
||||
pg->layout = zink_pipeline_layout_create(screen, pg->dsl, pg->num_dsl, pg->is_compute);
|
||||
if (!pg->layout)
|
||||
return false;
|
||||
pg->compat_id = _mesa_hash_data(pg->dsl, pg->num_dsl * sizeof(pg->dsl[0]));
|
||||
|
||||
VkDescriptorUpdateTemplateCreateInfo template[ZINK_DESCRIPTOR_NON_BINDLESS_TYPES] = {0};
|
||||
/* type of template */
|
||||
|
|
|
|||
|
|
@ -784,22 +784,20 @@ zink_update_compute_program(struct zink_context *ctx)
|
|||
}
|
||||
|
||||
VkPipelineLayout
|
||||
zink_pipeline_layout_create(struct zink_screen *screen, struct zink_program *pg, uint32_t *compat)
|
||||
zink_pipeline_layout_create(struct zink_screen *screen, VkDescriptorSetLayout *dsl, unsigned num_dsl, bool is_compute)
|
||||
{
|
||||
VkPipelineLayoutCreateInfo plci = {0};
|
||||
plci.sType = VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO;
|
||||
|
||||
plci.pSetLayouts = pg->dsl;
|
||||
plci.setLayoutCount = pg->num_dsl;
|
||||
plci.pSetLayouts = dsl;
|
||||
plci.setLayoutCount = num_dsl;
|
||||
|
||||
VkPushConstantRange pcr[2] = {0};
|
||||
if (pg->is_compute) {
|
||||
if (((struct zink_compute_program*)pg)->shader->nir->info.stage == MESA_SHADER_KERNEL) {
|
||||
pcr[0].stageFlags = VK_SHADER_STAGE_COMPUTE_BIT;
|
||||
pcr[0].offset = 0;
|
||||
pcr[0].size = sizeof(struct zink_cs_push_constant);
|
||||
plci.pushConstantRangeCount = 1;
|
||||
}
|
||||
if (is_compute) {
|
||||
pcr[0].stageFlags = VK_SHADER_STAGE_COMPUTE_BIT;
|
||||
pcr[0].offset = 0;
|
||||
pcr[0].size = sizeof(struct zink_cs_push_constant);
|
||||
plci.pushConstantRangeCount = 1;
|
||||
} else {
|
||||
pcr[0].stageFlags = VK_SHADER_STAGE_VERTEX_BIT;
|
||||
pcr[0].offset = offsetof(struct zink_gfx_push_constant, draw_mode_is_indexed);
|
||||
|
|
@ -818,8 +816,6 @@ zink_pipeline_layout_create(struct zink_screen *screen, struct zink_program *pg,
|
|||
return VK_NULL_HANDLE;
|
||||
}
|
||||
|
||||
*compat = _mesa_hash_data(pg->dsl, pg->num_dsl * sizeof(pg->dsl[0]));
|
||||
|
||||
return layout;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -221,7 +221,7 @@ zink_program_reference(struct zink_screen *screen,
|
|||
}
|
||||
|
||||
VkPipelineLayout
|
||||
zink_pipeline_layout_create(struct zink_screen *screen, struct zink_program *pg, uint32_t *compat);
|
||||
zink_pipeline_layout_create(struct zink_screen *screen, VkDescriptorSetLayout *dsl, unsigned num_dsl, bool is_compute);
|
||||
|
||||
void
|
||||
zink_program_update_compute_pipeline_state(struct zink_context *ctx, struct zink_compute_program *comp, const uint block[3]);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue