[Mesa-dev] [PATCH 1/2] glsl: propagate MaxUnrollIterations to the optimizer's loop unroller

Ian Romanick idr at freedesktop.org
Thu Mar 22 10:51:23 PDT 2012


On 03/20/2012 04:44 PM, Brian Paul wrote:
> Instead of the hard-coded value of 32.  Note that MaxUnrollIterations
> defaults to 32 so there's no net change.  But the gallium state tracker
> can override this.
> ---
>   src/glsl/linker.cpp |    4 +++-
>   1 files changed, 3 insertions(+), 1 deletions(-)
>
> diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp
> index 39169aa..63a3e0f 100644
> --- a/src/glsl/linker.cpp
> +++ b/src/glsl/linker.cpp
> @@ -2269,7 +2269,9 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog)
>         if (ctx->ShaderCompilerOptions[i].LowerClipDistance)
>            lower_clip_distance(prog->_LinkedShaders[i]->ir);
>
> -      while (do_common_optimization(prog->_LinkedShaders[i]->ir, true, false, 32))
> +      unsigned max_unroll = ctx->ShaderCompilerOptions[i].MaxUnrollIterations;
> +
> +      while (do_common_optimization(prog->_LinkedShaders[i]->ir, true, false, max_unroll))
>   	 ;
>      }
>

I usually make these temporary variables const, but it's not a big deal 
either way.

This patch is

Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>


More information about the mesa-dev mailing list