diff --git a/src/gallium/drivers/zink/zink_pipeline.c b/src/gallium/drivers/zink/zink_pipeline.c index ece07beaa83..00f874423b7 100644 --- a/src/gallium/drivers/zink/zink_pipeline.c +++ b/src/gallium/drivers/zink/zink_pipeline.c @@ -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; } diff --git a/src/gallium/drivers/zink/zink_program.c b/src/gallium/drivers/zink/zink_program.c index 3c3641a1ed1..34305e143a3 100644 --- a/src/gallium/drivers/zink/zink_program.c +++ b/src/gallium/drivers/zink/zink_program.c @@ -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; diff --git a/src/gallium/drivers/zink/zink_types.h b/src/gallium/drivers/zink/zink_types.h index 718044a657b..79906d9a3da 100644 --- a/src/gallium/drivers/zink/zink_types.h +++ b/src/gallium/drivers/zink/zink_types.h @@ -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;