Mesa (master): i965/fs: Switch from BRW_MAX_TEX_UNIT to the actual limit.

Kenneth Graunke kwg at kemper.freedesktop.org
Thu Jan 23 01:17:37 UTC 2014


Module: Mesa
Branch: master
Commit: 5a51a268044ab191262e6f73f135ca95aa59f5df
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=5a51a268044ab191262e6f73f135ca95aa59f5df

Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Sat Jan 18 14:48:11 2014 -0800

i965/fs: Switch from BRW_MAX_TEX_UNIT to the actual limit.

BRW_MAX_TEX_UNIT is about to grow, but only Gen7+ will be able to
support the new larger value.  On older platforms, we don't want to
allocate the extra space - it would just be a waste.

Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
Reviewed-by: Matt Turner <mattst88 at gmail.com>
Reviewed-by: Chris Forbes <chrisf at ijw.co.nz>

---

 src/mesa/drivers/dri/i965/brw_wm.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/mesa/drivers/dri/i965/brw_wm.c b/src/mesa/drivers/dri/i965/brw_wm.c
index a6b558f..b7afcf2 100644
--- a/src/mesa/drivers/dri/i965/brw_wm.c
+++ b/src/mesa/drivers/dri/i965/brw_wm.c
@@ -153,6 +153,7 @@ bool do_wm_prog(struct brw_context *brw,
 		struct brw_fragment_program *fp,
 		struct brw_wm_prog_key *key)
 {
+   struct gl_context *ctx = &brw->ctx;
    struct brw_wm_compile *c;
    const GLuint *program;
    struct gl_shader *fs = NULL;
@@ -174,7 +175,7 @@ bool do_wm_prog(struct brw_context *brw,
       param_count = fp->program.Base.Parameters->NumParameters * 4;
    }
    /* The backend also sometimes adds params for texture size. */
-   param_count += 2 * BRW_MAX_TEX_UNIT;
+   param_count += 2 * ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxTextureImageUnits;
    c->prog_data.param = rzalloc_array(NULL, const float *, param_count);
    c->prog_data.pull_param = rzalloc_array(NULL, const float *, param_count);
 




More information about the mesa-commit mailing list