util_blitter_save_rasterizer(r300->blitter, r300->rs_state.state);
util_blitter_save_fragment_shader(r300->blitter, r300->fs);
util_blitter_save_vertex_shader(r300->blitter, r300->vs);
- util_blitter_save_vertex_elements(r300->blitter, r300->vs);
+ util_blitter_save_vertex_elements(r300->blitter, r300->velems);
}
/* Clear currently bound buffers. */
struct r300_velems_state {
unsigned count;
- struct pipe_vertex_element velem[];
+ struct pipe_vertex_element velem[PIPE_MAX_ATTRIBS];
};
extern struct pipe_viewport_state r300_viewport_identity;
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;
}
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) {
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,