[Mesa-dev] [PATCH 6/6] glsl: Allow instructions to be generated for array size declarations.

Kenneth Graunke kenneth at whitecape.org
Mon Apr 11 12:59:12 PDT 2011


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.


More information about the mesa-dev mailing list