From bb29d066dc5c5188bafadf7b702d44ed571e855e Mon Sep 17 00:00:00 2001 From: Pekka Paalanen Date: Sun, 30 Nov 2008 20:40:55 +0200 Subject: [PATCH] Nouveau: nv{10,20} set_primitive API fix Also changes nvgl_primitive() to return zero, i.e. error, on unknown primitive. Signed-off-by: Pekka Paalanen --- src/gallium/drivers/nouveau/nouveau_gldefs.h | 2 +- src/gallium/drivers/nv10/nv10_prim_vbuf.c | 9 +++++++-- src/gallium/drivers/nv20/nv20_prim_vbuf.c | 9 +++++++-- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/gallium/drivers/nouveau/nouveau_gldefs.h b/src/gallium/drivers/nouveau/nouveau_gldefs.h index e1015c93a27..ff97aaa9af0 100644 --- a/src/gallium/drivers/nouveau/nouveau_gldefs.h +++ b/src/gallium/drivers/nouveau/nouveau_gldefs.h @@ -189,7 +189,7 @@ nvgl_primitive(unsigned prim) { case PIPE_PRIM_POLYGON: return 0x000a; default: - return 0x0001; + return 0; } } diff --git a/src/gallium/drivers/nv10/nv10_prim_vbuf.c b/src/gallium/drivers/nv10/nv10_prim_vbuf.c index 62a8f6d89da..e7e81d3dff8 100644 --- a/src/gallium/drivers/nv10/nv10_prim_vbuf.c +++ b/src/gallium/drivers/nv10/nv10_prim_vbuf.c @@ -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; } diff --git a/src/gallium/drivers/nv20/nv20_prim_vbuf.c b/src/gallium/drivers/nv20/nv20_prim_vbuf.c index a040d89a468..fd9cad177a2 100644 --- a/src/gallium/drivers/nv20/nv20_prim_vbuf.c +++ b/src/gallium/drivers/nv20/nv20_prim_vbuf.c @@ -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 -- 2.30.2