[Mesa-dev] [PATCH 13/14] i965: Don't use _mesa_ir_link_shader to do our dirty work

Eric Anholt eric at anholt.net
Mon Jan 9 17:49:09 PST 2012


On Fri,  6 Jan 2012 16:50:04 -0800, "Ian Romanick" <idr at freedesktop.org> wrote:
> From: Ian Romanick <ian.d.romanick at intel.com>
> 
> Instead, do the uniform setting and input / output mapping directly in
> brw_link_shader.  Hurray for not generating Mesa IR!
> 
> Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
> ---
>  src/mesa/drivers/dri/i965/brw_shader.cpp |   60 +++++++++++++++++++++++++++---
>  1 files changed, 54 insertions(+), 6 deletions(-)
> 
> diff --git a/src/mesa/drivers/dri/i965/brw_shader.cpp b/src/mesa/drivers/dri/i965/brw_shader.cpp
> index fa325ba..f32f045 100644
> --- a/src/mesa/drivers/dri/i965/brw_shader.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_shader.cpp

> +      /* Make a pass over the IR to add state references for any built-in
> +       * uniforms that are used.  This has to be done now (during linking).
> +       * Code generation doesn't happen until the first time this shader is
> +       * used for rendering.  Waiting until then to generate the parameters is
> +       * too late.  At that point, the values for the built-in informs won't
> +       * get sent to the shader.
> +       */

I actually can't find how that is too late -- compile happens before we
decide on how to upload parameters (obviously), so it must be that the
NEW_PROGRAM_CONSTANTS flag (set by mesa core) is not set.  Mesa core
appears to set it when any program uniform is changed and when programs
are bound.  I guess the exception I haven't found is that when programs
are relinked, we don't flag it.  That looks like a bug to me.

On the other hand, this seems like a totally reasonable and appropriate
place to be doing this work rather than per-recompile.

I haven't actually reviewed that this is the set of work necessary for
this code, but I'm fine with this in principle, at least.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20120109/03dad018/attachment.pgp>


More information about the mesa-dev mailing list