From 04e12e31b252e7a18862c3ac386f302665edb6e7 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 4 Dec 2009 09:14:40 -0700 Subject: llvmpipe: dynamic allocation of triangle a0/dadx/dady arrays Much less memory per triangle now. --- src/gallium/drivers/llvmpipe/lp_rast.h | 10 ++++------ src/gallium/drivers/llvmpipe/lp_setup_tri.c | 10 ++++++++++ 2 files changed, 14 insertions(+), 6 deletions(-) (limited to 'src/gallium/drivers/llvmpipe') diff --git a/src/gallium/drivers/llvmpipe/lp_rast.h b/src/gallium/drivers/llvmpipe/lp_rast.h index ab21a77834..435993d44d 100644 --- a/src/gallium/drivers/llvmpipe/lp_rast.h +++ b/src/gallium/drivers/llvmpipe/lp_rast.h @@ -64,14 +64,12 @@ struct lp_rast_shader_inputs { const struct lp_rast_state *state; /* Attribute interpolation: - * * First coefficient is position. - * - * FIXME: reduce memory waste! + * These pointers point into the bin data buffer. */ - float a0[1 + PIPE_MAX_SHADER_INPUTS][4]; - float dadx[1 + PIPE_MAX_SHADER_INPUTS][4]; - float dady[1 + PIPE_MAX_SHADER_INPUTS][4]; + float (*a0)[4]; + float (*dadx)[4]; + float (*dady)[4]; }; diff --git a/src/gallium/drivers/llvmpipe/lp_setup_tri.c b/src/gallium/drivers/llvmpipe/lp_setup_tri.c index c21c465a75..3b71bc4c03 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup_tri.c +++ b/src/gallium/drivers/llvmpipe/lp_setup_tri.c @@ -177,6 +177,16 @@ static void setup_tri_coefficients( struct setup_context *setup, { unsigned slot; + /* Allocate space for the a0, dadx and dady arrays + */ + { + unsigned bytes; + bytes = (setup->fs.nr_inputs + 1) * 4 * sizeof(float); + tri->inputs.a0 = get_data_aligned( &setup->data, bytes, 16 ); + tri->inputs.dadx = get_data_aligned( &setup->data, bytes, 16 ); + tri->inputs.dady = get_data_aligned( &setup->data, bytes, 16 ); + } + /* The internal position input is in slot zero: */ setup_fragcoord_coef(tri, 0, v1, v2, v3); -- cgit v1.2.3