[Mesa-dev] [PATCH 14/17] glsl: Support double inouts (was: add double support)
Matt Turner
mattst88 at gmail.com
Thu Feb 5 11:14:38 PST 2015
On Thu, Feb 5, 2015 at 3:05 AM, Topi Pohjolainen
<topi.pohjolainen at intel.com> wrote:
> From: Dave Airlie <airlied at gmail.com>
>
> Signed-off-by: Dave Airlie <airlied at redhat.com>
> ---
> src/glsl/ir_set_program_inouts.cpp | 24 +++++++++++++++++++++---
> 1 file changed, 21 insertions(+), 3 deletions(-)
>
> diff --git a/src/glsl/ir_set_program_inouts.cpp b/src/glsl/ir_set_program_inouts.cpp
> index 97ead75..4aa402e 100644
> --- a/src/glsl/ir_set_program_inouts.cpp
> +++ b/src/glsl/ir_set_program_inouts.cpp
> @@ -81,6 +81,17 @@ is_shader_inout(ir_variable *var)
> var->data.mode == ir_var_system_value;
> }
>
> +static inline bool
> +is_dvec34_inout(ir_variable *var)
> +{
> + if (var->type == glsl_type::dvec4_type || var->type == glsl_type::dvec3_type)
> + return true;
> +
> + if (var->type->is_array() && (var->type->element_type() == glsl_type::dvec4_type || var->type->element_type() == glsl_type::dvec3_type))
Line wrap.
> + return true;
> + return false;
> +}
> +
> static void
> mark(struct gl_program *prog, ir_variable *var, int offset, int len,
> bool is_fragment_shader)
> @@ -94,19 +105,26 @@ mark(struct gl_program *prog, ir_variable *var, int offset, int len,
> */
>
> for (int i = 0; i < len; i++) {
> + int idx = var->data.location + var->data.index + offset + i;
> GLbitfield64 bitfield =
> - BITFIELD64_BIT(var->data.location + var->data.index + offset + i);
> + BITFIELD64_BIT(idx);
> +
> + if (is_dvec34_inout(var))
I don't understand what's special about dvec3/dvec4. Some comments
would be nice.
> + bitfield |= bitfield << 1;
> if (var->data.mode == ir_var_shader_in) {
> prog->InputsRead |= bitfield;
> if (is_fragment_shader) {
> gl_fragment_program *fprog = (gl_fragment_program *) prog;
> - fprog->InterpQualifier[var->data.location +
> - var->data.index + offset + i] =
> + fprog->InterpQualifier[idx] =
> (glsl_interp_qualifier) var->data.interpolation;
> if (var->data.centroid)
> fprog->IsCentroid |= bitfield;
> if (var->data.sample)
> fprog->IsSample |= bitfield;
> +
> + if (is_dvec34_inout(var))
> + fprog->InterpQualifier[idx + 1] =
> + (glsl_interp_qualifier) var->data.interpolation;
> }
> } else if (var->data.mode == ir_var_system_value) {
> prog->SystemValuesRead |= bitfield;
> --
> 1.9.3
More information about the mesa-dev
mailing list