summaryrefslogtreecommitdiff
path: root/src/mesa/main/context.c
diff options
context:
space:
mode:
authorIan Romanick <ian.d.romanick@intel.com>2010-10-14 13:28:42 -0700
committerIan Romanick <ian.d.romanick@intel.com>2010-10-14 17:16:59 -0700
commit3322fbaf3b5e305ce00c1d08c26965bb98e0cef0 (patch)
tree30aba427f916748177148fb74e495619c527e8a6 /src/mesa/main/context.c
parent4b4284c9c9b472f750663352485290c22f8c3921 (diff)
glsl: Slightly change the semantic of _LinkedShaders
Previously _LinkedShaders was a compact array of the linked shaders for each shader stage. Now it is arranged such that each slot, indexed by the MESA_SHADER_* defines, refers to a specific shader stage. As a result, some slots will be NULL. This makes things a little more complex in the linker, but it simplifies things in other places. As a side effect _NumLinkedShaders is removed. NOTE: This may be a candidate for the 7.9 branch. If there are other patches that get backported to 7.9 that use _LinkedShader, this patch should be cherry picked also.
Diffstat (limited to 'src/mesa/main/context.c')
-rw-r--r--src/mesa/main/context.c22
1 files changed, 10 insertions, 12 deletions
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index 10166ae5a2..1625e4c501 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -1702,10 +1702,10 @@ _mesa_valid_to_render(struct gl_context *ctx, const char *where)
_mesa_update_state(ctx);
if (ctx->Shader.CurrentProgram) {
- unsigned i;
+ struct gl_shader_program *const prog = ctx->Shader.CurrentProgram;
/* using shaders */
- if (!ctx->Shader.CurrentProgram->LinkStatus) {
+ if (!prog->LinkStatus) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"%s(shader not linked)", where);
return GL_FALSE;
@@ -1713,10 +1713,9 @@ _mesa_valid_to_render(struct gl_context *ctx, const char *where)
#if 0 /* not normally enabled */
{
char errMsg[100];
- if (!_mesa_validate_shader_program(ctx, ctx->Shader.CurrentProgram,
- errMsg)) {
+ if (!_mesa_validate_shader_program(ctx, prog, errMsg)) {
_mesa_warning(ctx, "Shader program %u is invalid: %s",
- ctx->Shader.CurrentProgram->Name, errMsg);
+ prog->Name, errMsg);
}
}
#endif
@@ -1725,13 +1724,12 @@ _mesa_valid_to_render(struct gl_context *ctx, const char *where)
* any stages that are not provided, the corresponding assembly shader
* target will be validated below.
*/
- for (i = 0; i < ctx->Shader.CurrentProgram->_NumLinkedShaders; i++) {
- switch (ctx->Shader.CurrentProgram->_LinkedShaders[i]->Type) {
- case GL_VERTEX_SHADER: vert_from_glsl_shader = true; break;
- case GL_GEOMETRY_SHADER_ARB: geom_from_glsl_shader = true; break;
- case GL_FRAGMENT_SHADER: frag_from_glsl_shader = true; break;
- }
- }
+ vert_from_glsl_shader =
+ prog->_LinkedShaders[MESA_SHADER_VERTEX] != NULL;
+ geom_from_glsl_shader =
+ prog->_LinkedShaders[MESA_SHADER_GEOMETRY] != NULL;
+ frag_from_glsl_shader =
+ prog->_LinkedShaders[MESA_SHADER_FRAGMENT] != NULL;
}