2 * Mesa 3-D graphics library
5 * Copyright (C) 2004-2007 Brian Paul All Rights Reserved.
7 * Permission is hereby granted, free of charge, to any person obtaining a
8 * copy of this software and associated documentation files (the "Software"),
9 * to deal in the Software without restriction, including without limitation
10 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
11 * and/or sell copies of the Software, and to permit persons to whom the
12 * Software is furnished to do so, subject to the following conditions:
14 * The above copyright notice and this permission notice shall be included
15 * in all copies or substantial portions of the Software.
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
21 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27 * Implementation of GLSL-related API functions
33 * 1. Check that the right error code is generated for all _mesa_error() calls.
34 * 2. Insert FLUSH_VERTICES calls in various places
42 #include "prog_parameter.h"
43 #include "shader_api.h"
45 #include "slang_compile.h"
46 #include "slang_link.h"
53 * Copy string from <src> to <dst>, up to maxLength characters, returning
54 * length of <dst> in <length>.
55 * \param src the strings source
56 * \param maxLength max chars to copy
57 * \param length returns number of chars copied
58 * \param dst the string destination
61 copy_string(GLchar
*dst
, GLsizei maxLength
, GLsizei
*length
, const GLchar
*src
)
64 for (len
= 0; len
< maxLength
- 1 && src
&& src
[len
]; len
++)
76 * Called via ctx->Driver.AttachShader()
79 _mesa_attach_shader(GLcontext
*ctx
, GLuint program
, GLuint shader
)
81 struct gl_linked_program
*linked
82 = _mesa_lookup_linked_program(ctx
, program
);
83 struct gl_program
*prog
= _mesa_lookup_shader(ctx
, shader
);
84 const GLuint n
= linked
->NumShaders
;
87 if (!linked
|| !prog
) {
88 _mesa_error(ctx
, GL_INVALID_OPERATION
,
89 "glAttachShader(bad program or shader name)");
93 for (i
= 0; i
< n
; i
++) {
94 if (linked
->Shaders
[i
] == prog
) {
95 /* already attached */
101 linked
->Shaders
= (struct gl_program
**)
102 _mesa_realloc(linked
->Shaders
,
103 n
* sizeof(struct gl_program
*),
104 (n
+ 1) * sizeof(struct gl_program
*));
105 if (!linked
->Shaders
) {
106 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glAttachShader");
111 linked
->Shaders
[n
] = prog
;
113 linked
->NumShaders
++;
118 _mesa_bind_attrib_location(GLcontext
*ctx
, GLuint program
, GLuint index
,
121 struct gl_linked_program
*linked
122 = _mesa_lookup_linked_program(ctx
, program
);
125 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glBindAttribLocation(program)");
130 if (name
== NULL
|| index
>= MAX_VERTEX_ATTRIBS
)
131 _mesa_error(ctx
, GL_INVALID_VALUE
, "glBindAttribLocationARB");
132 else if (IS_NAME_WITH_GL_PREFIX(name
))
133 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glBindAttribLocationARB");
135 (**pro
).OverrideAttribBinding(pro
, index
, name
);
136 RELEASE_PROGRAM(pro
);
142 _mesa_create_shader(GLcontext
*ctx
, GLenum type
)
144 struct gl_program
*newProg
;
147 name
= _mesa_HashFindFreeKeyBlock(ctx
->Shared
->ShaderObjects
, 1);
150 case GL_FRAGMENT_SHADER_ARB
:
151 /* alloc new gl_fragment_program */
152 newProg
= ctx
->Driver
.NewProgram(ctx
, GL_FRAGMENT_PROGRAM_ARB
, name
);
154 case GL_VERTEX_SHADER_ARB
:
155 /* alloc new gl_vertex_program */
156 newProg
= ctx
->Driver
.NewProgram(ctx
, GL_VERTEX_PROGRAM_ARB
, name
);
159 _mesa_error(ctx
, GL_INVALID_ENUM
, "CreateShader(type)");
163 _mesa_HashInsert(ctx
->Shared
->ShaderObjects
, name
, newProg
);
170 _mesa_create_program(GLcontext
*ctx
)
173 struct gl_linked_program
*linked
;
175 name
= _mesa_HashFindFreeKeyBlock(ctx
->Shared
->ProgramObjects
, 1);
176 linked
= _mesa_new_linked_program(ctx
, name
);
178 _mesa_HashInsert(ctx
->Shared
->ProgramObjects
, name
, linked
);
185 _mesa_delete_program2(GLcontext
*ctx
, GLuint name
)
187 struct gl_linked_program
*linked
;
189 linked
= _mesa_lookup_linked_program(ctx
, name
);
191 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glDeleteProgram(name)");
195 /* XXX refcounting! */
196 _mesa_HashRemove(ctx
->Shared
->ProgramObjects
, name
);
197 _mesa_delete_linked_program(ctx
, linked
);
202 _mesa_delete_shader(GLcontext
*ctx
, GLuint shader
)
204 /* XXX refcounting! */
207 _mesa_DeleteObjectARB(shader);
213 _mesa_detach_shader(GLcontext
*ctx
, GLuint program
, GLuint shader
)
215 struct gl_linked_program
*linked
216 = _mesa_lookup_linked_program(ctx
, program
);
217 const GLuint n
= linked
->NumShaders
;
221 _mesa_error(ctx
, GL_INVALID_OPERATION
,
222 "glDetachShader(bad program or shader name)");
226 for (i
= 0; i
< n
; i
++) {
227 if (linked
->Shaders
[i
]->Id
== shader
) {
228 struct gl_program
**newList
;
230 /* alloc new, smaller array */
231 newList
= (struct gl_program
**)
232 _mesa_malloc((n
- 1) * sizeof(struct gl_program
*));
234 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glDetachShader");
237 for (j
= 0; j
< i
; j
++) {
238 newList
[j
] = linked
->Shaders
[j
];
241 newList
[j
++] = linked
->Shaders
[i
];
242 _mesa_free(linked
->Shaders
);
244 /* XXX refcounting! */
246 linked
->Shaders
= newList
;
252 _mesa_error(ctx
, GL_INVALID_OPERATION
,
253 "glDetachShader(shader not found)");
258 _mesa_get_active_attrib(GLcontext
*ctx
, GLuint program
, GLuint index
,
259 GLsizei maxLength
, GLsizei
*length
, GLint
*size
,
260 GLenum
*type
, GLchar
*nameOut
)
262 static const GLenum vec_types
[] = {
263 GL_FLOAT
, GL_FLOAT_VEC2
, GL_FLOAT_VEC3
, GL_FLOAT_VEC4
265 struct gl_linked_program
*linked
266 = _mesa_lookup_linked_program(ctx
, program
);
270 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glGetActiveUniform");
274 if (!linked
->Attributes
|| index
>= linked
->Attributes
->NumParameters
) {
275 _mesa_error(ctx
, GL_INVALID_VALUE
, "glGetActiveUniform(index)");
279 copy_string(nameOut
, maxLength
, length
,
280 linked
->Attributes
->Parameters
[index
].Name
);
281 sz
= linked
->Attributes
->Parameters
[index
].Size
;
285 *type
= vec_types
[sz
]; /* XXX this is a temporary hack */
290 * Called via ctx->Driver.GetActiveUniform().
293 _mesa_get_active_uniform(GLcontext
*ctx
, GLuint program
, GLuint index
,
294 GLsizei maxLength
, GLsizei
*length
, GLint
*size
,
295 GLenum
*type
, GLchar
*nameOut
)
297 static const GLenum vec_types
[] = {
298 GL_FLOAT
, GL_FLOAT_VEC2
, GL_FLOAT_VEC3
, GL_FLOAT_VEC4
300 struct gl_linked_program
*linked
301 = _mesa_lookup_linked_program(ctx
, program
);
305 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glGetActiveUniform");
309 if (!linked
->Uniforms
|| index
>= linked
->Uniforms
->NumParameters
) {
310 _mesa_error(ctx
, GL_INVALID_VALUE
, "glGetActiveUniform(index)");
314 copy_string(nameOut
, maxLength
, length
,
315 linked
->Uniforms
->Parameters
[index
].Name
);
316 sz
= linked
->Uniforms
->Parameters
[index
].Size
;
320 *type
= vec_types
[sz
]; /* XXX this is a temporary hack */
325 * Called via ctx->Driver.GetAttachedShaders().
328 _mesa_get_attached_shaders(GLcontext
*ctx
, GLuint program
, GLsizei maxCount
,
329 GLsizei
*count
, GLuint
*obj
)
331 struct gl_linked_program
*linked
332 = _mesa_lookup_linked_program(ctx
, program
);
335 for (i
= 0; i
< maxCount
&& i
< linked
->NumShaders
; i
++) {
336 obj
[i
] = linked
->Shaders
[i
]->Id
;
342 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glGetAttachedShaders");
348 _mesa_get_attrib_location(GLcontext
*ctx
, GLuint program
,
351 struct gl_linked_program
*linked
352 = _mesa_lookup_linked_program(ctx
, program
);
355 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glGetAttribLocation");
359 if (!linked
->LinkStatus
) {
360 _mesa_error(ctx
, GL_INVALID_OPERATION
,
361 "glGetAttribLocation(program not linked)");
368 if (linked
->Attributes
) {
370 for (i
= 0; i
< linked
->Attributes
->NumParameters
; i
++) {
371 if (!strcmp(linked
->Attributes
->Parameters
[i
].Name
, name
)) {
381 _mesa_get_handle(GLcontext
*ctx
, GLenum pname
)
384 GET_CURRENT_CONTEXT(ctx
);
387 case GL_PROGRAM_OBJECT_ARB
:
389 struct gl2_program_intf
**pro
= ctx
->Shader
.CurrentProgram
;
392 return (**pro
)._container
._generic
.
393 GetName((struct gl2_generic_intf
**) (pro
));
397 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetHandleARB");
405 _mesa_get_programiv(GLcontext
*ctx
, GLuint program
,
406 GLenum pname
, GLint
*params
)
408 struct gl_linked_program
*linked
409 = _mesa_lookup_linked_program(ctx
, program
);
412 _mesa_error(ctx
, GL_INVALID_VALUE
, "glGetProgramiv(program)");
417 case GL_DELETE_STATUS
:
418 *params
= linked
->DeletePending
;
421 *params
= linked
->LinkStatus
;
423 case GL_VALIDATE_STATUS
:
424 *params
= linked
->Validated
;
426 case GL_INFO_LOG_LENGTH
:
427 *params
= linked
->InfoLog
? strlen(linked
->InfoLog
) : 0;
429 case GL_ATTACHED_SHADERS
:
430 *params
= linked
->NumShaders
;
432 case GL_ACTIVE_ATTRIBUTES
:
433 *params
= linked
->Uniforms
? linked
->Uniforms
->NumParameters
: 0;
435 case GL_ACTIVE_ATTRIBUTE_MAX_LENGTH
:
436 *params
= _mesa_parameter_longest_name(linked
->Attributes
);
438 case GL_ACTIVE_UNIFORMS
:
439 *params
= linked
->Uniforms
? linked
->Uniforms
->NumParameters
: 0;
441 case GL_ACTIVE_UNIFORM_MAX_LENGTH
:
442 *params
= _mesa_parameter_longest_name(linked
->Uniforms
);
445 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetProgramiv(pname)");
452 _mesa_get_shaderiv(GLcontext
*ctx
, GLuint name
, GLenum pname
, GLint
*params
)
455 struct gl_program
*shader
= _mesa_lookup_shader(ctx
, name
);
458 _mesa_error(ctx
, GL_INVALID_VALUE
, "glGetShaderiv(shader)");
462 struct gl_shader
*shader
;
466 *params
= shader
->Type
;
468 case GL_DELETE_STATUS
:
469 *params
= shader
->DeletePending
;
471 case GL_COMPILE_STATUS
:
472 *params
= shader
->CompileStatus
;
474 case GL_INFO_LOG_LENGTH
:
475 *params
= shader
->InfoLog
? strlen(shader
->InfoLog
) : 0;
477 case GL_SHADER_SOURCE_LENGTH
:
478 *params
= shader
->Source
? strlen((char *) shader
->Source
) : 0;
481 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetShaderiv(pname)");
488 _mesa_get_program_info_log(GLcontext
*ctx
, GLuint program
, GLsizei bufSize
,
489 GLsizei
*length
, GLchar
*infoLog
)
491 struct gl_linked_program
*linked
492 = _mesa_lookup_linked_program(ctx
, program
);
494 _mesa_error(ctx
, GL_INVALID_VALUE
, "glGetProgramInfoLog(program)");
497 /* XXX also test length, infoLog params for NULL? */
498 copy_string(linked
->InfoLog
, bufSize
, length
, infoLog
);
503 _mesa_get_shader_info_log(GLcontext
*ctx
, GLuint shader
, GLsizei bufSize
,
504 GLsizei
*length
, GLchar
*infoLog
)
506 struct gl_program
*shProg
= _mesa_lookup_shader(ctx
, shader
);
508 _mesa_error(ctx
, GL_INVALID_VALUE
, "glGetShaderInfoLog(shader)");
512 copy_string(shProg->InfoLog, bufSize, length, infoLog);
518 * Called via ctx->Driver.GetShaderSource().
521 _mesa_get_shader_source(GLcontext
*ctx
, GLuint shader
, GLsizei maxLength
,
522 GLsizei
*length
, GLchar
*sourceOut
)
524 struct gl_program
*shProg
= _mesa_lookup_shader(ctx
, shader
);
526 _mesa_error(ctx
, GL_INVALID_VALUE
, "glGetShaderSource(shader)");
529 copy_string((GLchar
*) shProg
->String
, maxLength
, length
, sourceOut
);
534 * Called via ctx->Driver.GetUniformfv().
537 _mesa_get_uniformfv(GLcontext
*ctx
, GLuint program
, GLint location
,
540 struct gl_linked_program
*linked
541 = _mesa_lookup_linked_program(ctx
, program
);
544 if (location
>= 0 && location
< linked
->Uniforms
->NumParameters
) {
545 for (i
= 0; i
< linked
->Uniforms
->Parameters
[location
].Size
; i
++) {
546 params
[i
] = linked
->Uniforms
->ParameterValues
[location
][i
];
550 _mesa_error(ctx
, GL_INVALID_VALUE
, "glGetUniformfv(location)");
554 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glGetUniformfv(program)");
560 * Called via ctx->Driver.GetUniformLocation().
563 _mesa_get_uniform_location(GLcontext
*ctx
, GLuint program
, const GLchar
*name
)
565 if (ctx
->Shader
.CurrentProgram
) {
566 const struct gl_linked_program
*linked
= ctx
->Shader
.CurrentProgram
;
568 for (loc
= 0; loc
< linked
->Uniforms
->NumParameters
; loc
++) {
569 const struct gl_program_parameter
*u
570 = linked
->Uniforms
->Parameters
+ loc
;
571 if (u
->Type
== PROGRAM_UNIFORM
&& !strcmp(u
->Name
, name
)) {
582 _mesa_is_program(GLcontext
*ctx
, GLuint name
)
584 struct gl_linked_program
*linked
= _mesa_lookup_linked_program(ctx
, name
);
585 return linked
? GL_TRUE
: GL_FALSE
;
590 _mesa_is_shader(GLcontext
*ctx
, GLuint name
)
592 struct gl_program
*shader
= _mesa_lookup_shader(ctx
, name
);
593 return shader
? GL_TRUE
: GL_FALSE
;
599 * Called via ctx->Driver.ShaderSource()
602 _mesa_shader_source(GLcontext
*ctx
, GLuint shader
, const GLchar
*source
)
604 struct gl_program
*shProg
= _mesa_lookup_shader(ctx
, shader
);
606 _mesa_error(ctx
, GL_INVALID_VALUE
, "glShaderSource(shaderObj)");
610 /* free old shader source string and install new one */
611 if (shProg
->String
) {
612 _mesa_free(shProg
->String
);
614 shProg
->String
= (GLubyte
*) source
;
619 * Called via ctx->Driver.CompileShader()
622 _mesa_compile_shader(GLcontext
*ctx
, GLuint shaderObj
)
624 struct gl_program
*prog
= _mesa_lookup_shader(ctx
, shaderObj
);
625 slang_info_log info_log
;
626 slang_code_object obj
;
627 slang_unit_type type
;
630 _mesa_error(ctx
, GL_INVALID_VALUE
, "glCompileShader(shaderObj)");
634 slang_info_log_construct(&info_log
);
635 _slang_code_object_ctr(&obj
);
637 if (prog
->Target
== GL_VERTEX_PROGRAM_ARB
) {
638 type
= slang_unit_vertex_shader
;
641 assert(prog
->Target
== GL_FRAGMENT_PROGRAM_ARB
);
642 type
= slang_unit_fragment_shader
;
645 if (_slang_compile((const char*) prog
->String
, &obj
,
646 type
, &info_log
, prog
)) {
648 prog->CompileStatus = GL_TRUE;
653 prog->CompileStatus = GL_FALSE;
655 _mesa_problem(ctx
, "Program did not compile!");
661 * Called via ctx->Driver.LinkProgram()
664 _mesa_link_program(GLcontext
*ctx
, GLuint program
)
666 struct gl_linked_program
*linked
;
668 linked
= _mesa_lookup_linked_program(ctx
, program
);
670 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glLinkProgram(program)");
674 _slang_link2(ctx
, program
, linked
);
679 * Called via ctx->Driver.UseProgram()
682 _mesa_use_program(GLcontext
*ctx
, GLuint program
)
684 /* XXXX need to handle reference counting here! */
686 struct gl_linked_program
*linked
;
687 linked
= _mesa_lookup_linked_program(ctx
, program
);
689 _mesa_error(ctx
, GL_INVALID_OPERATION
,
690 "glUseProgramObjectARB(programObj)");
693 ctx
->Shader
.CurrentProgram
= linked
;
696 /* don't use a shader program */
697 ctx
->Shader
.CurrentProgram
= NULL
;
703 * Called via ctx->Driver.Uniform().
706 _mesa_uniform(GLcontext
*ctx
, GLint location
, GLsizei count
,
707 const GLvoid
*values
, GLenum type
)
709 if (ctx
->Shader
.CurrentProgram
) {
710 struct gl_linked_program
*linked
= ctx
->Shader
.CurrentProgram
;
711 if (location
>= 0 && location
< linked
->Uniforms
->NumParameters
) {
712 GLfloat
*v
= linked
->Uniforms
->ParameterValues
[location
];
713 const GLfloat
*fValues
= (const GLfloat
*) values
; /* XXX */
715 if (type
== GL_FLOAT_VEC4
)
717 else if (type
== GL_FLOAT_VEC3
)
722 for (i
= 0; i
< count
; i
++)
728 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glUniform(program not linked)");
734 * Called by ctx->Driver.UniformMatrix().
737 _mesa_uniform_matrix(GLcontext
*ctx
, GLint cols
, GLint rows
,
738 GLenum matrixType
, GLint location
, GLsizei count
,
739 GLboolean transpose
, const GLfloat
*values
)
741 const char *caller
= "glUniformMatrix";
742 const GLint matElements
= rows
* cols
;
744 if (values
== NULL
) {
745 _mesa_error(ctx
, GL_INVALID_VALUE
, caller
);
749 FLUSH_VERTICES(ctx
, _NEW_PROGRAM
);
756 trans
= (GLfloat
*) _mesa_malloc(count
* matElements
* sizeof(GLfloat
));
758 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, caller
);
764 for (i
= 0; i
< count
; i
++) {
765 /* transpose from pv matrix into pt matrix */
766 for (j
= 0; j
< cols
; j
++) {
767 for (k
= 0; k
< rows
; k
++) {
768 /* XXX verify this */
769 pt
[j
* rows
+ k
] = pv
[k
* cols
+ j
];
777 if (!(**pro
).WriteUniform(pro
, location
, count
, trans
, matrixType
))
778 _mesa_error(ctx
, GL_INVALID_OPERATION
, caller
);
784 if (!(**pro
).WriteUniform(pro
, location
, count
, values
, matrixType
))
785 _mesa_error(ctx
, GL_INVALID_OPERATION
, caller
);
792 _mesa_validate_program(GLcontext
*ctx
, GLuint program
)
794 struct gl_linked_program
*linked
;
795 linked
= _mesa_lookup_linked_program(ctx
, program
);
797 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glValidateProgram(program)");
801 linked
->Validated
= GL_TRUE
;
804 any two active samplers in the current program object are of
805 different types, but refer to the same texture image unit,
807 any active sampler in the current program object refers to a texture
808 image unit where fixed-function fragment processing accesses a
809 texture target that does not match the sampler type, or
811 the sum of the number of active samplers in the program and the
812 number of texture image units enabled for fixed-function fragment
813 processing exceeds the combined limit on the total number of texture
820 /**********************************************************************/
824 * Create a new GLSL program object.
826 struct gl_linked_program
*
827 _mesa_new_linked_program(GLcontext
*ctx
, GLuint name
)
829 struct gl_linked_program
*linked
;
830 linked
= CALLOC_STRUCT(gl_linked_program
);
839 _mesa_free_linked_program_data(GLcontext
*ctx
,
840 struct gl_linked_program
*linked
)
842 if (linked
->VertexProgram
) {
843 if (linked
->VertexProgram
->Base
.Parameters
== linked
->Uniforms
) {
844 /* to prevent a double-free in the next call */
845 linked
->VertexProgram
->Base
.Parameters
= NULL
;
847 _mesa_delete_program(ctx
, &linked
->VertexProgram
->Base
);
848 linked
->VertexProgram
= NULL
;
851 if (linked
->FragmentProgram
) {
852 if (linked
->FragmentProgram
->Base
.Parameters
== linked
->Uniforms
) {
853 /* to prevent a double-free in the next call */
854 linked
->FragmentProgram
->Base
.Parameters
= NULL
;
856 _mesa_delete_program(ctx
, &linked
->FragmentProgram
->Base
);
857 linked
->FragmentProgram
= NULL
;
861 if (linked
->Uniforms
) {
862 _mesa_free_parameter_list(linked
->Uniforms
);
863 linked
->Uniforms
= NULL
;
866 if (linked
->Varying
) {
867 _mesa_free_parameter_list(linked
->Varying
);
868 linked
->Varying
= NULL
;
875 _mesa_delete_linked_program(GLcontext
*ctx
, struct gl_linked_program
*linked
)
877 _mesa_free_linked_program_data(ctx
, linked
);
883 * Lookup a GLSL program object.
885 struct gl_linked_program
*
886 _mesa_lookup_linked_program(GLcontext
*ctx
, GLuint name
)
889 return (struct gl_linked_program
*)
890 _mesa_HashLookup(ctx
->Shared
->ProgramObjects
, name
);
897 _mesa_new_shader(GLcontext
*ctx
, GLuint name
, GLenum type
)
899 struct gl_shader
*shader
;
900 assert(type
== GL_FRAGMENT_SHADER
|| type
== GL_VERTEX_SHADER
);
901 shader
= CALLOC_STRUCT(gl_shader
);
911 * Lookup a GLSL shader object.
914 _mesa_lookup_shader(GLcontext
*ctx
, GLuint name
)
917 return (struct gl_program
*)
918 _mesa_HashLookup(ctx
->Shared
->ShaderObjects
, name
);
925 _mesa_init_shader_state(GLcontext
* ctx
)
927 ctx
->Shader
._FragmentShaderPresent
= GL_FALSE
;
928 ctx
->Shader
._VertexShaderPresent
= GL_FALSE
;