Go to the source code of this file.
Data Structures | |
struct | vbuf_render |
Interface for hardware vertex buffer rendering. More... | |
Functions | |
struct draw_stage * | draw_vbuf_stage (struct draw_context *draw, struct vbuf_render *render) |
Create a new primitive vbuf/render stage. |
Definition in file draw_vbuf.h.
struct draw_stage* draw_vbuf_stage | ( | struct draw_context * | draw, | |
struct vbuf_render * | render | |||
) | [read] |
Create a new primitive vbuf/render stage.
Definition at line 455 of file draw_pipe_vbuf.c.
References align_malloc(), vbuf_stage::cache, CALLOC_STRUCT, draw_stage::destroy, draw_stage::draw, draw_stage::flush, vbuf_stage::indices, draw_stage::line, MAX2, vbuf_render::max_indices, vbuf_stage::max_indices, draw_stage::point, vbuf_stage::render, draw_stage::reset_stipple_counter, vbuf_stage::stage, translate_cache_create(), draw_stage::tri, UNDEFINED_VERTEX_ID, vbuf_destroy(), vbuf_first_line(), vbuf_first_point(), vbuf_first_tri(), vbuf_flush(), vbuf_reset_stipple_counter(), vbuf_stage::vertex_ptr, and vbuf_stage::vertices.
00457 { 00458 struct vbuf_stage *vbuf = CALLOC_STRUCT(vbuf_stage); 00459 if (vbuf == NULL) 00460 goto fail; 00461 00462 vbuf->stage.draw = draw; 00463 vbuf->stage.point = vbuf_first_point; 00464 vbuf->stage.line = vbuf_first_line; 00465 vbuf->stage.tri = vbuf_first_tri; 00466 vbuf->stage.flush = vbuf_flush; 00467 vbuf->stage.reset_stipple_counter = vbuf_reset_stipple_counter; 00468 vbuf->stage.destroy = vbuf_destroy; 00469 00470 vbuf->render = render; 00471 vbuf->max_indices = MAX2(render->max_indices, UNDEFINED_VERTEX_ID-1); 00472 00473 vbuf->indices = (ushort *) align_malloc( vbuf->max_indices * 00474 sizeof(vbuf->indices[0]), 00475 16 ); 00476 if (!vbuf->indices) 00477 goto fail; 00478 00479 vbuf->cache = translate_cache_create(); 00480 if (!vbuf->cache) 00481 goto fail; 00482 00483 00484 vbuf->vertices = NULL; 00485 vbuf->vertex_ptr = vbuf->vertices; 00486 00487 return &vbuf->stage; 00488 00489 fail: 00490 if (vbuf) 00491 vbuf_destroy(&vbuf->stage); 00492 00493 return NULL; 00494 }