On Mon, 11 Apr 2011 12:59:12 -0700, Kenneth Graunke <kenn...@whitecape.org> 
wrote:
> On 04/09/2011 10:17 PM, Eric Anholt wrote:
> > The specs only say that they have to be a constant expression, which
> > would allow things like builtin function calls that generate
> > instructions as a side effect of their parsing.
> >
> > Fixes the fixed array-size-constant-relational.vert.
> > ---
> >   src/glsl/ast.h            |    2 +-
> >   src/glsl/ast_function.cpp |    3 ++-
> >   src/glsl/ast_to_hir.cpp   |   34 ++++++++++++++++++----------------
> >   3 files changed, 21 insertions(+), 18 deletions(-)
> 
> NAK.  It seems utterly wrong that constant expressions generate 
> instructions.  I think we should fix this, rather than allow it.
> 
> Apparently what's being emitted is:
> 1. The function prototype
> 2. A global variable declaration (i.e. lessThan_retval)
> 3. A global call and assignment (initializer)
> 
> Of course, these will likely not be used.  ast_function could probably 
> detect if a function call is a C.E. and avoid emitting them.

I kind of like the sound of up-front constant expression detection for
function calls.  The thing I want to avoid is function calls appearing
in expression trees, which seems like the other way this would work.

Attachment: pgpY6dC2aZBPq.pgp
Description: PGP signature

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to