nv30: init zeta to NULL, use color pitch if no zeta
authorPatrice Mandin <pmandin@caramail.com>
Fri, 22 Feb 2008 21:21:15 +0000 (22:21 +0100)
committerPatrice Mandin <pmandin@caramail.com>
Fri, 22 Feb 2008 21:21:15 +0000 (22:21 +0100)
src/gallium/drivers/nv30/nv30_state.c

index db4dac24c74dde3dc870155622258a39274843c1..aa3fe7837e4446601f9868ea2d458a3707f40dde 100644 (file)
@@ -537,7 +537,7 @@ nv30_set_framebuffer_state(struct pipe_context *pipe,
                           const struct pipe_framebuffer_state *fb)
 {
        struct nv30_context *nv30 = nv30_context(pipe);
-       struct pipe_surface *rt[4], *zeta;
+       struct pipe_surface *rt[4], *zeta = NULL;
        uint32_t rt_enable, rt_format, w, h;
        int i, colour_format = 0, zeta_format = 0;
 
@@ -603,8 +603,15 @@ nv30_set_framebuffer_state(struct pipe_context *pipe,
        }
 
        if (rt_enable & NV34TCL_RT_ENABLE_COLOR0) {
+               uint32_t pitch = rt[0]->pitch * rt[0]->cpp;
+               if (zeta) {
+                       pitch |= (zeta->pitch * zeta->cpp)<<16;
+               } else {
+                       pitch |= pitch<<16;
+               }
+
                BEGIN_RING(rankine, NV34TCL_COLOR0_PITCH, 1);
-               OUT_RING  ( (rt[0]->pitch * rt[0]->cpp) | ( (zeta->pitch * zeta->cpp) << 16) );
+               OUT_RING  ( pitch );
                nv30->rt[0] = rt[0]->buffer;
        }