summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/shaderapi.c
diff options
context:
space:
mode:
authorTimothy Arceri <[email protected]>2017-01-09 16:13:28 +1100
committerTimothy Arceri <[email protected]>2017-01-19 15:55:02 +1100
commitaad93402c00ae90274d7abdbb64960d9ae40a0ce (patch)
tree7c597e71dab97a70c9c0fc3529039a65387172b6 /src/mesa/main/shaderapi.c
parent90d950038f801551cc5b939ef31c379bccf96f5f (diff)
mesa: change init subroutine defaults helper to work per gl_program
A later patch will result in SSO programs calling this helper per gl_program rather than per gl_shader_program. Reviewed-by: Lionel Landwerlin <[email protected]>
Diffstat (limited to 'src/mesa/main/shaderapi.c')
-rw-r--r--src/mesa/main/shaderapi.c30
1 files changed, 10 insertions, 20 deletions
diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c
index 4c67f9564ab..4ee71dcdcb1 100644
--- a/src/mesa/main/shaderapi.c
+++ b/src/mesa/main/shaderapi.c
@@ -1221,8 +1221,15 @@ use_shader_program(struct gl_context *ctx, gl_shader_stage stage,
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 */
@@ -2875,7 +2882,7 @@ _mesa_shader_write_subroutine_indices(struct gl_context *ctx,
ctx->_Shader->CurrentProgram[stage]->_LinkedShaders[stage]->Program);
}
-static void
+void
_mesa_program_init_subroutine_defaults(struct gl_context *ctx,
struct gl_program *p)
{
@@ -2897,20 +2904,3 @@ _mesa_program_init_subroutine_defaults(struct gl_context *ctx,
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);
- }
-}