[Mesa-dev] [PATCH 2/8] glsl/fp64: add helper for dual slot double detection.

Oded Gabbay oded.gabbay at gmail.com
Wed Dec 9 03:52:50 PST 2015


On Wed, Dec 9, 2015 at 8:06 AM, Dave Airlie <airlied at gmail.com> wrote:
> From: Dave Airlie <airlied at redhat.com>
>
> The old function didn't work for matrices, and we need this
> in other places to fix some other problems, so move to a helper
> in glsl type and fix the one user so far.
>
> A dual slot double is one that has 3 or 4 components in it's
> base type.
>
> Signed-off-by: Dave Airlie <airlied at redhat.com>
> ---
>  src/glsl/ir_set_program_inouts.cpp | 10 +---------
>  src/glsl/nir/glsl_types.h          |  8 ++++++++
>  2 files changed, 9 insertions(+), 9 deletions(-)
>
> diff --git a/src/glsl/ir_set_program_inouts.cpp b/src/glsl/ir_set_program_inouts.cpp
> index 70d754f..782f1b1 100644
> --- a/src/glsl/ir_set_program_inouts.cpp
> +++ b/src/glsl/ir_set_program_inouts.cpp
> @@ -81,13 +81,6 @@ is_shader_inout(ir_variable *var)
>            var->data.mode == ir_var_system_value;
>  }
>
> -static inline bool
> -is_dual_slot(ir_variable *var)
> -{
> -   const glsl_type *type = var->type->without_array();
> -   return type == glsl_type::dvec4_type || type == glsl_type::dvec3_type;
> -}
> -
>  static void
>  mark(struct gl_program *prog, ir_variable *var, int offset, int len,
>       gl_shader_stage stage)
> @@ -101,7 +94,6 @@ mark(struct gl_program *prog, ir_variable *var, int offset, int len,
>      */
>
>     for (int i = 0; i < len; i++) {
> -      bool dual_slot = is_dual_slot(var);
>        int idx = var->data.location + var->data.index + offset + i;
>        bool is_patch_generic = var->data.patch &&
>                                idx != VARYING_SLOT_TESS_LEVEL_INNER &&
> @@ -123,7 +115,7 @@ mark(struct gl_program *prog, ir_variable *var, int offset, int len,
>           else
>              prog->InputsRead |= bitfield;
>
> -         if (dual_slot)
> +         if (var->type->without_array()->is_dual_slot_double())
>              prog->DoubleInputsRead |= bitfield;
>           if (stage == MESA_SHADER_FRAGMENT) {
>              gl_fragment_program *fprog = (gl_fragment_program *) prog;
> diff --git a/src/glsl/nir/glsl_types.h b/src/glsl/nir/glsl_types.h
> index d8a999a..26f25a1 100644
> --- a/src/glsl/nir/glsl_types.h
> +++ b/src/glsl/nir/glsl_types.h
> @@ -471,6 +471,14 @@ struct glsl_type {
>     }
>
>     /**
> +    * Query whether a double takes two slots.
> +    */
> +   bool is_dual_slot_double() const
> +   {
> +      return base_type == GLSL_TYPE_DOUBLE && vector_elements > 2;
> +   }
> +
> +   /**
>      * Query whether or not a type is a non-array boolean type
>      */
>     bool is_boolean() const
> --
> 2.5.0
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reviewed-by: Oded Gabbay <oded.gabbay at gmail.com>


More information about the mesa-dev mailing list