diff options
author | Ian Romanick <[email protected]> | 2010-10-13 13:58:44 -0700 |
---|---|---|
committer | Ian Romanick <[email protected]> | 2010-10-27 13:35:53 -0700 |
commit | 84eba3ef71dfa822e5ff0463032cdd2e3515b888 (patch) | |
tree | dc737eed47f4e7ec35581a1ec9daf598765cb978 /src/mesa/state_tracker | |
parent | 75c6f472880706dcbb9d1e20727fa8f71db8b11c (diff) |
Track separate programs for each stage
The assumption is that all stages are the same program or that
varyings are passed between stages using built-in varyings.
Diffstat (limited to 'src/mesa/state_tracker')
-rw-r--r-- | src/mesa/state_tracker/st_atom_rasterizer.c | 5 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_draw.c | 20 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_program.c | 38 |
3 files changed, 49 insertions, 14 deletions
diff --git a/src/mesa/state_tracker/st_atom_rasterizer.c b/src/mesa/state_tracker/st_atom_rasterizer.c index 451299cef0c..f92ca13d5e4 100644 --- a/src/mesa/state_tracker/st_atom_rasterizer.c +++ b/src/mesa/state_tracker/st_atom_rasterizer.c @@ -96,9 +96,8 @@ static void update_raster_state( struct st_context *st ) */ if (ctx->VertexProgram._Current) { if (ctx->VertexProgram._Enabled || - (ctx->Shader.CurrentProgram && - ctx->Shader.CurrentProgram->VertexProgram && - ctx->Shader.CurrentProgram->LinkStatus)) { + (ctx->Shader.CurrentVertexProgram && + ctx->Shader.CurrentVertexProgram->LinkStatus)) { /* user-defined vertex program or shader */ raster->light_twoside = ctx->VertexProgram.TwoSideEnabled; } diff --git a/src/mesa/state_tracker/st_draw.c b/src/mesa/state_tracker/st_draw.c index 5387499eb94..61a0e1b0877 100644 --- a/src/mesa/state_tracker/st_draw.c +++ b/src/mesa/state_tracker/st_draw.c @@ -547,11 +547,21 @@ setup_index_buffer(struct gl_context *ctx, static void check_uniforms(struct gl_context *ctx) { - const struct gl_shader_program *shProg = ctx->Shader.CurrentProgram; - if (shProg && shProg->LinkStatus) { - GLuint i; - for (i = 0; i < shProg->Uniforms->NumUniforms; i++) { - const struct gl_uniform *u = &shProg->Uniforms->Uniforms[i]; + struct gl_shader_program *shProg[3] = { + ctx->Shader.CurrentVertexProgram, + ctx->Shader.CurrentGeometryProgram, + ctx->Shader.CurrentFragmentProgram, + }; + unsigned j; + + for (j = 0; j < 3; j++) { + unsigned i; + + if (shProg[j] == NULL || !shProg[j]->LinkStatus) + continue; + + for (i = 0; i < shProg[j]->Uniforms->NumUniforms; i++) { + const struct gl_uniform *u = &shProg[j]->Uniforms->Uniforms[i]; if (!u->Initialized) { _mesa_warning(ctx, "Using shader with uninitialized uniform: %s", diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c index 95e6bd7dac2..6a5d741b61b 100644 --- a/src/mesa/state_tracker/st_program.c +++ b/src/mesa/state_tracker/st_program.c @@ -718,12 +718,38 @@ st_translate_geometry_program(struct st_context *st, void st_print_shaders(struct gl_context *ctx) { - struct gl_shader_program *shProg = ctx->Shader.CurrentProgram; - if (shProg) { - GLuint i; - for (i = 0; i < shProg->NumShaders; i++) { - printf("GLSL shader %u of %u:\n", i, shProg->NumShaders); - printf("%s\n", shProg->Shaders[i]->Source); + struct gl_shader_program *shProg[3] = { + ctx->Shader.CurrentVertexProgram, + ctx->Shader.CurrentGeometryProgram, + ctx->Shader.CurrentFragmentProgram, + }; + unsigned j; + + for (j = 0; j < 3; j++) { + unsigned i; + + if (shProg[j] == NULL) + continue; + + for (i = 0; i < shProg[j]->NumShaders; i++) { + struct gl_shader *sh; + + switch (shProg[j]->Shaders[i]->Type) { + case GL_VERTEX_SHADER: + sh = (i != 0) ? NULL : shProg[j]->Shaders[i]; + break; + case GL_GEOMETRY_SHADER_ARB: + sh = (i != 1) ? NULL : shProg[j]->Shaders[i]; + break; + case GL_FRAGMENT_SHADER: + sh = (i != 2) ? NULL : shProg[j]->Shaders[i]; + break; + } + + if (sh != NULL) { + printf("GLSL shader %u of %u:\n", i, shProg[j]->NumShaders); + printf("%s\n", sh->Source); + } } } } |