[Mesa-dev] [PATCH] glsl: add support for doubles in GL 4.4+

Iago Toral itoral at igalia.com
Mon May 23 14:39:11 UTC 2016


On Mon, 2016-05-23 at 12:41 +1000, Timothy Arceri wrote:
> We disable varying packing in GL 4.4+ as we can no longer assume
> varying have the same interpolation qualifiers. However doubles used
> as fs inputs must always be qualified as "flat" and backends expect
> doubles to have been packed as floats so we enable packing for them.
> ---
>  src/compiler/glsl/lower_packed_varyings.cpp | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/src/compiler/glsl/lower_packed_varyings.cpp b/src/compiler/glsl/lower_packed_varyings.cpp
> index 41edada..ab4028a 100644
> --- a/src/compiler/glsl/lower_packed_varyings.cpp
> +++ b/src/compiler/glsl/lower_packed_varyings.cpp
> @@ -667,10 +667,14 @@ lower_packed_varyings_visitor::needs_lowering(ir_variable *var)
>     /* Override disable_varying_packing if the var is only used by transform
>      * feedback. Also override it if transform feedback is enabled and the
>      * variable is an array, struct or matrix as the elements of these types
> -    * will always has the same interpolation and therefore asre safe to pack.
> +    * will always has the same interpolation and therefore are safe to pack.
> +    *

Since you are fixing the comment: s/always has/always have

> +    * We also override disable_varying_packing for doubles used as fs inputs
> +    * must always be qualified as "flat".

I think you meant something like "...as fs inputs because they must
always be..."

>      */
>     const glsl_type *type = var->type;
>     if (disable_varying_packing && !var->data.is_xfb_only &&
> +       !type->without_array()->is_double() &&
>         !((type->is_array() || type->is_record() || type->is_matrix()) &&
>           xfb_enabled))
>        return false;

Right after this we also call type->without_array()... maybe assign that
to a local variable and reuse it in both places? without_array()
involves a loop after all.

With these changes:

Reviewed-by: Iago Toral Quiroga <itoral at igalia.com>




More information about the mesa-dev mailing list