zink: move to AoS for gfx program shader modules

this matches up better with the actual usage; the zink_shader_module
is still stored in the shader cache

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18786>
This commit is contained in:
Mike Blumenkrantz
2022-09-01 13:45:53 -04:00
committed by Marge Bot
parent 745efa1231
commit 32f50630d6
3 changed files with 13 additions and 10 deletions
+2 -2
View File
@@ -358,7 +358,7 @@ zink_create_gfx_pipeline(struct zink_screen *screen,
VkPipelineShaderStageCreateInfo stage = {0};
stage.sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO;
stage.stage = mesa_to_vk_shader_stage(i);
stage.module = prog->modules[i]->shader;
stage.module = prog->modules[i];
stage.pName = "main";
shader_stages[num_stages++] = stage;
}
@@ -761,7 +761,7 @@ zink_create_gfx_pipeline_library(struct zink_screen *screen, struct zink_gfx_pro
VkPipelineShaderStageCreateInfo stage = {0};
stage.sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO;
stage.stage = mesa_to_vk_shader_stage(i);
stage.module = prog->modules[i]->shader;
stage.module = prog->modules[i];
stage.pName = "main";
shader_stages[num_stages++] = stage;
}
+9 -7
View File
@@ -252,19 +252,20 @@ update_gfx_shader_modules(struct zink_context *ctx,
zm = create_shader_module_for_stage(ctx, screen, prog->shaders[i], prog, i, state,
inline_size, nonseamless_size, has_inline, has_nonseamless);
state->modules[i] = zm->shader;
if (prog->modules[i] == zm)
if (prog->modules[i] == zm->shader)
continue;
variant_hash ^= prog->modules[i]->hash;
variant_hash ^= prog->module_hash[i];
hash_changed = true;
default_variants &= zm->default_variant;
prog->modules[i] = zm;
prog->modules[i] = zm->shader;
prog->module_hash[i] = zm->hash;
if (has_inline) {
if (zm->num_uniforms)
prog->inline_variants |= BITFIELD_BIT(i);
else
prog->inline_variants &= ~BITFIELD_BIT(i);
}
variant_hash ^= prog->modules[i]->hash;
variant_hash ^= prog->module_hash[i];
}
if (hash_changed && state) {
@@ -297,11 +298,12 @@ generate_gfx_program_modules(struct zink_context *ctx, struct zink_screen *scree
inline_size, nonseamless_size,
screen->driconf.inline_uniforms, screen->info.have_EXT_non_seamless_cube_map);
state->modules[i] = zm->shader;
prog->modules[i] = zm;
prog->modules[i] = zm->shader;
prog->module_hash[i] = zm->hash;
if (zm->num_uniforms)
prog->inline_variants |= BITFIELD_BIT(i);
default_variants &= zm->default_variant;
variant_hash ^= prog->modules[i]->hash;
variant_hash ^= prog->module_hash[i];
}
prog->last_variant_hash = variant_hash;
@@ -424,7 +426,7 @@ zink_gfx_program_update(struct zink_context *ctx)
prog = (struct zink_gfx_program*)entry->data;
for (unsigned i = 0; i < ZINK_GFX_SHADER_COUNT; i++) {
if (prog->stages_present & ~ctx->dirty_shader_stages & BITFIELD_BIT(i))
ctx->gfx_pipeline_state.modules[i] = prog->modules[i]->shader;
ctx->gfx_pipeline_state.modules[i] = prog->modules[i];
}
/* ensure variants are always updated if keys have changed since last use */
ctx->dirty_shader_stages |= prog->stages_present;
+2 -1
View File
@@ -804,7 +804,8 @@ struct zink_gfx_program {
uint32_t stages_remaining; //mask of zink_shader remaining in this program
struct nir_shader *nir[ZINK_GFX_SHADER_COUNT];
struct zink_shader_module *modules[ZINK_GFX_SHADER_COUNT]; // compute stage doesn't belong here
VkShaderModule modules[ZINK_GFX_SHADER_COUNT]; // compute stage doesn't belong here
uint32_t module_hash[ZINK_GFX_SHADER_COUNT];
struct zink_shader *last_vertex_stage;