[Mesa-dev] [PATCH 21/28] glsl: pack fragment shader outputs with component layout qualifiers

Anuj Phogat anuj.phogat at gmail.com
Thu Jan 14 09:47:58 PST 2016


On Mon, Dec 28, 2015 at 9:00 PM, Timothy Arceri
<timothy.arceri at collabora.com> wrote:
> This actually tries to pack any output with an explicit location we
> just let the optimisiation passes clean up the extra assignments if
> there was no actual packing done.
> ---
>  src/glsl/link_varyings.cpp | 17 +++++++++++++++++
>  1 file changed, 17 insertions(+)
>
> diff --git a/src/glsl/link_varyings.cpp b/src/glsl/link_varyings.cpp
> index 7f77f7c..9b434d2 100644
> --- a/src/glsl/link_varyings.cpp
> +++ b/src/glsl/link_varyings.cpp
> @@ -1900,6 +1900,23 @@ assign_varying_locations(struct gl_context *ctx,
>     }
>
>     if (consumer) {
> +      if (consumer->Stage == MESA_SHADER_FRAGMENT) {
> +         /* Since we only pack frag shader outputs with an explicit location
> +          *  we only need to count those inputs.
Extra whitespace before 'we'. s/inputs/outputs.
> +          */
> +         const uint64_t reserved_slots =
> +            reserved_varying_slot(consumer, ir_var_shader_out,
> +                                  FRAG_RESULT_DATA0);
> +
> +         /* Pack frag outputs with the component layout qualifier */
> +         unsigned frag_outs = _mesa_bitcount_64(reserved_slots);
> +         if (frag_outs > 0)
> +            lower_packed_varyings(mem_ctx, frag_outs,
> +                                  ir_var_shader_out, 0, consumer,
> +                                  FRAG_RESULT_DATA0, true,
> +                                  ctx->Extensions.ARB_enhanced_layouts);
> +      }
> +
>        lower_packed_varyings(mem_ctx, slots_used, ir_var_shader_in,
>                              consumer_vertices, consumer, VARYING_SLOT_VAR0,
>                              disable_varying_packing,
> --
> 2.4.3
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev

With the suggested changes:
Reviewed-by: Anuj Phogat <anuj.phogat at gmail.com>


More information about the mesa-dev mailing list