Lines Matching full:shader
56 /** Define this to enable shader substitution (see below) */
95 * Initialize context's shader state.
116 ctx->Shader.Flags = get_shader_flags();
121 * Free the per-context shader-related state.
126 _mesa_reference_shader_program(ctx, &ctx->Shader.CurrentVertexProgram, NULL);
127 _mesa_reference_shader_program(ctx, &ctx->Shader.CurrentGeometryProgram,
129 _mesa_reference_shader_program(ctx, &ctx->Shader.CurrentFragmentProgram,
131 _mesa_reference_shader_program(ctx, &ctx->Shader._CurrentFragmentProgram,
133 _mesa_reference_shader_program(ctx, &ctx->Shader.ActiveProgram, NULL);
161 * Confirm that the a shader type is valid and supported by the implementation
164 * \param type Shader target
200 struct gl_shader *shader = _mesa_lookup_shader(ctx, name);
201 return shader ? GL_TRUE : GL_FALSE;
206 * Attach shader to a shader program.
209 attach_shader(struct gl_context *ctx, GLuint program, GLuint shader)
219 sh = _mesa_lookup_shader_err(ctx, shader, "glAttachShader");
227 /* The shader is already attched to this program. The
301 * texture objects (and buffer objects, etc). Shader/program
323 delete_shader(struct gl_context *ctx, GLuint shader)
327 sh = _mesa_lookup_shader_err(ctx, shader, "glDeleteShader");
341 detach_shader(struct gl_context *ctx, GLuint program, GLuint shader)
354 if (shProg->Shaders[i]->Name == shader) {
396 if (is_shader(ctx, shader))
398 else if (is_program(ctx, shader))
402 _mesa_error(ctx, err, "glDetachProgram(shader)");
409 * Return list of shaders attached to shader program.
429 * glGetHandleARB() - return ID/name of currently bound shader program.
435 if (ctx->Shader.ActiveProgram)
436 return ctx->Shader.ActiveProgram->Name;
448 * glGetProgramiv() - get shader program state.
449 * Note that this is for GLSL shader programs, not ARB vertex/fragment
609 * glGetShaderiv() - get GLSL shader state
614 struct gl_shader *shader =
617 if (!shader) {
623 *params = shader->Type;
626 *params = shader->DeletePending;
629 shader->CompileStatus;
632 *params = shader->InfoLog ? strlen(shader->InfoLog) + 1 : 0;
635 *params = shader->Source ? strlen((char *) shader->Source) + 1 : 0;
659 get_shader_info_log(struct gl_context *ctx, GLuint shader, GLsizei bufSize,
662 struct gl_shader *sh = _mesa_lookup_shader(ctx, shader);
664 _mesa_error(ctx, GL_INVALID_VALUE, "glGetShaderInfoLog(shader)");
672 * Return shader source code.
675 get_shader_source(struct gl_context *ctx, GLuint shader, GLsizei maxLength,
679 sh = _mesa_lookup_shader_err(ctx, shader, "glGetShaderSource");
688 * Set/replace shader source code. A helper function used by
692 shader_source(struct gl_context *ctx, GLuint shader, const GLchar *source)
696 sh = _mesa_lookup_shader_err(ctx, shader, "glShaderSource");
700 /* free old shader source string and install new one */
713 * Compile a shader.
727 /* set default pragma state for shader */
736 (ctx->Shader.Flags & GLSL_REPORT_ERRORS)) {
737 _mesa_debug(ctx, "Error compiling shader %u:\n%s\n",
758 && (shProg == ctx->Shader.CurrentVertexProgram
759 || shProg == ctx->Shader.CurrentGeometryProgram
760 || shProg == ctx->Shader.CurrentFragmentProgram)) {
771 (ctx->Shader.Flags & GLSL_REPORT_ERRORS)) {
785 printf(" shader %u, type 0x%x\n",
794 * Print basic shader info (for debug).
817 printf(" %s shader %u, checksum %u\n", s,
834 * Use the named shader program for subsequent glUniform calls
846 if (ctx->Shader.ActiveProgram != shProg) {
847 _mesa_reference_shader_program(ctx, &ctx->Shader.ActiveProgram, shProg);
862 target = &ctx->Shader.CurrentVertexProgram;
871 target = &ctx->Shader.CurrentGeometryProgram;
880 target = &ctx->Shader.CurrentFragmentProgram;
894 /* If the shader is also bound as the current rendering shader, unbind
911 if (*target == ctx->Shader._CurrentFragmentProgram) {
913 &ctx->Shader._CurrentFragmentProgram,
928 * Use the named shader program for subsequent rendering.
944 * Do validation of the given shader program.
1010 _mesa_AttachObjectARB(GLhandleARB program, GLhandleARB shader)
1013 attach_shader(ctx, program, shader);
1018 _mesa_AttachShader(GLuint program, GLuint shader)
1021 attach_shader(ctx, program, shader);
1118 _mesa_DetachObjectARB(GLhandleARB program, GLhandleARB shader)
1121 detach_shader(ctx, program, shader);
1126 _mesa_DetachShader(GLuint program, GLuint shader)
1129 detach_shader(ctx, program, shader);
1214 _mesa_GetShaderiv(GLuint shader, GLenum pname, GLint *params)
1217 get_shaderiv(ctx, shader, pname, params);
1231 _mesa_GetShaderInfoLog(GLuint shader, GLsizei bufSize,
1235 get_shader_info_log(ctx, shader, bufSize, length, infoLog);
1240 _mesa_GetShaderSourceARB(GLhandleARB shader, GLsizei maxLength,
1244 get_shader_source(ctx, shader, maxLength, length, sourceOut);
1282 * Read shader source code from a file.
1283 * Useful for debugging to override an app's shader.
1290 GLcharARB *buffer, *shader;
1303 shader = _mesa_strdup(buffer);
1306 return shader;
1377 /* Compute the shader's source code checksum then try to open a file
1379 * original shader source code. For debugging.
1390 fprintf(stderr, "Mesa: Replacing shader %u chksum=%d with %s\n",
1437 if (ctx->Shader.Flags & GLSL_USE_PROG) {
1672 const GLuint shader = create_shader(ctx, type);
1675 if (shader) {
1676 shader_source(ctx, shader, _mesa_strdup(string));
1677 compile_shader(ctx, shader);
1686 sh = _mesa_lookup_shader(ctx, shader);
1688 get_shaderiv(ctx, shader, GL_COMPILE_STATUS, &compiled);
1690 attach_shader(ctx, program, shader);
1692 detach_shader(ctx, program, shader);
1706 delete_shader(ctx, shader);
1713 * Plug in shader-related functions into API dispatch table.