summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/r300/r300_state.c
diff options
context:
space:
mode:
authorCorbin Simpson <[email protected]>2010-03-02 18:40:03 -0800
committerCorbin Simpson <[email protected]>2010-03-02 18:40:03 -0800
commit4240987cecdaaaeb2d6188f7c83ff4cb8e670c59 (patch)
treeaf2c4ab200f6f7bbcebee33a4c1666a27e07d452 /src/gallium/drivers/r300/r300_state.c
parentddccf7797425097ee6562290d3476075c38220b0 (diff)
r300g: Make velem CSO actually work.
glxgears runs again.
Diffstat (limited to 'src/gallium/drivers/r300/r300_state.c')
-rw-r--r--src/gallium/drivers/r300/r300_state.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c
index ceac690fc46..995664d9000 100644
--- a/src/gallium/drivers/r300/r300_state.c
+++ b/src/gallium/drivers/r300/r300_state.c
@@ -1061,13 +1061,14 @@ static void* r300_create_vertex_elements_state(struct pipe_context* pipe,
unsigned count,
const struct pipe_vertex_element* attribs)
{
- /*XXX could precalculate state here instead of later */
struct r300_velems_state *velems;
+
+ /*XXX should precalculate state here instead of later */
assert(count <= PIPE_MAX_ATTRIBS);
- velems = (struct r300_velems_state *) MALLOC(sizeof(struct r300_velems_state) + count * sizeof(*attribs));
+ velems = CALLOC_STRUCT(r300_velems_state);
if (velems) {
- velems->count = count;
- memcpy(velems->velem, attribs, sizeof(*attribs) * count);
+ velems->count = count;
+ memcpy(velems->velem, attribs, sizeof(struct pipe_vertex_element) * count);
}
return velems;
}
@@ -1078,6 +1079,10 @@ static void r300_bind_vertex_elements_state(struct pipe_context *pipe,
struct r300_context *r300 = r300_context(pipe);
struct r300_velems_state *r300_velems = (struct r300_velems_state *) velems;
+ if (velems == NULL) {
+ return;
+ }
+
r300->velems = r300_velems;
if (r300->draw) {
@@ -1094,7 +1099,7 @@ static void r300_bind_vertex_elements_state(struct pipe_context *pipe,
static void r300_delete_vertex_elements_state(struct pipe_context *pipe, void *velems)
{
- FREE( velems );
+ FREE(velems);
}
static void* r300_create_vs_state(struct pipe_context* pipe,