* shader is returned.
*/
static struct gl_shader *
-link_intrastage_shaders(struct gl_shader_program *prog,
+link_intrastage_shaders(GLcontext *ctx,
+ struct gl_shader_program *prog,
struct gl_shader **shader_list,
unsigned num_shaders)
{
return NULL;
}
- gl_shader *const linked = _mesa_new_shader(NULL, 0, main->Type);
+ gl_shader *const linked = ctx->Driver.NewShader(NULL, 0, main->Type);
linked->ir = new(linked) exec_list;
clone_ir_list(linked, linked->ir, main->ir);
void
-link_shaders(struct gl_shader_program *prog)
+link_shaders(GLcontext *ctx, struct gl_shader_program *prog)
{
prog->LinkStatus = false;
prog->Validated = false;
prog->Version = max_version;
+ for (unsigned int i = 0; i < prog->_NumLinkedShaders; i++) {
+ ctx->Driver.DeleteShader(ctx, prog->_LinkedShaders[i]);
+ }
+
/* Link all shaders for a particular stage and validate the result.
*/
prog->_NumLinkedShaders = 0;
if (num_vert_shaders > 0) {
gl_shader *const sh =
- link_intrastage_shaders(prog, vert_shader_list, num_vert_shaders);
+ link_intrastage_shaders(ctx, prog, vert_shader_list, num_vert_shaders);
if (sh == NULL)
goto done;
if (num_frag_shaders > 0) {
gl_shader *const sh =
- link_intrastage_shaders(prog, frag_shader_list, num_frag_shaders);
+ link_intrastage_shaders(ctx, prog, frag_shader_list, num_frag_shaders);
if (sh == NULL)
goto done;
main(int argc, char **argv)
{
int status = EXIT_SUCCESS;
+ GLcontext local_ctx;
+ GLcontext *ctx = &local_ctx;
+
+ ctx->Driver.NewShader = _mesa_new_shader;
int c;
int idx = 0;
}
if ((status == EXIT_SUCCESS) && do_link) {
- link_shaders(whole_program);
+ link_shaders(ctx, whole_program);
status = (whole_program->LinkStatus) ? EXIT_SUCCESS : EXIT_FAILURE;
if (strlen(whole_program->InfoLog) > 0)