[Mesa-dev] [PATCH 5/8] glsl: track which program inputs are doubles

Ian Romanick idr at freedesktop.org
Mon May 4 16:53:08 PDT 2015


On 04/29/2015 06:14 PM, Dave Airlie wrote:
> From: Dave Airlie <airlied at redhat.com>
> 
> instead of doing the attempts at dual slot handling here,
> let the backend do it.

Just curious... why?  It seems like everyone wants the same mapping, so
doing it one place ought to be better.  There is a lot of stuff in the
GL specs to anticipate hardware that has never materialized.

> Signed-off-by: Dave Airlie <airlied at redhat.com>
> ---
>  src/glsl/ir_set_program_inouts.cpp | 14 ++------------
>  src/mesa/main/mtypes.h             |  1 +
>  2 files changed, 3 insertions(+), 12 deletions(-)
> 
> diff --git a/src/glsl/ir_set_program_inouts.cpp b/src/glsl/ir_set_program_inouts.cpp
> index e877a20..0a410ab 100644
> --- a/src/glsl/ir_set_program_inouts.cpp
> +++ b/src/glsl/ir_set_program_inouts.cpp
> @@ -105,13 +105,10 @@ mark(struct gl_program *prog, ir_variable *var, int offset, int len,
>        int idx = var->data.location + var->data.index + offset + i;
>        GLbitfield64 bitfield = BITFIELD64_BIT(idx);
>  
> -      /* dvec3 and dvec4 take up 2 slots */
> -      if (dual_slot) {
> -         idx += i;
> -         bitfield |= bitfield << 1;
> -      }
>        if (var->data.mode == ir_var_shader_in) {
>  	 prog->InputsRead |= bitfield;
> +	 if (dual_slot)
> +	    prog->DoubleInputsRead |= bitfield;
>           if (is_fragment_shader) {
>              gl_fragment_program *fprog = (gl_fragment_program *) prog;
>              fprog->InterpQualifier[idx] =
> @@ -120,13 +117,6 @@ mark(struct gl_program *prog, ir_variable *var, int offset, int len,
>                 fprog->IsCentroid |= bitfield;
>              if (var->data.sample)
>                 fprog->IsSample |= bitfield;
> -
> -            /* Set the InterpQualifier of the next slot to the same as the
> -             * current one, since dvec3 and dvec4 spans 2 slots.
> -             */
> -            if (dual_slot)
> -               fprog->InterpQualifier[idx + 1] =
> -                  (glsl_interp_qualifier) var->data.interpolation;
>           }
>        } else if (var->data.mode == ir_var_system_value) {
>           prog->SystemValuesRead |= bitfield;
> diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
> index efc723a..3860ab9 100644
> --- a/src/mesa/main/mtypes.h
> +++ b/src/mesa/main/mtypes.h
> @@ -2090,6 +2090,7 @@ struct gl_program
>     struct nir_shader *nir;
>  
>     GLbitfield64 InputsRead;     /**< Bitmask of which input regs are read */
> +   GLbitfield64 DoubleInputsRead;     /**< Bitmask of which input regs are read  and are doubles */
>     GLbitfield64 OutputsWritten; /**< Bitmask of which output regs are written */
>     GLbitfield SystemValuesRead;   /**< Bitmask of SYSTEM_VALUE_x inputs used */
>     GLbitfield InputFlags[MAX_PROGRAM_INPUTS];   /**< PROG_PARAM_BIT_x flags */
> 



More information about the mesa-dev mailing list