i965: Only add the wpos state reference if we lowered something
authorJason Ekstrand <jason.ekstrand@intel.com>
Fri, 29 Sep 2017 17:16:43 +0000 (10:16 -0700)
committerJason Ekstrand <jason.ekstrand@intel.com>
Fri, 13 Oct 2017 05:39:30 +0000 (22:39 -0700)
commit4d4f14937683110c7b61acb1555f31d070316b04
tree1adbf89e2184d5b5243fdb940f26cbbf80f6ca21
parent4efd079aba165d5a046868ec77a27605724da858
i965: Only add the wpos state reference if we lowered something

Otherwise, in the ARB program case _mesa_add_state_reference may grow
the parameter array which will cause brw_nir_setup_arb_uniforms to write
past the end of the param array because it only looks at the parameter
list length but the parma array is allocated based on nir->num_uniforms.
The only reason this hasn't caused us problems is because we are padding
out the param array for fragment programs unnecessarily.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/mesa/drivers/dri/i965/brw_program.c