[Mesa-dev] [PATCH] i965: Shrink stage_prog_data param array length
emil.l.velikov at gmail.com
Mon May 30 16:50:43 UTC 2016
On 29 May 2016 at 07:01, Jordan Justen <jordan.l.justen at intel.com> wrote:
> 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 at intel.com>
> Jenkins results looked good with this change.
> src/mesa/drivers/dri/i965/brw_cs.c | 2 +-
> src/mesa/drivers/dri/i965/brw_gs.c | 4 +---
> src/mesa/drivers/dri/i965/brw_tcs.c | 4 +---
> src/mesa/drivers/dri/i965/brw_tes.c | 4 +---
> src/mesa/drivers/dri/i965/brw_vs.c | 4 +---
> src/mesa/drivers/dri/i965/brw_wm.c | 2 +-
> 6 files changed, 6 insertions(+), 14 deletions(-)
> diff --git a/src/mesa/drivers/dri/i965/brw_cs.c b/src/mesa/drivers/dri/i965/brw_cs.c
> index 0ab9ebd..a9cbde9 100644
> --- a/src/mesa/drivers/dri/i965/brw_cs.c
> +++ b/src/mesa/drivers/dri/i965/brw_cs.c
> @@ -91,7 +91,7 @@ brw_codegen_cs_prog(struct brw_context *brw,
> * 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;
Shouldn't one use sizeof(union gl_constant_value) over the hardcoded 4 ?
More information about the mesa-dev