_mesa_reference_program(ctx, &obj->_CurrentFragmentProgram, NULL);
- for (i = 0; i < MESA_SHADER_STAGES; i++)
+ for (i = 0; i < MESA_SHADER_STAGES; i++) {
_mesa_reference_program(ctx, &obj->CurrentProgram[i], NULL);
+ _mesa_reference_shader_program(ctx, &obj->ReferencedPrograms[i], NULL);
+ }
_mesa_reference_shader_program(ctx, &obj->ActiveProgram, NULL);
mtx_destroy(&obj->Mutex);
if (shProg && shProg->_LinkedShaders[stage])
prog = shProg->_LinkedShaders[stage]->Program;
- _mesa_use_program(ctx, stage, prog, pipe);
+ _mesa_use_program(ctx, stage, shProg, prog, pipe);
}
/**
if (shProg->_LinkedShaders[stage])
prog = shProg->_LinkedShaders[stage]->Program;
- _mesa_use_program(ctx, stage, prog, ctx->_Shader);
+ _mesa_use_program(ctx, stage, shProg, prog, ctx->_Shader);
}
}
static void
use_program(struct gl_context *ctx, gl_shader_stage stage,
- struct gl_program *new_prog, struct gl_pipeline_object *shTarget)
+ struct gl_shader_program *shProg, struct gl_program *new_prog,
+ struct gl_pipeline_object *shTarget)
{
struct gl_program **target;
break;
}
+ _mesa_reference_shader_program(ctx,
+ &shTarget->ReferencedPrograms[stage],
+ shProg);
_mesa_reference_program(ctx, target, new_prog);
return;
}
struct gl_program *new_prog = NULL;
if (shProg && shProg->_LinkedShaders[i])
new_prog = shProg->_LinkedShaders[i]->Program;
- use_program(ctx, i, new_prog, &ctx->Shader);
+ use_program(ctx, i, shProg, new_prog, &ctx->Shader);
}
_mesa_active_program(ctx, shProg, "glUseProgram");
}
void
_mesa_use_program(struct gl_context *ctx, gl_shader_stage stage,
- struct gl_program *prog,
+ struct gl_shader_program *shProg, struct gl_program *prog,
struct gl_pipeline_object *shTarget)
{
- use_program(ctx, stage, prog, shTarget);
+ use_program(ctx, stage, shProg, prog, shTarget);
}