zink: assert that pstage is within range

This makes it clearer that these don't include the compute-stage.

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9898>
This commit is contained in:
Erik Faye-Lund 2021-03-29 15:24:31 +02:00 committed by Marge Bot
parent 2de07d1ad2
commit c0609b1585
2 changed files with 3 additions and 1 deletions

View File

@ -856,6 +856,7 @@ zink_shader_free(struct zink_context *ctx, struct zink_shader *shader)
} else {
struct zink_gfx_program *prog = (void*)entry->key;
enum pipe_shader_type pstage = pipe_shader_type_from_mesa(shader->nir->info.stage);
assert(pstage < ZINK_SHADER_COUNT);
bool in_use = prog == ctx->curr_program;
if (shader->nir->info.stage != MESA_SHADER_TESS_CTRL || !shader->is_generated)
_mesa_hash_table_remove_key(ctx->program_cache, prog->shaders);

View File

@ -374,6 +374,7 @@ update_shader_modules(struct zink_context *ctx, struct zink_shader *stages[ZINK_
for (int i = 0; i < ZINK_SHADER_COUNT; ++i) {
enum pipe_shader_type type = pipe_shader_type_from_mesa(i);
assert(type < ZINK_SHADER_COUNT);
if (dirty[i]) {
struct zink_shader_module *zm;
zm = get_shader_module_for_stage(ctx, dirty[i], prog);
@ -790,7 +791,7 @@ static void
gfx_program_remove_shader(struct zink_gfx_program *prog, struct zink_shader *shader)
{
enum pipe_shader_type p_stage = pipe_shader_type_from_mesa(shader->nir->info.stage);
assert(p_stage < ZINK_SHADER_COUNT);
assert(prog->shaders[p_stage] == shader);
prog->shaders[p_stage] = NULL;
_mesa_set_remove_key(shader->programs, prog);