[Mesa-dev] [PATCH 5/5] Change ir_function_signature::constant_expression_value to run through the function.

Olivier Galibert galibert at pobox.com
Wed May 2 14:24:26 PDT 2012


On Mon, Apr 30, 2012 at 11:45:50AM -0700, Eric Anholt wrote:
> I'm concerned that this will turn things that shouldn't be constant
> expressions in GLSL (some user-defined function just using its
> (constant) arguments and constants) and treating them as constant
> expressions.  Do we have tests for that?

The if (!this->is_builtin) return NULL has not been touched.


> Our variables don't generally have unique names.  It looks like from
> your usage, that you could use pointer_hash/compare and get cheaper
> searches plus unique references to variables.

Done that, very nice.  Avoids scoping problems with if blocks, which
is a nice bonus.

> 
> > +   const exec_node *parameter_info = parameters.head;
> >  
> > -   /* Check if all parameters are constant */
> > -   ir_constant *op[3];
> >     foreach_list(n, actual_parameters) {
> > -      ir_constant *constant = ((ir_rvalue *) n)->constant_expression_value();
> > +      ir_constant *constant = ((ir_rvalue *) n)->constant_expression_value(NULL);
> >        if (constant == NULL)
> >  	 return NULL;
> 
> Why drop the "check if all parameters are constant" code?  

The if (constant == NULL) return NULL; is the check, and it is still
there.  Only the comment has morphed into "Check constness along the
way." in a higher-level comment block.

  OG.


More information about the mesa-dev mailing list