[Mesa-dev] [PATCH 10/10] mesa/st: set compiler options based on Gallium shader caps

Marek Olšák maraeo at gmail.com
Sat Sep 11 14:55:13 PDT 2010


Please, can we get this patch committed? (along with the other patches this
one depends on)

We need this to enable full loop unrolling for r3xx->r4xx fragment shaders,
which don't support loops. It's needed for the blur shader in KWin to work.
This is a regression since the GLSL compiler merge, because the previous
compiler did unroll loops automatically. I'd like to get this fixed for 7.9.

Thanks.

Reported as a bug:
https://bugs.freedesktop.org/show_bug.cgi?id=30007

Marek

On Mon, Sep 6, 2010 at 3:30 AM, Luca Barbieri <luca at luca-barbieri.com>wrote:

> This turns on if conversion and unlimited loop unrolling if control
> flow is not supported.
>
> Also, programs whose control flow cannot be emulated will now
> fail GLSL linkage.
> ---
>  src/mesa/state_tracker/st_extensions.c |    9 +++++++++
>  1 files changed, 9 insertions(+), 0 deletions(-)
>
> diff --git a/src/mesa/state_tracker/st_extensions.c
> b/src/mesa/state_tracker/st_extensions.c
> index e505f26..6780126 100644
> --- a/src/mesa/state_tracker/st_extensions.c
> +++ b/src/mesa/state_tracker/st_extensions.c
> @@ -168,7 +168,16 @@ void st_init_limits(struct st_context *st)
>       pc->MaxNativeAddressRegs     = screen->get_shader_param(screen, i,
> PIPE_SHADER_CAP_MAX_ADDRS);
>       pc->MaxNativeParameters      = screen->get_shader_param(screen, i,
> PIPE_SHADER_CAP_MAX_CONSTS);
>
> +      /* TODO: make these more fine-grained if anyone needs it */
> +      options->EmitNoIfs = !screen->get_shader_param(screen, i,
> PIPE_SHADER_CAP_MAX_CONTROL_FLOW_DEPTH);
> +      options->EmitNoFunctions = !screen->get_shader_param(screen, i,
> PIPE_SHADER_CAP_MAX_CONTROL_FLOW_DEPTH);
> +      options->EmitNoLoops = !screen->get_shader_param(screen, i,
> PIPE_SHADER_CAP_MAX_CONTROL_FLOW_DEPTH);
> +      options->EmitNoMainReturn = !screen->get_shader_param(screen, i,
> PIPE_SHADER_CAP_MAX_CONTROL_FLOW_DEPTH);
> +
>       options->EmitNoCont = !screen->get_shader_param(screen, i,
> PIPE_SHADER_CAP_TGSI_CONT_SUPPORTED);
> +
> +      if(options->EmitNoLoops)
> +         options->MaxUnrollIterations =
> MIN2(screen->get_shader_param(screen, i, PIPE_SHADER_CAP_MAX_INSTRUCTIONS),
> 65536);
>    }
>
>    /* PIPE_CAP_MAX_FS_INPUTS specifies the number of COLORn + GENERICn
> inputs
> --
> 1.7.0.4
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20100911/b9aef251/attachment.htm>


More information about the mesa-dev mailing list