[Mesa-dev] [PATCH 10/12] glsl/opt_algebraic: Don't handle invariant or precise trees

Francisco Jerez currojerez at riseup.net
Mon Mar 21 21:37:52 UTC 2016


Jason Ekstrand <jason at jlekstrand.net> writes:

> ---
>  src/compiler/glsl/opt_algebraic.cpp | 16 ++++++++++++++++
>  1 file changed, 16 insertions(+)
>
> diff --git a/src/compiler/glsl/opt_algebraic.cpp b/src/compiler/glsl/opt_algebraic.cpp
> index 1e58062..2fea240 100644
> --- a/src/compiler/glsl/opt_algebraic.cpp
> +++ b/src/compiler/glsl/opt_algebraic.cpp
> @@ -58,6 +58,8 @@ public:
>     {
>     }
>  
> +   virtual ir_visitor_status visit_enter(ir_assignment *ir);
> +
>     ir_rvalue *handle_expression(ir_expression *ir);
>     void handle_rvalue(ir_rvalue **rvalue);
>     bool reassociate_constant(ir_expression *ir1,
> @@ -80,6 +82,20 @@ public:
>  
>  } /* unnamed namespace */
>  
> +ir_visitor_status
> +ir_algebraic_visitor::visit_enter(ir_assignment *ir)
> +{
> +   ir_variable *var = ir->lhs->variable_referenced();
> +   if (var->data.invariant || var->data.precise) {
> +      /* If we're assigning to an invariant or precise variable, just bail.
> +       * Most of the algebraic optimizations aren't precision-safe.

Could you add something like the following to this comment:

|         * FINISHME -- Find out which optimizations are precision-safe
|         *             and enable then only for invariant or precise trees.

With that change:

Reviewed-by: Francisco Jerez <currojerez at riseup.net>

> +       */
> +      return visit_continue_with_parent;
> +   } else {
> +      return visit_continue;
> +   }
> +}
> +
>  static inline bool
>  is_vec_zero(ir_constant *ir)
>  {
> -- 
> 2.5.0.400.gff86faf
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 212 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20160321/4577a1fb/attachment-0001.sig>


More information about the mesa-dev mailing list