Christoph Bumiller
2009-May-08 17:13 UTC
[Nouveau] [PATCH] gallium/nv50: fix multi-texturing
This one maps textures to sampler units (or textures to texture units or whatever it's called), which wasn't done before. It should make the mesa demo "multiarb" work, at least with the shader patches I sent earlier. Of course, with this functionality one probably wouldn't have to setup the textures in NV50_TIC anew every time, but that can be optimized later. ----------------------------- commit bced24ac0c6ac6f3d3b7c2627595b09c20d419ca Author: chr <chr at LAPTOP.(none)> Date: Fri May 8 18:48:45 2009 +0200 nv50: Fix multi-texturing. We need to bind textures to sampler units. diff --git a/src/gallium/drivers/nv50/nv50_context.h b/src/gallium/drivers/nv50/nv50_context.h index 7b67a75..d6a7c76 100644 --- a/src/gallium/drivers/nv50/nv50_context.h +++ b/src/gallium/drivers/nv50/nv50_context.h @@ -151,6 +151,7 @@ struct nv50_context { unsigned sampler_nr; struct nv50_miptree *miptree[PIPE_MAX_SAMPLERS]; unsigned miptree_nr; + unsigned texbind_nr; }; static INLINE struct nv50_context * diff --git a/src/gallium/drivers/nv50/nv50_tex.c b/src/gallium/drivers/nv50/nv50_tex.c index 223c8a3..e7e1521 100644 --- a/src/gallium/drivers/nv50/nv50_tex.c +++ b/src/gallium/drivers/nv50/nv50_tex.c @@ -136,8 +136,12 @@ nv50_tex_validate(struct nv50_context *nv50) struct nouveau_grobj *tesla = nv50->screen->tesla; struct nouveau_stateobj *so; int unit; + unsigned push_nr; - so = so_new(nv50->miptree_nr * 8 + 3, nv50->miptree_nr * 2); + push_nr = MAX2(nv50->miptree_nr, nv50->texbind_nr) * 2; + push_nr += nv50->miptree_nr * 8 + 3; + + so = so_new(push_nr, nv50->miptree_nr * 2); so_method(so, tesla, 0x0f00, 1); so_data (so, NV50_CB_TIC); so_method(so, tesla, 0x40000f04, nv50->miptree_nr * 8); @@ -151,6 +155,16 @@ nv50_tex_validate(struct nv50_context *nv50) } } + for (unit = 0; unit < nv50->miptree_nr; unit++) { + so_method(so, tesla, 0x1458, 1); + so_data (so, (unit << 9) | (unit << 1) | 1); + } + for (; unit < nv50->texbind_nr; unit++) { + so_method(so, tesla, 0x1458, 1); + so_data (so, (unit << 1) | 0); + } + nv50->texbind_nr = nv50->miptree_nr; + so_ref(so, &nv50->state.tic_upload); so_ref(NULL, &so); } -------------------------------------