2 * Mesa 3-D graphics library
4 * Copyright © 2013 Gregory Hainaut <gregory.hainaut@gmail.com>
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the "Software"),
8 * to deal in the Software without restriction, including without limitation
9 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 * and/or sell copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following conditions:
13 * The above copyright notice and this permission notice (including the next
14 * paragraph) shall be included in all copies or substantial portions of the
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
28 * \author Hainaut Gregory <gregory.hainaut@gmail.com>
30 * Implementation of pipeline object related API functions. Based on
31 * GL_ARB_separate_shader_objects extension.
34 #include "main/glheader.h"
35 #include "main/context.h"
36 #include "main/dispatch.h"
37 #include "main/enums.h"
38 #include "main/hash.h"
39 #include "main/mtypes.h"
40 #include "main/pipelineobj.h"
41 #include "main/shaderapi.h"
42 #include "main/shaderobj.h"
43 #include "main/transformfeedback.h"
44 #include "main/uniforms.h"
45 #include "program/program.h"
46 #include "program/prog_parameter.h"
49 #include "../glsl/glsl_parser_extras.h"
50 #include "../glsl/ir_uniform.h"
53 * Delete a pipeline object.
56 _mesa_delete_pipeline_object(struct gl_context
*ctx
,
57 struct gl_pipeline_object
*obj
)
61 _mesa_reference_shader_program(ctx
, &obj
->_CurrentFragmentProgram
, NULL
);
63 for (i
= 0; i
< MESA_SHADER_STAGES
; i
++)
64 _mesa_reference_shader_program(ctx
, &obj
->CurrentProgram
[i
], NULL
);
66 _mesa_reference_shader_program(ctx
, &obj
->ActiveProgram
, NULL
);
67 mtx_destroy(&obj
->Mutex
);
72 * Allocate and initialize a new pipeline object.
74 static struct gl_pipeline_object
*
75 _mesa_new_pipeline_object(struct gl_context
*ctx
, GLuint name
)
77 struct gl_pipeline_object
*obj
= rzalloc(NULL
, struct gl_pipeline_object
);
80 mtx_init(&obj
->Mutex
, mtx_plain
);
82 obj
->Flags
= _mesa_get_shader_flags();
90 * Initialize pipeline object state for given context.
93 _mesa_init_pipeline(struct gl_context
*ctx
)
95 ctx
->Pipeline
.Objects
= _mesa_NewHashTable();
97 ctx
->Pipeline
.Current
= NULL
;
99 /* Install a default Pipeline */
100 ctx
->Pipeline
.Default
= _mesa_new_pipeline_object(ctx
, 0);
101 _mesa_reference_pipeline_object(ctx
, &ctx
->_Shader
, ctx
->Pipeline
.Default
);
106 * Callback for deleting a pipeline object. Called by _mesa_HashDeleteAll().
109 delete_pipelineobj_cb(GLuint id
, void *data
, void *userData
)
111 struct gl_pipeline_object
*obj
= (struct gl_pipeline_object
*) data
;
112 struct gl_context
*ctx
= (struct gl_context
*) userData
;
113 _mesa_delete_pipeline_object(ctx
, obj
);
118 * Free pipeline state for given context.
121 _mesa_free_pipeline_data(struct gl_context
*ctx
)
123 _mesa_HashDeleteAll(ctx
->Pipeline
.Objects
, delete_pipelineobj_cb
, ctx
);
124 _mesa_DeleteHashTable(ctx
->Pipeline
.Objects
);
126 _mesa_reference_pipeline_object(ctx
, &ctx
->_Shader
, NULL
);
127 _mesa_delete_pipeline_object(ctx
, ctx
->Pipeline
.Default
);
132 * Look up the pipeline object for the given ID.
135 * Either a pointer to the pipeline object with the specified ID or \c NULL for
136 * a non-existent ID. The spec defines ID 0 as being technically
139 static inline struct gl_pipeline_object
*
140 lookup_pipeline_object(struct gl_context
*ctx
, GLuint id
)
145 return (struct gl_pipeline_object
*)
146 _mesa_HashLookup(ctx
->Pipeline
.Objects
, id
);
150 * Add the given pipeline object to the pipeline object pool.
153 save_pipeline_object(struct gl_context
*ctx
, struct gl_pipeline_object
*obj
)
156 _mesa_HashInsert(ctx
->Pipeline
.Objects
, obj
->Name
, obj
);
161 * Remove the given pipeline object from the pipeline object pool.
162 * Do not deallocate the pipeline object though.
165 remove_pipeline_object(struct gl_context
*ctx
, struct gl_pipeline_object
*obj
)
168 _mesa_HashRemove(ctx
->Pipeline
.Objects
, obj
->Name
);
173 * Set ptr to obj w/ reference counting.
174 * Note: this should only be called from the _mesa_reference_pipeline_object()
178 _mesa_reference_pipeline_object_(struct gl_context
*ctx
,
179 struct gl_pipeline_object
**ptr
,
180 struct gl_pipeline_object
*obj
)
185 /* Unreference the old pipeline object */
186 GLboolean deleteFlag
= GL_FALSE
;
187 struct gl_pipeline_object
*oldObj
= *ptr
;
189 mtx_lock(&oldObj
->Mutex
);
190 ASSERT(oldObj
->RefCount
> 0);
192 deleteFlag
= (oldObj
->RefCount
== 0);
193 mtx_unlock(&oldObj
->Mutex
);
196 _mesa_delete_pipeline_object(ctx
, oldObj
);
204 /* reference new pipeline object */
205 mtx_lock(&obj
->Mutex
);
206 if (obj
->RefCount
== 0) {
207 /* this pipeline's being deleted (look just above) */
208 /* Not sure this can ever really happen. Warn if it does. */
209 _mesa_problem(NULL
, "referencing deleted pipeline object");
216 mtx_unlock(&obj
->Mutex
);
221 * Bound program to severals stages of the pipeline
224 _mesa_UseProgramStages(GLuint pipeline
, GLbitfield stages
, GLuint program
)
226 GET_CURRENT_CONTEXT(ctx
);
228 struct gl_pipeline_object
*pipe
= lookup_pipeline_object(ctx
, pipeline
);
229 struct gl_shader_program
*shProg
= NULL
;
230 GLbitfield any_valid_stages
;
233 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glUseProgramStages(pipeline)");
237 /* Object is created by any Pipeline call but glGenProgramPipelines,
238 * glIsProgramPipeline and GetProgramPipelineInfoLog
240 pipe
->EverBound
= GL_TRUE
;
242 /* Section 2.11.4 (Program Pipeline Objects) of the OpenGL 4.1 spec says:
244 * "If stages is not the special value ALL_SHADER_BITS, and has a bit
245 * set that is not recognized, the error INVALID_VALUE is generated."
248 * GL_TESS_CONTROL_SHADER_BIT
249 * GL_TESS_EVALUATION_SHADER_BIT
251 any_valid_stages
= GL_VERTEX_SHADER_BIT
| GL_FRAGMENT_SHADER_BIT
;
252 if (_mesa_has_geometry_shaders(ctx
))
253 any_valid_stages
|= GL_GEOMETRY_SHADER_BIT
;
255 if (stages
!= GL_ALL_SHADER_BITS
&& (stages
& ~any_valid_stages
) != 0) {
256 _mesa_error(ctx
, GL_INVALID_VALUE
, "glUseProgramStages(Stages)");
260 /* Section 2.17.2 (Transform Feedback Primitive Capture) of the OpenGL 4.1
263 * "The error INVALID_OPERATION is generated:
267 * - by UseProgramStages if the program pipeline object it refers
268 * to is current and the current transform feedback object is
269 * active and not paused;
271 if (ctx
->_Shader
== pipe
) {
272 if (_mesa_is_xfb_active_and_unpaused(ctx
)) {
273 _mesa_error(ctx
, GL_INVALID_OPERATION
,
274 "glUseProgramStages(transform feedback active)");
280 shProg
= _mesa_lookup_shader_program_err(ctx
, program
,
281 "glUseProgramStages");
285 /* Section 2.11.4 (Program Pipeline Objects) of the OpenGL 4.1 spec
288 * "If the program object named by program was linked without the
289 * PROGRAM_SEPARABLE parameter set, or was not linked successfully,
290 * the error INVALID_OPERATION is generated and the corresponding
291 * shader stages in the pipeline program pipeline object are not
294 if (!shProg
->LinkStatus
) {
295 _mesa_error(ctx
, GL_INVALID_OPERATION
,
296 "glUseProgramStages(program not linked)");
300 if (!shProg
->SeparateShader
) {
301 _mesa_error(ctx
, GL_INVALID_OPERATION
,
302 "glUseProgramStages(program wasn't linked with the "
303 "PROGRAM_SEPARABLE flag)");
308 /* Enable individual stages from the program as requested by the
309 * application. If there is no shader for a requested stage in the
310 * program, _mesa_use_shader_program will enable fixed-function processing
311 * as dictated by the spec.
313 * Section 2.11.4 (Program Pipeline Objects) of the OpenGL 4.1 spec
316 * "If UseProgramStages is called with program set to zero or with a
317 * program object that contains no executable code for the given
318 * stages, it is as if the pipeline object has no programmable stage
319 * configured for the indicated shader stages."
321 if ((stages
& GL_VERTEX_SHADER_BIT
) != 0)
322 _mesa_use_shader_program(ctx
, GL_VERTEX_SHADER
, shProg
, pipe
);
324 if ((stages
& GL_FRAGMENT_SHADER_BIT
) != 0)
325 _mesa_use_shader_program(ctx
, GL_FRAGMENT_SHADER
, shProg
, pipe
);
327 if ((stages
& GL_GEOMETRY_SHADER_BIT
) != 0)
328 _mesa_use_shader_program(ctx
, GL_GEOMETRY_SHADER
, shProg
, pipe
);
332 * Use the named shader program for subsequent glUniform calls (if pipeline
336 _mesa_ActiveShaderProgram(GLuint pipeline
, GLuint program
)
338 GET_CURRENT_CONTEXT(ctx
);
339 struct gl_shader_program
*shProg
= NULL
;
340 struct gl_pipeline_object
*pipe
= lookup_pipeline_object(ctx
, pipeline
);
343 shProg
= _mesa_lookup_shader_program_err(ctx
, program
,
344 "glActiveShaderProgram(program)");
350 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glActiveShaderProgram(pipeline)");
354 /* Object is created by any Pipeline call but glGenProgramPipelines,
355 * glIsProgramPipeline and GetProgramPipelineInfoLog
357 pipe
->EverBound
= GL_TRUE
;
359 if ((shProg
!= NULL
) && !shProg
->LinkStatus
) {
360 _mesa_error(ctx
, GL_INVALID_OPERATION
,
361 "glActiveShaderProgram(program %u not linked)", shProg
->Name
);
365 _mesa_reference_shader_program(ctx
, &pipe
->ActiveProgram
, shProg
);
369 * Make program of the pipeline current
372 _mesa_BindProgramPipeline(GLuint pipeline
)
374 GET_CURRENT_CONTEXT(ctx
);
375 struct gl_pipeline_object
*newObj
= NULL
;
377 /* Rebinding the same pipeline object: no change.
379 if (ctx
->_Shader
->Name
== pipeline
)
382 /* Section 2.17.2 (Transform Feedback Primitive Capture) of the OpenGL 4.1
385 * "The error INVALID_OPERATION is generated:
389 * - by BindProgramPipeline if the current transform feedback
390 * object is active and not paused;
392 if (_mesa_is_xfb_active_and_unpaused(ctx
)) {
393 _mesa_error(ctx
, GL_INVALID_OPERATION
,
394 "glBindProgramPipeline(transform feedback active)");
398 /* Get pointer to new pipeline object (newObj)
401 /* non-default pipeline object */
402 newObj
= lookup_pipeline_object(ctx
, pipeline
);
404 _mesa_error(ctx
, GL_INVALID_OPERATION
,
405 "glBindProgramPipeline(non-gen name)");
409 /* Object is created by any Pipeline call but glGenProgramPipelines,
410 * glIsProgramPipeline and GetProgramPipelineInfoLog
412 newObj
->EverBound
= GL_TRUE
;
415 /* First bind the Pipeline to pipeline binding point */
416 _mesa_reference_pipeline_object(ctx
, &ctx
->Pipeline
.Current
, newObj
);
418 /* Section 2.11.3 (Program Objects) of the OpenGL 4.1 spec says:
420 * "If there is a current program object established by UseProgram,
421 * that program is considered current for all stages. Otherwise, if
422 * there is a bound program pipeline object (see section 2.11.4), the
423 * program bound to the appropriate stage of the pipeline object is
424 * considered current."
426 if (&ctx
->Shader
!= ctx
->_Shader
) {
428 /* Bound the pipeline to the current program and
429 * restore the pipeline state
431 _mesa_reference_pipeline_object(ctx
, &ctx
->_Shader
, newObj
);
433 /* Unbind the pipeline */
434 _mesa_reference_pipeline_object(ctx
, &ctx
->_Shader
,
435 ctx
->Pipeline
.Default
);
438 FLUSH_VERTICES(ctx
, _NEW_PROGRAM
| _NEW_PROGRAM_CONSTANTS
);
440 if (ctx
->Driver
.UseProgram
)
441 ctx
->Driver
.UseProgram(ctx
, NULL
);
446 * Delete a set of pipeline objects.
448 * \param n Number of pipeline objects to delete.
449 * \param ids pipeline of \c n pipeline object IDs.
452 _mesa_DeleteProgramPipelines(GLsizei n
, const GLuint
*pipelines
)
454 GET_CURRENT_CONTEXT(ctx
);
458 _mesa_error(ctx
, GL_INVALID_VALUE
, "glDeleteProgramPipelines(n<0)");
462 for (i
= 0; i
< n
; i
++) {
463 struct gl_pipeline_object
*obj
=
464 lookup_pipeline_object(ctx
, pipelines
[i
]);
467 ASSERT(obj
->Name
== pipelines
[i
]);
469 /* If the pipeline object is currently bound, the spec says "If an
470 * object that is currently bound is deleted, the binding for that
471 * object reverts to zero and no program pipeline object becomes
474 if (obj
== ctx
->Pipeline
.Current
) {
475 _mesa_BindProgramPipeline(0);
478 /* The ID is immediately freed for re-use */
479 remove_pipeline_object(ctx
, obj
);
481 /* Unreference the pipeline object.
482 * If refcount hits zero, the object will be deleted.
484 _mesa_reference_pipeline_object(ctx
, &obj
, NULL
);
490 * Generate a set of unique pipeline object IDs and store them in \c pipelines.
491 * \param n Number of IDs to generate.
492 * \param pipelines pipeline of \c n locations to store the IDs.
495 _mesa_GenProgramPipelines(GLsizei n
, GLuint
*pipelines
)
497 GET_CURRENT_CONTEXT(ctx
);
503 _mesa_error(ctx
, GL_INVALID_VALUE
, "glGenProgramPipelines(n<0)");
511 first
= _mesa_HashFindFreeKeyBlock(ctx
->Pipeline
.Objects
, n
);
513 for (i
= 0; i
< n
; i
++) {
514 struct gl_pipeline_object
*obj
;
515 GLuint name
= first
+ i
;
517 obj
= _mesa_new_pipeline_object(ctx
, name
);
519 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glGenProgramPipelines");
523 save_pipeline_object(ctx
, obj
);
524 pipelines
[i
] = first
+ i
;
530 * Determine if ID is the name of an pipeline object.
532 * \param id ID of the potential pipeline object.
533 * \return \c GL_TRUE if \c id is the name of a pipeline object,
534 * \c GL_FALSE otherwise.
537 _mesa_IsProgramPipeline(GLuint pipeline
)
539 GET_CURRENT_CONTEXT(ctx
);
541 struct gl_pipeline_object
*obj
= lookup_pipeline_object(ctx
, pipeline
);
545 return obj
->EverBound
;
549 * glGetProgramPipelineiv() - get pipeline shader state.
552 _mesa_GetProgramPipelineiv(GLuint pipeline
, GLenum pname
, GLint
*params
)
554 GET_CURRENT_CONTEXT(ctx
);
555 struct gl_pipeline_object
*pipe
= lookup_pipeline_object(ctx
, pipeline
);
557 /* Are geometry shaders available in this context?
559 const bool has_gs
= _mesa_has_geometry_shaders(ctx
);
562 _mesa_error(ctx
, GL_INVALID_OPERATION
,
563 "glGetProgramPipelineiv(pipeline)");
567 /* Object is created by any Pipeline call but glGenProgramPipelines,
568 * glIsProgramPipeline and GetProgramPipelineInfoLog
570 pipe
->EverBound
= GL_TRUE
;
573 case GL_ACTIVE_PROGRAM
:
574 *params
= pipe
->ActiveProgram
? pipe
->ActiveProgram
->Name
: 0;
576 case GL_INFO_LOG_LENGTH
:
577 *params
= pipe
->InfoLog
? strlen(pipe
->InfoLog
) + 1 : 0;
579 case GL_VALIDATE_STATUS
:
580 *params
= pipe
->Validated
;
582 case GL_VERTEX_SHADER
:
583 *params
= pipe
->CurrentProgram
[MESA_SHADER_VERTEX
]
584 ? pipe
->CurrentProgram
[MESA_SHADER_VERTEX
]->Name
: 0;
586 case GL_TESS_EVALUATION_SHADER
:
587 /* NOT YET SUPPORTED */
589 case GL_TESS_CONTROL_SHADER
:
590 /* NOT YET SUPPORTED */
592 case GL_GEOMETRY_SHADER
:
595 *params
= pipe
->CurrentProgram
[MESA_SHADER_GEOMETRY
]
596 ? pipe
->CurrentProgram
[MESA_SHADER_GEOMETRY
]->Name
: 0;
598 case GL_FRAGMENT_SHADER
:
599 *params
= pipe
->CurrentProgram
[MESA_SHADER_FRAGMENT
]
600 ? pipe
->CurrentProgram
[MESA_SHADER_FRAGMENT
]->Name
: 0;
606 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetProgramPipelineiv(pname=%s)",
607 _mesa_lookup_enum_by_nr(pname
));
611 * Determines whether every stage in a linked program is active in the
612 * specified pipeline.
615 program_stages_all_active(struct gl_pipeline_object
*pipe
,
616 const struct gl_shader_program
*prog
)
624 for (i
= 0; i
< MESA_SHADER_STAGES
; i
++) {
625 if (prog
->_LinkedShaders
[i
]) {
626 if (pipe
->CurrentProgram
[i
]) {
627 if (prog
->Name
!= pipe
->CurrentProgram
[i
]->Name
) {
637 pipe
->InfoLog
= ralloc_asprintf(pipe
,
638 "Program %d is not active for all "
639 "shaders that was linked",
647 _mesa_validate_program_pipeline(struct gl_context
* ctx
,
648 struct gl_pipeline_object
*pipe
,
653 pipe
->Validated
= GL_FALSE
;
655 /* Release and reset the info log.
657 if (pipe
->InfoLog
!= NULL
)
658 ralloc_free(pipe
->InfoLog
);
660 pipe
->InfoLog
= NULL
;
662 /* Section 2.11.11 (Shader Execution), subheading "Validation," of the
663 * OpenGL 4.1 spec says:
665 * "[INVALID_OPERATION] is generated by any command that transfers
666 * vertices to the GL if:
668 * - A program object is active for at least one, but not all of
669 * the shader stages that were present when the program was
672 * For each possible program stage, verify that the program bound to that
673 * stage has all of its stages active. In other words, if the program
674 * bound to the vertex stage also has a fragment shader, the fragment
675 * shader must also be bound to the fragment stage.
677 for (i
= 0; i
< MESA_SHADER_STAGES
; i
++) {
678 if (!program_stages_all_active(pipe
, pipe
->CurrentProgram
[i
])) {
683 /* Section 2.11.11 (Shader Execution), subheading "Validation," of the
684 * OpenGL 4.1 spec says:
686 * "[INVALID_OPERATION] is generated by any command that transfers
687 * vertices to the GL if:
691 * - One program object is active for at least two shader stages
692 * and a second program is active for a shader stage between two
693 * stages for which the first program was active."
695 * Without Tesselation, the only case where this can occur is the geometry
696 * shader between the fragment shader and vertex shader.
698 if (pipe
->CurrentProgram
[MESA_SHADER_GEOMETRY
]
699 && pipe
->CurrentProgram
[MESA_SHADER_FRAGMENT
]
700 && pipe
->CurrentProgram
[MESA_SHADER_VERTEX
]) {
701 if (pipe
->CurrentProgram
[MESA_SHADER_VERTEX
]->Name
== pipe
->CurrentProgram
[MESA_SHADER_FRAGMENT
]->Name
&&
702 pipe
->CurrentProgram
[MESA_SHADER_GEOMETRY
]->Name
!= pipe
->CurrentProgram
[MESA_SHADER_VERTEX
]->Name
) {
704 ralloc_asprintf(pipe
,
705 "Program %d is active for geometry stage between "
706 "two stages for which another program %d is "
708 pipe
->CurrentProgram
[MESA_SHADER_GEOMETRY
]->Name
,
709 pipe
->CurrentProgram
[MESA_SHADER_VERTEX
]->Name
);
714 /* Section 2.11.11 (Shader Execution), subheading "Validation," of the
715 * OpenGL 4.1 spec says:
717 * "[INVALID_OPERATION] is generated by any command that transfers
718 * vertices to the GL if:
722 * - There is an active program for tessellation control,
723 * tessellation evaluation, or geometry stages with corresponding
724 * executable shader, but there is no active program with
725 * executable vertex shader."
727 if (!pipe
->CurrentProgram
[MESA_SHADER_VERTEX
]
728 && pipe
->CurrentProgram
[MESA_SHADER_GEOMETRY
]) {
729 pipe
->InfoLog
= ralloc_strdup(pipe
, "Program lacks a vertex shader");
733 /* Section 2.11.11 (Shader Execution), subheading "Validation," of the
734 * OpenGL 4.1 spec says:
736 * "[INVALID_OPERATION] is generated by any command that transfers
737 * vertices to the GL if:
741 * - There is no current program object specified by UseProgram,
742 * there is a current program pipeline object, and the current
743 * program for any shader stage has been relinked since being
744 * applied to the pipeline object via UseProgramStages with the
745 * PROGRAM_SEPARABLE parameter set to FALSE.
747 for (i
= 0; i
< MESA_SHADER_STAGES
; i
++) {
748 if (pipe
->CurrentProgram
[i
] && !pipe
->CurrentProgram
[i
]->SeparateShader
) {
749 pipe
->InfoLog
= ralloc_asprintf(pipe
,
750 "Program %d was relinked without "
751 "PROGRAM_SEPARABLE state",
752 pipe
->CurrentProgram
[i
]->Name
);
757 /* Section 2.11.11 (Shader Execution), subheading "Validation," of the
758 * OpenGL 4.1 spec says:
760 * "[INVALID_OPERATION] is generated by any command that transfers
761 * vertices to the GL if:
765 * - Any two active samplers in the current program object are of
766 * different types, but refer to the same texture image unit.
768 * - The number of active samplers in the program exceeds the
769 * maximum number of texture image units allowed."
771 if (!_mesa_sampler_uniforms_pipeline_are_valid(pipe
))
774 pipe
->Validated
= GL_TRUE
;
779 _mesa_error(ctx
, GL_INVALID_OPERATION
,
780 "glValidateProgramPipeline failed to validate the pipeline");
786 * Check compatibility of pipeline's program
789 _mesa_ValidateProgramPipeline(GLuint pipeline
)
791 GET_CURRENT_CONTEXT(ctx
);
793 struct gl_pipeline_object
*pipe
= lookup_pipeline_object(ctx
, pipeline
);
796 _mesa_error(ctx
, GL_INVALID_OPERATION
,
797 "glValidateProgramPipeline(pipeline)");
801 _mesa_validate_program_pipeline(ctx
, pipe
,
802 (ctx
->_Shader
->Name
== pipe
->Name
));
806 _mesa_GetProgramPipelineInfoLog(GLuint pipeline
, GLsizei bufSize
,
807 GLsizei
*length
, GLchar
*infoLog
)
809 GET_CURRENT_CONTEXT(ctx
);
811 struct gl_pipeline_object
*pipe
= lookup_pipeline_object(ctx
, pipeline
);
814 _mesa_error(ctx
, GL_INVALID_VALUE
,
815 "glGetProgramPipelineInfoLog(pipeline)");
820 _mesa_error(ctx
, GL_INVALID_VALUE
,
821 "glGetProgramPipelineInfoLog(bufSize)");
826 _mesa_copy_string(infoLog
, bufSize
, length
, pipe
->InfoLog
);