diff options
Diffstat (limited to 'src/mesa/drivers')
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_fs.cpp | 17 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_program.c | 12 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_wm_state.c | 13 |
3 files changed, 12 insertions, 30 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index 41cb9a3be4..4745b87f13 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -91,10 +91,9 @@ brw_link_shader(struct gl_context *ctx, struct gl_shader_program *prog) { struct intel_context *intel = intel_context(ctx); - for (unsigned i = 0; i < prog->_NumLinkedShaders; i++) { - struct brw_shader *shader = (struct brw_shader *)prog->_LinkedShaders[i]; - - if (shader->base.Type == GL_FRAGMENT_SHADER) { + struct brw_shader *shader = + (struct brw_shader *)prog->_LinkedShaders[MESA_SHADER_FRAGMENT]; + if (shader != NULL) { void *mem_ctx = talloc_new(NULL); bool progress; @@ -142,7 +141,6 @@ brw_link_shader(struct gl_context *ctx, struct gl_shader_program *prog) reparent_ir(shader->ir, shader->ir); talloc_free(mem_ctx); - } } if (!_mesa_ir_link_shader(ctx, prog)) @@ -3182,18 +3180,13 @@ brw_wm_fs_emit(struct brw_context *brw, struct brw_wm_compile *c) struct brw_compile *p = &c->func; struct intel_context *intel = &brw->intel; struct gl_context *ctx = &intel->ctx; - struct brw_shader *shader = NULL; struct gl_shader_program *prog = ctx->Shader.CurrentProgram; if (!prog) return GL_FALSE; - for (unsigned int i = 0; i < prog->_NumLinkedShaders; i++) { - if (prog->_LinkedShaders[i]->Type == GL_FRAGMENT_SHADER) { - shader = (struct brw_shader *)prog->_LinkedShaders[i]; - break; - } - } + struct brw_shader *shader = + (brw_shader *) prog->_LinkedShaders[MESA_SHADER_FRAGMENT]; if (!shader) return GL_FALSE; diff --git a/src/mesa/drivers/dri/i965/brw_program.c b/src/mesa/drivers/dri/i965/brw_program.c index 8bc255a1c0..1367d81469 100644 --- a/src/mesa/drivers/dri/i965/brw_program.c +++ b/src/mesa/drivers/dri/i965/brw_program.c @@ -148,15 +148,9 @@ static GLboolean brwProgramStringNotify( struct gl_context *ctx, * using the new FS backend. */ shader_program = _mesa_lookup_shader_program(ctx, prog->Id); - if (shader_program) { - for (i = 0; i < shader_program->_NumLinkedShaders; i++) { - struct brw_shader *shader; - - shader = (struct brw_shader *)shader_program->_LinkedShaders[i]; - if (shader->base.Type == GL_FRAGMENT_SHADER && shader->ir) { - return GL_TRUE; - } - } + if (shader_program + && shader_program->_LinkedShaders[MESA_SHADER_FRAGMENT]) { + return GL_TRUE; } } else if (target == GL_VERTEX_PROGRAM_ARB) { diff --git a/src/mesa/drivers/dri/i965/brw_wm_state.c b/src/mesa/drivers/dri/i965/brw_wm_state.c index 8cadedadfd..817adefb0c 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_state.c +++ b/src/mesa/drivers/dri/i965/brw_wm_state.c @@ -108,16 +108,11 @@ wm_unit_populate_key(struct brw_context *brw, struct brw_wm_unit_key *key) * 8-wide. */ if (ctx->Shader.CurrentProgram) { - int i; + struct brw_shader *shader = (struct brw_shader *) + ctx->Shader.CurrentProgram->_LinkedShaders[MESA_SHADER_FRAGMENT]; - for (i = 0; i < ctx->Shader.CurrentProgram->_NumLinkedShaders; i++) { - struct brw_shader *shader = - (struct brw_shader *)ctx->Shader.CurrentProgram->_LinkedShaders[i];; - - if (shader->base.Type == GL_FRAGMENT_SHADER && - shader->ir != NULL) { - key->is_glsl = GL_TRUE; - } + if (shader != NULL && shader->ir != NULL) { + key->is_glsl = GL_TRUE; } } |