From: Caio Marcelo de Oliveira Filho Date: Thu, 22 Aug 2019 18:23:51 +0000 (-0700) Subject: mesa/st: Don't expect prog->nir to already exist X-Git-Url: https://git.libre-soc.org/?p=mesa.git;a=commitdiff_plain;h=1a12b0fe36fa50d8591c998723e25bdfbdea8b9e mesa/st: Don't expect prog->nir to already exist There's no such case, if we load prog->nir from the shader cache, we shouldn't hit this path. Suggested-by: Kenneth Graunke Reviewed-by: Timothy Arceri --- diff --git a/src/mesa/state_tracker/st_glsl_to_nir.cpp b/src/mesa/state_tracker/st_glsl_to_nir.cpp index fead0ccc625..39203435515 100644 --- a/src/mesa/state_tracker/st_glsl_to_nir.cpp +++ b/src/mesa/state_tracker/st_glsl_to_nir.cpp @@ -633,6 +633,8 @@ st_link_nir(struct gl_context *ctx, struct gl_program *prog = shader->Program; _mesa_copy_linked_program_data(shader_program, shader); + assert(!prog->nir); + if (shader_program->data->spirv) { const nir_shader_compiler_options *options = st->ctx->Const.ShaderCompilerOptions[shader->Stage].NirOptions; @@ -640,7 +642,6 @@ st_link_nir(struct gl_context *ctx, prog->Parameters = _mesa_new_parameter_list(); /* Parameters will be filled during NIR linking. */ - /* TODO: Properly handle or dismiss `if (prog->nir)` case. */ prog->nir = _mesa_spirv_to_nir(ctx, shader_program, shader->Stage, options); set_st_program(prog, shader_program, prog->nir); } else { @@ -670,11 +671,9 @@ st_link_nir(struct gl_context *ctx, st->ctx->Const.ShaderCompilerOptions[prog->info.stage].NirOptions; assert(options); - if (!prog->nir) { - prog->nir = glsl_to_nir(st->ctx, shader_program, shader->Stage, options); - set_st_program(prog, shader_program, prog->nir); - st_nir_preprocess(st, prog, shader_program, shader->Stage); - } + prog->nir = glsl_to_nir(st->ctx, shader_program, shader->Stage, options); + set_st_program(prog, shader_program, prog->nir); + st_nir_preprocess(st, prog, shader_program, shader->Stage); } last_stage = i;