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/drivers | |
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/drivers')
-rw-r--r-- | src/mesa/drivers/common/meta.c | 30 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_fs.cpp | 6 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_wm_state.c | 4 |
3 files changed, 29 insertions, 11 deletions
diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c index 9946bf19900..1bfd76a665d 100644 --- a/src/mesa/drivers/common/meta.c +++ b/src/mesa/drivers/common/meta.c @@ -143,7 +143,10 @@ struct save_state struct gl_vertex_program *VertexProgram; GLboolean FragmentProgramEnabled; struct gl_fragment_program *FragmentProgram; - GLuint Shader; + GLuint VertexShader; + GLuint GeometryShader; + GLuint FragmentShader; + GLuint ActiveShader; /** META_STENCIL_TEST */ struct gl_stencil_attrib Stencil; @@ -433,8 +436,15 @@ _mesa_meta_begin(struct gl_context *ctx, GLbitfield state) } if (ctx->Extensions.ARB_shader_objects) { - save->Shader = ctx->Shader.CurrentProgram ? - ctx->Shader.CurrentProgram->Name : 0; + save->VertexShader = ctx->Shader.CurrentVertexProgram ? + ctx->Shader.CurrentVertexProgram->Name : 0; + save->GeometryShader = ctx->Shader.CurrentGeometryProgram ? + ctx->Shader.CurrentGeometryProgram->Name : 0; + save->FragmentShader = ctx->Shader.CurrentFragmentProgram ? + ctx->Shader.CurrentFragmentProgram->Name : 0; + save->ActiveShader = ctx->Shader.ActiveProgram ? + ctx->Shader.ActiveProgram->Name : 0; + _mesa_UseProgramObjectARB(0); } } @@ -664,9 +674,17 @@ _mesa_meta_end(struct gl_context *ctx) _mesa_reference_fragprog(ctx, &save->FragmentProgram, NULL); } - if (ctx->Extensions.ARB_shader_objects) { - _mesa_UseProgramObjectARB(save->Shader); - } + if (ctx->Extensions.ARB_vertex_shader) + _mesa_UseShaderProgramEXT(GL_VERTEX_SHADER, save->VertexShader); + + if (ctx->Extensions.ARB_geometry_shader4) + _mesa_UseShaderProgramEXT(GL_GEOMETRY_SHADER_ARB, + save->GeometryShader); + + if (ctx->Extensions.ARB_fragment_shader) + _mesa_UseShaderProgramEXT(GL_FRAGMENT_SHADER, save->FragmentShader); + + _mesa_ActiveProgramEXT(save->ActiveShader); } if (state & META_STENCIL_TEST) { diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index 4919394bc82..5f6deb841cd 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -1186,7 +1186,7 @@ fs_visitor::visit(ir_texture *ir) assert(!ir->projector); sampler = _mesa_get_sampler_uniform_value(ir->sampler, - ctx->Shader.CurrentProgram, + ctx->Shader.CurrentFragmentProgram, &brw->fragment_program->Base); sampler = c->fp->program.Base.SamplerUnits[sampler]; @@ -3093,7 +3093,7 @@ fs_visitor::generate_code() if (INTEL_DEBUG & DEBUG_WM) { printf("Native code for fragment shader %d:\n", - ctx->Shader.CurrentProgram->Name); + ctx->Shader.CurrentFragmentProgram->Name); } if_depth_in_loop[loop_stack_depth] = 0; @@ -3320,7 +3320,7 @@ brw_wm_fs_emit(struct brw_context *brw, struct brw_wm_compile *c) { struct intel_context *intel = &brw->intel; struct gl_context *ctx = &intel->ctx; - struct gl_shader_program *prog = ctx->Shader.CurrentProgram; + struct gl_shader_program *prog = ctx->Shader.CurrentFragmentProgram; if (!prog) return GL_FALSE; diff --git a/src/mesa/drivers/dri/i965/brw_wm_state.c b/src/mesa/drivers/dri/i965/brw_wm_state.c index 433ccc66f06..9a27b937103 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_state.c +++ b/src/mesa/drivers/dri/i965/brw_wm_state.c @@ -137,9 +137,9 @@ wm_unit_populate_key(struct brw_context *brw, struct brw_wm_unit_key *key) /* If using the fragment shader backend, the program is always * 8-wide. */ - if (ctx->Shader.CurrentProgram) { + if (ctx->Shader.CurrentFragmentProgram) { struct brw_shader *shader = (struct brw_shader *) - ctx->Shader.CurrentProgram->_LinkedShaders[MESA_SHADER_FRAGMENT]; + ctx->Shader.CurrentFragmentProgram->_LinkedShaders[MESA_SHADER_FRAGMENT]; if (shader != NULL && shader->ir != NULL) { key->is_glsl = GL_TRUE; |