FLUSH_VERTICES(ctx, _NEW_PROGRAM | _NEW_PROGRAM_CONSTANTS);
- for (i = 0; i < MESA_SHADER_STAGES; i++)
- _mesa_shader_program_init_subroutine_defaults(ctx, ctx->_Shader->CurrentProgram[i]);
+ for (i = 0; i < MESA_SHADER_STAGES; i++) {
+ if (ctx->_Shader->CurrentProgram[i]) {
+ struct gl_linked_shader *sh =
+ ctx->_Shader->CurrentProgram[i]->_LinkedShaders[i];
+ if (sh)
+ _mesa_program_init_subroutine_defaults(ctx, sh->Program);
+ }
+ }
}
}
if ((shProg != NULL) && (shProg->_LinkedShaders[stage] == NULL))
shProg = NULL;
- if (shProg)
- _mesa_shader_program_init_subroutine_defaults(ctx, shProg);
+ if (shProg) {
+ for (unsigned i = 0; i < MESA_SHADER_STAGES; i++) {
+ struct gl_linked_shader *sh = shProg->_LinkedShaders[i];
+ if (!sh)
+ continue;
+
+ _mesa_program_init_subroutine_defaults(ctx, sh->Program);
+ }
+ }
if (*target != shProg) {
/* Program is current, flush it */
ctx->_Shader->CurrentProgram[stage]->_LinkedShaders[stage]->Program);
}
-static void
+void
_mesa_program_init_subroutine_defaults(struct gl_context *ctx,
struct gl_program *p)
{
binding->IndexPtr[i] = find_compat_subroutine(p, uni->type);
}
}
-
-void
-_mesa_shader_program_init_subroutine_defaults(struct gl_context *ctx,
- struct gl_shader_program *shProg)
-{
- int i;
-
- if (!shProg)
- return;
-
- for (i = 0; i < MESA_SHADER_STAGES; i++) {
- if (!shProg->_LinkedShaders[i])
- continue;
-
- _mesa_program_init_subroutine_defaults(ctx, shProg->_LinkedShaders[i]->Program);
- }
-}
/* GL_ARB_shader_subroutine */
void
-_mesa_shader_program_init_subroutine_defaults(struct gl_context *ctx,
- struct gl_shader_program *shProg);
+_mesa_program_init_subroutine_defaults(struct gl_context *ctx,
+ struct gl_program *prog);
extern GLint GLAPIENTRY
_mesa_GetSubroutineUniformLocation(GLuint program, GLenum shadertype,