[Mesa-dev] [PATCH 6/6] glsl: Allow instructions to be generated for array size declarations.
eric at anholt.net
Mon Apr 11 13:16:36 PDT 2011
On Mon, 11 Apr 2011 12:59:12 -0700, Kenneth Graunke <kenneth at 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.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 197 bytes
Desc: not available
More information about the mesa-dev