Merge branch 'mesa_7_5_branch'
[mesa.git] / src / gallium / drivers / nv40 / nv40_fragtex.c
index 2d45c2545cda30191abcd746aa727e196bd693cc..eb3002dc05387bfbab4153a6bedcf13e353f9e84 100644 (file)
@@ -45,7 +45,6 @@ static struct nv40_texture_format *
 nv40_fragtex_format(uint pipe_format)
 {
        struct nv40_texture_format *tf = nv40_texture_formats;
-       char fs[128];
 
        while (tf->defined) {
                if (tf->pipe == pipe_format)
@@ -53,8 +52,7 @@ nv40_fragtex_format(uint pipe_format)
                tf++;
        }
 
-       pf_sprint_name(fs, pipe_format);
-       NOUVEAU_ERR("unknown texture format %s\n", fs);
+       NOUVEAU_ERR("unknown texture format %s\n", pf_name(pipe_format));
        return NULL;
 }
 
@@ -68,7 +66,6 @@ nv40_fragtex_build(struct nv40_context *nv40, int unit)
        struct nv40_texture_format *tf;
        struct nouveau_stateobj *so;
        uint32_t txf, txs, txp;
-       int swizzled = 0; /*XXX: implement in region code? */
        unsigned tex_flags = NOUVEAU_BO_VRAM | NOUVEAU_BO_GART | NOUVEAU_BO_RD;
 
        tf = nv40_fragtex_format(pt->format);
@@ -100,7 +97,7 @@ nv40_fragtex_build(struct nv40_context *nv40, int unit)
                return NULL;
        }
 
-       if (swizzled) {
+       if (!(pt->tex_usage & NOUVEAU_TEXTURE_USAGE_LINEAR)) {
                txp = 0;
        } else {
                txp  = nv40mt->level[0].pitch;
@@ -154,6 +151,7 @@ nv40_fragtex_validate(struct nv40_context *nv40)
 
                so = nv40_fragtex_build(nv40, unit);
                so_ref(so, &nv40->state.hw[NV40_STATE_FRAGTEX0 + unit]);
+               so_ref(NULL, &so);
                state->dirty |= (1ULL << (NV40_STATE_FRAGTEX0 + unit));
        }