<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Wed, Oct 4, 2017 at 7:31 PM, Jordan Justen <span dir="ltr"><<a href="mailto:jordan.l.justen@intel.com" target="_blank">jordan.l.justen@intel.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On 2017-09-29 14:25:10, Jason Ekstrand wrote:<br>
> Otherwise, in the ARB program case _mesa_add_state_reference may grow<br>
> the parameter array which will cause brw_nir_setup_arb_uniforms to write<br>
> past the end of the param array because it only looks at the parameter<br>
> list length but the parma array is allocated based on nir->num_uniforms.<br>
> The only reason this hasn't caused us problems is because we are padding<br>
> out the param array for fragment programs unnecessarily.<br>
> ---<br>
>  src/mesa/drivers/dri/i965/brw_<wbr>program.c | 9 +++++----<br>
>  1 file changed, 5 insertions(+), 4 deletions(-)<br>
><br>
> diff --git a/src/mesa/drivers/dri/i965/<wbr>brw_program.c b/src/mesa/drivers/dri/i965/<wbr>brw_program.c<br>
> index ee464fc..7eec6f7 100644<br>
> --- a/src/mesa/drivers/dri/i965/<wbr>brw_program.c<br>
> +++ b/src/mesa/drivers/dri/i965/<wbr>brw_program.c<br>
> @@ -88,8 +88,6 @@ brw_create_nir(struct brw_context *brw,<br>
>     }<br>
>     nir_validate_shader(nir);<br>
><br>
> -   (void)progress;<br>
> -<br>
>     nir = brw_preprocess_nir(brw-><wbr>screen->compiler, nir);<br>
><br>
>     if (stage == MESA_SHADER_FRAGMENT) {<br>
> @@ -98,10 +96,13 @@ brw_create_nir(struct brw_context *brw,<br>
>           .fs_coord_pixel_center_integer = 1,<br>
>           .fs_coord_origin_upper_left = 1,<br>
>        };<br>
> -      _mesa_add_state_reference(<wbr>prog->Parameters,<br>
> -                                (gl_state_index *) wpos_options.state_tokens);<br>
><br>
> +      progress = false;<br>
<br>
</div></div>Should we move the `progress` declaration here?<br>
<span class=""><br>
>        NIR_PASS(progress, nir, nir_lower_wpos_ytransform, &wpos_options);<br>
> +      if (progress) {<br>
> +         _mesa_add_state_reference(<wbr>prog->Parameters,<br>
> +                                   (gl_state_index *) wpos_options.state_tokens);<br>
> +      }<br>
>     }<br>
><br>
>     NIR_PASS(progress, nir, nir_lower_system_values);<br>
<br>
</span>And convert this to NIR_PASS_V?<span class="HOEnZb"><font color="#888888"><br></font></span></blockquote><div><br></div><div>Sure.  I thought about that but didn't.  Done. <br></div></div><br></div></div>