Mesa (master): mesa/sso: Implement _mesa_ActiveShaderProgram
Ian Romanick
idr at kemper.freedesktop.org
Fri Feb 21 23:41:21 UTC 2014
Module: Mesa
Branch: master
Commit: c171834b49fe0556559b3040e06ae5df8800c934
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=c171834b49fe0556559b3040e06ae5df8800c934
Author: Gregory Hainaut <gregory.hainaut at gmail.com>
Date: Fri Jun 28 14:19:12 2013 -0700
mesa/sso: Implement _mesa_ActiveShaderProgram
This was originally included in another patch, but it was split out by
Ian Romanick.
v2 (idr): Return early from _mesa_ActiveShaderProgram if
_mesa_lookup_shader_program_err returns an error. Suggested by Jordan.
Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>
Reviewed-by: Jordan Justen <jordan.l.justen at intel.com> [v2]
---
src/mesa/main/pipelineobj.c | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
diff --git a/src/mesa/main/pipelineobj.c b/src/mesa/main/pipelineobj.c
index ab4a0c4..b5780c6 100644
--- a/src/mesa/main/pipelineobj.c
+++ b/src/mesa/main/pipelineobj.c
@@ -223,6 +223,34 @@ _mesa_UseProgramStages(GLuint pipeline, GLbitfield stages, GLuint program)
void GLAPIENTRY
_mesa_ActiveShaderProgram(GLuint pipeline, GLuint program)
{
+ GET_CURRENT_CONTEXT(ctx);
+ struct gl_shader_program *shProg = NULL;
+ struct gl_pipeline_object *pipe = lookup_pipeline_object(ctx, pipeline);
+
+ if (program != 0) {
+ shProg = _mesa_lookup_shader_program_err(ctx, program,
+ "glActiveShaderProgram(program)");
+ if (shProg == NULL)
+ return;
+ }
+
+ if (!pipe) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glActiveShaderProgram(pipeline)");
+ return;
+ }
+
+ /* Object is created by any Pipeline call but glGenProgramPipelines,
+ * glIsProgramPipeline and GetProgramPipelineInfoLog
+ */
+ pipe->EverBound = GL_TRUE;
+
+ if ((shProg != NULL) && !shProg->LinkStatus) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glActiveShaderProgram(program %u not linked)", shProg->Name);
+ return;
+ }
+
+ _mesa_reference_shader_program(ctx, &pipe->ActiveProgram, shProg);
}
/**
More information about the mesa-commit
mailing list