From c448a556e9f97dd059de99048b75ebf6d51e1d7c Mon Sep 17 00:00:00 2001 From: Christoph Bumiller Date: Sun, 13 Mar 2011 18:18:17 +0100 Subject: [PATCH] nv50,nvc0: don't assert on cso with 0 vertex elements --- src/gallium/drivers/nv50/nv50_stateobj.h | 2 +- src/gallium/drivers/nv50/nv50_vbo.c | 4 +--- src/gallium/drivers/nvc0/nvc0_vbo.c | 2 -- 3 files changed, 2 insertions(+), 6 deletions(-) diff --git a/src/gallium/drivers/nv50/nv50_stateobj.h b/src/gallium/drivers/nv50/nv50_stateobj.h index cf5b92ef1a8..515e3e78d42 100644 --- a/src/gallium/drivers/nv50/nv50_stateobj.h +++ b/src/gallium/drivers/nv50/nv50_stateobj.h @@ -49,7 +49,7 @@ struct nv50_vertex_stateobj { boolean need_conversion; unsigned vertex_size; unsigned packet_vertex_limit; - struct nv50_vertex_element element[1]; + struct nv50_vertex_element element[0]; }; #endif diff --git a/src/gallium/drivers/nv50/nv50_vbo.c b/src/gallium/drivers/nv50/nv50_vbo.c index 4f0a5018459..abdb9ce2f93 100644 --- a/src/gallium/drivers/nv50/nv50_vbo.c +++ b/src/gallium/drivers/nv50/nv50_vbo.c @@ -51,10 +51,8 @@ nv50_vertex_state_create(struct pipe_context *pipe, struct translate_key transkey; unsigned i; - assert(num_elements); - so = MALLOC(sizeof(*so) + - (num_elements - 1) * sizeof(struct nv50_vertex_element)); + num_elements * sizeof(struct nv50_vertex_element)); if (!so) return NULL; so->num_elements = num_elements; diff --git a/src/gallium/drivers/nvc0/nvc0_vbo.c b/src/gallium/drivers/nvc0/nvc0_vbo.c index 3698043029c..6bbcf2447ec 100644 --- a/src/gallium/drivers/nvc0/nvc0_vbo.c +++ b/src/gallium/drivers/nvc0/nvc0_vbo.c @@ -51,8 +51,6 @@ nvc0_vertex_state_create(struct pipe_context *pipe, struct translate_key transkey; unsigned i; - assert(num_elements); - so = MALLOC(sizeof(*so) + num_elements * sizeof(struct nvc0_vertex_element)); if (!so) -- 2.30.2