nouveau: Support X8R8G8B8 textures on nv30, nv40 and RTs on nv10-nv40.
[mesa.git] / src / gallium / drivers / nv10 / nv10_state_emit.c
index 5dec618b9333202657505f2dddfdcfb884f8279e..2577ab73b5672f064431246c970fc5118fd9cf3f 100644 (file)
@@ -103,7 +103,7 @@ static void nv10_state_emit_scissor(struct nv10_context* nv10)
 static void nv10_state_emit_framebuffer(struct nv10_context* nv10)
 {
        struct pipe_framebuffer_state* fb = nv10->framebuffer;
-       struct pipe_surface *rt, *zeta = NULL;
+       struct nv04_surface *rt, *zeta = NULL;
        uint32_t rt_format, w, h;
        int colour_format = 0, zeta_format = 0;
         struct nv10_miptree *nv10mt = 0;
@@ -111,7 +111,7 @@ static void nv10_state_emit_framebuffer(struct nv10_context* nv10)
        w = fb->cbufs[0]->width;
        h = fb->cbufs[0]->height;
        colour_format = fb->cbufs[0]->format;
-       rt = fb->cbufs[0];
+       rt = (struct nv04_surface *)fb->cbufs[0];
 
        if (fb->zsbuf) {
                if (colour_format) {
@@ -123,12 +123,15 @@ static void nv10_state_emit_framebuffer(struct nv10_context* nv10)
                }
 
                zeta_format = fb->zsbuf->format;
-               zeta = fb->zsbuf;
+               zeta = (struct nv04_surface *)fb->zsbuf;
        }
 
        rt_format = NV10TCL_RT_FORMAT_TYPE_LINEAR;
 
        switch (colour_format) {
+       case PIPE_FORMAT_X8R8G8B8_UNORM:
+               rt_format |= NV10TCL_RT_FORMAT_COLOR_X8R8G8B8;
+               break;
        case PIPE_FORMAT_A8R8G8B8_UNORM:
        case 0:
                rt_format |= NV10TCL_RT_FORMAT_COLOR_A8R8G8B8;
@@ -142,18 +145,18 @@ static void nv10_state_emit_framebuffer(struct nv10_context* nv10)
 
        if (zeta) {
                BEGIN_RING(celsius, NV10TCL_RT_PITCH, 1);
-               OUT_RING  (rt->stride | (zeta->stride << 16));
+               OUT_RING  (rt->pitch | (zeta->pitch << 16));
        } else {
                BEGIN_RING(celsius, NV10TCL_RT_PITCH, 1);
-               OUT_RING  (rt->stride | (rt->stride << 16));
+               OUT_RING  (rt->pitch | (rt->pitch << 16));
        }
 
-       nv10mt = (struct nv10_miptree *)rt->texture;
+       nv10mt = (struct nv10_miptree *)rt->base.texture;
        nv10->rt[0] = nv10mt->buffer;
 
        if (zeta_format)
        {
-               nv10mt = (struct nv10_miptree *)zeta->texture;
+               nv10mt = (struct nv10_miptree *)zeta->base.texture;
                nv10->zeta = nv10mt->buffer;
        }