summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/shaderapi.c
diff options
context:
space:
mode:
authorTimothy Arceri <[email protected]>2017-05-11 14:59:41 +1000
committerTimothy Arceri <[email protected]>2017-05-17 10:12:03 +1000
commit35a9b9a70c90436105d702e0da0b8e99a27c4b8b (patch)
treeb8fe0639976393186f7a76d847a277706f8f3dac /src/mesa/main/shaderapi.c
parente0d6f9afba498c8d778381c1a7a87a886aa04643 (diff)
mesa: move use_program() inside _mesa_use_program()
Reviewed-by: Nicolai Hähnle <[email protected]>
Diffstat (limited to 'src/mesa/main/shaderapi.c')
-rw-r--r--src/mesa/main/shaderapi.c50
1 files changed, 21 insertions, 29 deletions
diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c
index 7430cfeeb8d..f63215a07be 100644
--- a/src/mesa/main/shaderapi.c
+++ b/src/mesa/main/shaderapi.c
@@ -1242,33 +1242,6 @@ _mesa_active_program(struct gl_context *ctx, struct gl_shader_program *shProg,
}
-static void
-use_program(struct gl_context *ctx, gl_shader_stage stage,
- struct gl_shader_program *shProg, struct gl_program *new_prog,
- struct gl_pipeline_object *shTarget)
-{
- struct gl_program **target;
-
- target = &shTarget->CurrentProgram[stage];
- if (new_prog) {
- _mesa_program_init_subroutine_defaults(ctx, new_prog);
- }
-
- if (*target != new_prog) {
- /* Program is current, flush it */
- if (shTarget == ctx->_Shader) {
- FLUSH_VERTICES(ctx, _NEW_PROGRAM | _NEW_PROGRAM_CONSTANTS);
- }
-
- _mesa_reference_shader_program(ctx,
- &shTarget->ReferencedPrograms[stage],
- shProg);
- _mesa_reference_program(ctx, target, new_prog);
- return;
- }
-}
-
-
/**
* Use the named shader program for subsequent rendering.
*/
@@ -1280,7 +1253,7 @@ _mesa_use_shader_program(struct gl_context *ctx,
struct gl_program *new_prog = NULL;
if (shProg && shProg->_LinkedShaders[i])
new_prog = shProg->_LinkedShaders[i]->Program;
- use_program(ctx, i, shProg, new_prog, &ctx->Shader);
+ _mesa_use_program(ctx, i, shProg, new_prog, &ctx->Shader);
}
_mesa_active_program(ctx, shProg, "glUseProgram");
}
@@ -2164,7 +2137,26 @@ _mesa_use_program(struct gl_context *ctx, gl_shader_stage stage,
struct gl_shader_program *shProg, struct gl_program *prog,
struct gl_pipeline_object *shTarget)
{
- use_program(ctx, stage, shProg, prog, shTarget);
+ struct gl_program **target;
+
+ target = &shTarget->CurrentProgram[stage];
+ if (prog) {
+ _mesa_program_init_subroutine_defaults(ctx, prog);
+ }
+
+ if (*target != prog) {
+ /* Program is current, flush it */
+ if (shTarget == ctx->_Shader) {
+ FLUSH_VERTICES(ctx, _NEW_PROGRAM | _NEW_PROGRAM_CONSTANTS);
+ }
+
+ _mesa_reference_shader_program(ctx,
+ &shTarget->ReferencedPrograms[stage],
+ shProg);
+ _mesa_reference_program(ctx, target, prog);
+ return;
+ }
+
}