It appears we were over-allocating these arrays.
Previously we would use nir->num_uniforms directly for scalar
programs, and multiply it by 4 for vec4 programs.
Instead we should have been dividing by 4 in both cases to convert
from bytes to a gl_constant_value count. The size of gl_constant_value
is 4 bytes.
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
* prog_data associated with the compiled program, and which will be freed
* by the state cache.
*/
- int param_count = cp->program.Base.nir->num_uniforms;
+ int param_count = cp->program.Base.nir->num_uniforms / 4;
/* The backend also sometimes adds params for texture size. */
param_count += 2 * ctx->Const.Program[MESA_SHADER_COMPUTE].MaxTextureImageUnits;
*/
struct gl_shader *gs = prog->_LinkedShaders[MESA_SHADER_GEOMETRY];
struct brw_shader *bgs = (struct brw_shader *) gs;
- int param_count = gp->program.Base.nir->num_uniforms;
- if (!compiler->scalar_stage[MESA_SHADER_GEOMETRY])
- param_count *= 4;
+ int param_count = gp->program.Base.nir->num_uniforms / 4;
prog_data.base.base.param =
rzalloc_array(NULL, const gl_constant_value *, param_count);
*/
struct gl_shader *tcs = shader_prog ?
shader_prog->_LinkedShaders[MESA_SHADER_TESS_CTRL] : NULL;
- int param_count = nir->num_uniforms;
- if (!compiler->scalar_stage[MESA_SHADER_TESS_CTRL])
- param_count *= 4;
+ int param_count = nir->num_uniforms / 4;
prog_data.base.base.param =
rzalloc_array(NULL, const gl_constant_value *, param_count);
* every uniform is a float which gets padded to the size of a vec4.
*/
struct gl_shader *tes = shader_prog->_LinkedShaders[MESA_SHADER_TESS_EVAL];
- int param_count = nir->num_uniforms;
- if (!compiler->scalar_stage[MESA_SHADER_TESS_EVAL])
- param_count *= 4;
+ int param_count = nir->num_uniforms / 4;
prog_data.base.base.param =
rzalloc_array(NULL, const gl_constant_value *, param_count);
* prog_data associated with the compiled program, and which will be freed
* by the state cache.
*/
- int param_count = vp->program.Base.nir->num_uniforms;
- if (!compiler->scalar_stage[MESA_SHADER_VERTEX])
- param_count *= 4;
+ int param_count = vp->program.Base.nir->num_uniforms / 4;
if (vs)
prog_data.base.base.nr_image_params = vs->base.NumImages;
* prog_data associated with the compiled program, and which will be freed
* by the state cache.
*/
- int param_count = fp->program.Base.nir->num_uniforms;
+ int param_count = fp->program.Base.nir->num_uniforms / 4;
if (fs)
prog_data.base.nr_image_params = fs->base.NumImages;
/* The backend also sometimes adds params for texture size. */