Nouveau: nv{10,20} set_primitive API fix
authorPekka Paalanen <pq@iki.fi>
Sun, 30 Nov 2008 18:40:55 +0000 (20:40 +0200)
committerPekka Paalanen <pq@iki.fi>
Sun, 30 Nov 2008 18:40:55 +0000 (20:40 +0200)
Also changes nvgl_primitive() to return zero, i.e. error, on unknown
primitive.

Signed-off-by: Pekka Paalanen <pq@iki.fi>
src/gallium/drivers/nouveau/nouveau_gldefs.h
src/gallium/drivers/nv10/nv10_prim_vbuf.c
src/gallium/drivers/nv20/nv20_prim_vbuf.c

index e1015c93a2757c7209f4f8d55451d20ef19cb403..ff97aaa9af0dd42f35cfe30daadc73178d1ab8b7 100644 (file)
@@ -189,7 +189,7 @@ nvgl_primitive(unsigned prim) {
        case PIPE_PRIM_POLYGON:
                return 0x000a;
        default:
-               return 0x0001;
+               return 0;
        }
 }
 
index 62a8f6d89da6a7431c77a73639759d93f9e93faf..e7e81d3dff879af114b9cc4159825a024121a88c 100644 (file)
@@ -121,12 +121,17 @@ nv10_vbuf_render_allocate_vertices( struct vbuf_render *render,
 }
 
 
-static void 
+static boolean
 nv10_vbuf_render_set_primitive( struct vbuf_render *render, 
                unsigned prim )
 {
        struct nv10_vbuf_render *nv10_render = nv10_vbuf_render(render);
-       nv10_render->hwprim = prim + 1;
+       unsigned hwp = nvgl_primitive(prim);
+       if (hwp == 0)
+               return FALSE;
+
+       nv10_render->hwprim = hwp;
+       return TRUE;
 }
 
 
index a040d89a468e6fcfb62a95973b27beca4c5a45db..fd9cad177a208fafb0d2ef66911c7a5be82a0971 100644 (file)
@@ -146,12 +146,17 @@ nv20_vbuf_render_allocate_vertices( struct vbuf_render *render,
        return buf;
 }
 
-static void
+static boolean
 nv20_vbuf_render_set_primitive( struct vbuf_render *render, 
                unsigned prim )
 {
        struct nv20_vbuf_render *nv20_render = nv20_vbuf_render(render);
-       nv20_render->hwprim = nvgl_primitive(prim);
+       unsigned hwp = nvgl_primitive(prim);
+       if (hwp == 0)
+               return FALSE;
+
+       nv20_render->hwprim = hwp;
+       return TRUE;
 }
 
 static uint32_t