From: Ian Romanick Date: Mon, 24 Oct 2011 23:37:01 +0000 (-0700) Subject: i965: Move _mesa_ir_link_shader call before device-specific linking X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=143d20c16a33e2f08e834b28c23dbea772591ef9;p=mesa.git i965: Move _mesa_ir_link_shader call before device-specific linking _mesa_ir_link_shader needs to be called before cloning the IR tree so that the var->location field for uniforms is set. WARNING: This change breaks several integer division related piglit tests. The tests break because _mesa_ir_link_shader lowers integer division to an RCP followed by a MUL. The fix is to factor out more of the code from ir_to_mesa so that _mesa_ir_link_shader does not need to be called at all by the i965 driver. This will be the subject of several follow-on patches. Signed-off-by: Ian Romanick Tested-by: Tom Stellard --- diff --git a/src/mesa/drivers/dri/i965/brw_shader.cpp b/src/mesa/drivers/dri/i965/brw_shader.cpp index d9d9414543d..7679b6eb31a 100644 --- a/src/mesa/drivers/dri/i965/brw_shader.cpp +++ b/src/mesa/drivers/dri/i965/brw_shader.cpp @@ -81,6 +81,9 @@ brw_link_shader(struct gl_context *ctx, struct gl_shader_program *prog) struct intel_context *intel = &brw->intel; unsigned int stage; + if (!_mesa_ir_link_shader(ctx, prog)) + return false; + for (stage = 0; stage < ARRAY_SIZE(prog->_LinkedShaders); stage++) { struct brw_shader *shader = (struct brw_shader *)prog->_LinkedShaders[stage]; @@ -148,9 +151,6 @@ brw_link_shader(struct gl_context *ctx, struct gl_shader_program *prog) ralloc_free(mem_ctx); } - if (!_mesa_ir_link_shader(ctx, prog)) - return false; - if (!brw_shader_precompile(ctx, prog)) return false;