nv50: fix multi-texturing
authorBen Skeggs <bskeggs@redhat.com>
Sat, 6 Jun 2009 04:00:45 +0000 (14:00 +1000)
committerBen Skeggs <bskeggs@redhat.com>
Sat, 6 Jun 2009 06:24:09 +0000 (16:24 +1000)
src/gallium/drivers/nv50/nv50_context.h
src/gallium/drivers/nv50/nv50_screen.c
src/gallium/drivers/nv50/nv50_tex.c

index 1a72baf305c0e94787c9294b41345d5712569ada..9b8cc4d37d03397087b175bea37e17ebb055b608 100644 (file)
@@ -114,6 +114,7 @@ struct nv50_state {
        unsigned viewport_bypass;
        struct nouveau_stateobj *tsc_upload;
        struct nouveau_stateobj *tic_upload;
+       unsigned miptree_nr;
        struct nouveau_stateobj *vertprog;
        struct nouveau_stateobj *fragprog;
        struct nouveau_stateobj *vtxfmt;
index 7904b51f773ec222ab637650953392eafc7efa5a..fd39fa738b71957df70f538a0f5ba9ab810796df 100644 (file)
@@ -404,8 +404,6 @@ nv50_screen_create(struct pipe_winsys *ws, struct nouveau_device *dev)
 
        so_method(so, screen->tesla, 0x1234, 1);
        so_data  (so, 1);
-       so_method(so, screen->tesla, 0x1458, 1);
-       so_data  (so, 1);
 
        so_emit(chan, so);
        so_ref (so, &screen->static_init);
index 8f553f53464b46ac76ab369d019f09587a80aa75..ff40c2ad81bc30dd17ce6ccd773edbaced668493 100644 (file)
@@ -139,23 +139,35 @@ nv50_tex_validate(struct nv50_context *nv50)
 {
        struct nouveau_grobj *tesla = nv50->screen->tesla;
        struct nouveau_stateobj *so;
-       int unit;
+       int unit, push;
 
-       so = so_new(nv50->miptree_nr * 8 + 3, nv50->miptree_nr * 2);
+       push  = nv50->miptree_nr * 9 + 2;
+       push += MAX2(nv50->miptree_nr, nv50->state.miptree_nr) * 2;
+
+       so = so_new(push, 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);
        for (unit = 0; unit < nv50->miptree_nr; unit++) {
                struct nv50_miptree *mt = nv50->miptree[unit];
 
+               so_method(so, tesla, 0x40000f04, 8);
                if (nv50_tex_construct(nv50, so, mt, unit)) {
                        NOUVEAU_ERR("failed tex validate\n");
                        so_ref(NULL, &so);
                        return;
                }
+
+               so_method(so, tesla, 0x1458, 1);
+               so_data  (so, (unit << 9) | (unit << 1) | 1);
+       }
+
+       for (; unit < nv50->state.miptree_nr; unit++) {
+               so_method(so, tesla, 0x1458, 1);
+               so_data  (so, (unit << 1) | 0);
        }
 
        so_ref(so, &nv50->state.tic_upload);
        so_ref(NULL, &so);
+       nv50->state.miptree_nr = nv50->miptree_nr;
 }