if (!prog)
return false;
- _mesa_reference_program(ctx, &shader->Program, prog);
+ /* Don't use _mesa_reference_program() just take ownership */
+ shader->Program = prog;
prog->Parameters = _mesa_new_parameter_list();
prog->nir = brw_create_nir(brw, shProg, prog, (gl_shader_stage) stage,
compiler->scalar_stage[stage]);
-
- _mesa_reference_program(ctx, &prog, NULL);
}
if ((ctx->_Shader->Flags & GLSL_DUMP) && shProg->Name != 0) {
prog->info.fs.depth_layout = shader_program->FragDepthLayout;
}
- _mesa_reference_program(ctx, &shader->Program, prog);
+ /* Don't use _mesa_reference_program() just take ownership */
+ shader->Program = prog;
if ((ctx->_Shader->Flags & GLSL_NO_OPT) == 0) {
_mesa_optimize_program(ctx, prog, prog);
if (!ctx->Driver.ProgramStringNotify(ctx,
_mesa_shader_stage_to_program(i),
linked_prog)) {
+ _mesa_reference_program(ctx, &prog->_LinkedShaders[i]->Program,
+ NULL);
return GL_FALSE;
}
}
-
- _mesa_reference_program(ctx, &linked_prog, NULL);
}
build_program_resource_list(ctx, prog);
if (!prog)
return NULL;
- _mesa_reference_program(ctx, &shader->Program, prog);
+ /* Don't use _mesa_reference_program() just take ownership */
+ shader->Program = prog;
prog->Parameters = _mesa_new_parameter_list();
if (!prog)
return NULL;
- _mesa_reference_program(ctx, &shader->Program, prog);
+ /* Don't use _mesa_reference_program() just take ownership */
+ shader->Program = prog;
prog->Parameters = _mesa_new_parameter_list();
v = new glsl_to_tgsi_visitor();
_mesa_associate_uniform_storage(ctx, shader_program, prog->Parameters);
if (!shader_program->LinkStatus) {
free_glsl_to_tgsi_visitor(v);
+ _mesa_reference_program(ctx, &shader->Program, NULL);
return NULL;
}
linked_prog = get_mesa_program(ctx, prog, prog->_LinkedShaders[i]);
if (linked_prog) {
- _mesa_reference_program(ctx, &prog->_LinkedShaders[i]->Program,
- linked_prog);
if (!ctx->Driver.ProgramStringNotify(ctx,
_mesa_shader_stage_to_program(i),
linked_prog)) {
_mesa_reference_program(ctx, &prog->_LinkedShaders[i]->Program,
NULL);
- _mesa_reference_program(ctx, &linked_prog, NULL);
return GL_FALSE;
}
}
-
- _mesa_reference_program(ctx, &linked_prog, NULL);
}
return GL_TRUE;