draw_pipe_util.c File Reference

Include dependency graph for draw_pipe_util.c:

Go to the source code of this file.

Defines

#define MAX_VERTEX_SIZE   ((2 + PIPE_MAX_SHADER_OUTPUTS) * 4 * sizeof(float))

Functions

void draw_pipe_passthrough_point (struct draw_stage *stage, struct prim_header *header)
void draw_pipe_passthrough_line (struct draw_stage *stage, struct prim_header *header)
void draw_pipe_passthrough_tri (struct draw_stage *stage, struct prim_header *header)
boolean draw_alloc_temp_verts (struct draw_stage *stage, unsigned nr)
 Allocate space for temporary post-transform vertices, such as for clipping.
void draw_free_temp_verts (struct draw_stage *stage)
void draw_reset_vertex_ids (struct draw_context *draw)


Define Documentation

#define MAX_VERTEX_SIZE   ((2 + PIPE_MAX_SHADER_OUTPUTS) * 4 * sizeof(float))

Definition at line 63 of file draw_pipe_util.c.


Function Documentation

boolean draw_alloc_temp_verts ( struct draw_stage stage,
unsigned  nr 
)

Allocate space for temporary post-transform vertices, such as for clipping.

Definition at line 69 of file draw_pipe_util.c.

References assert, FALSE, FREE, MALLOC, MAX_VERTEX_SIZE, draw_stage::nr_tmps, draw_stage::tmp, and TRUE.

00070 {
00071    assert(!stage->tmp);
00072 
00073    stage->tmp = NULL;
00074    stage->nr_tmps = nr;
00075 
00076    if (nr != 0)
00077    {
00078       unsigned i;
00079       ubyte *store = (ubyte *) MALLOC( MAX_VERTEX_SIZE * nr );
00080 
00081       if (store == NULL)
00082          return FALSE;
00083 
00084       stage->tmp = (struct vertex_header **) MALLOC( sizeof(struct vertex_header *) * nr );
00085       if (stage->tmp == NULL) {
00086          FREE(store);
00087          return FALSE;
00088       }
00089          
00090       for (i = 0; i < nr; i++)
00091          stage->tmp[i] = (struct vertex_header *)(store + i * MAX_VERTEX_SIZE);
00092    }
00093 
00094    return TRUE;
00095 }

void draw_free_temp_verts ( struct draw_stage stage  ) 

Definition at line 98 of file draw_pipe_util.c.

References FREE, and draw_stage::tmp.

00099 {
00100    if (stage->tmp) {
00101       FREE( stage->tmp[0] );
00102       FREE( stage->tmp );
00103       stage->tmp = NULL;
00104    }
00105 }

void draw_pipe_passthrough_line ( struct draw_stage stage,
struct prim_header header 
)

Definition at line 46 of file draw_pipe_util.c.

References draw_stage::line, and draw_stage::next.

00047 {
00048    stage->next->line(stage->next, header);
00049 }

void draw_pipe_passthrough_point ( struct draw_stage stage,
struct prim_header header 
)

Definition at line 40 of file draw_pipe_util.c.

References draw_stage::next, and draw_stage::point.

00041 {
00042    stage->next->point(stage->next, header);
00043 }

void draw_pipe_passthrough_tri ( struct draw_stage stage,
struct prim_header header 
)

Definition at line 52 of file draw_pipe_util.c.

References draw_stage::next, and draw_stage::tri.

00053 {
00054    stage->next->tri(stage->next, header);
00055 }

void draw_reset_vertex_ids ( struct draw_context draw  ) 

Definition at line 112 of file draw_pipe_util.c.

References draw_context::first, draw_stage::next, draw_stage::nr_tmps, draw_context::pipeline, stride(), draw_stage::tmp, UNDEFINED_VERTEX_ID, draw_context::vertex_count, vertex_header::vertex_id, draw_context::vertex_stride, and draw_context::verts.

00113 {
00114    struct draw_stage *stage = draw->pipeline.first;
00115    
00116    while (stage) {
00117       unsigned i;
00118 
00119       for (i = 0; i < stage->nr_tmps; i++)
00120          stage->tmp[i]->vertex_id = UNDEFINED_VERTEX_ID;
00121 
00122       stage = stage->next;
00123    }
00124 
00125    if (draw->pipeline.verts)
00126    {
00127       unsigned i;
00128       char *verts = draw->pipeline.verts;
00129       unsigned stride = draw->pipeline.vertex_stride;
00130 
00131       for (i = 0; i < draw->pipeline.vertex_count; i++) {
00132          ((struct vertex_header *)verts)->vertex_id = UNDEFINED_VERTEX_ID;
00133          verts += stride;
00134       }
00135    }
00136 }


Generated on Tue Sep 29 06:25:20 2009 for Gallium3D by  doxygen 1.5.4