draw_private.h File Reference

Include dependency graph for draw_private.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  vertex_header
 Basic vertex info. More...
struct  draw_context
 Private context for the drawing module. More...

Defines

#define UNDEFINED_VERTEX_ID   0xffff
#define DRAW_PIPE_MAX_VERTICES   (0x1<<12)
#define DRAW_PIPE_EDGE_FLAG_0   (0x1<<12)
#define DRAW_PIPE_EDGE_FLAG_1   (0x2<<12)
#define DRAW_PIPE_EDGE_FLAG_2   (0x4<<12)
#define DRAW_PIPE_EDGE_FLAG_ALL   (0x7<<12)
#define DRAW_PIPE_RESET_STIPPLE   (0x8<<12)
#define DRAW_PIPE_FLAG_MASK   (0xf<<12)
#define DRAW_FLUSH_STATE_CHANGE   0x8
#define DRAW_FLUSH_BACKEND   0x10

Functions

boolean draw_vs_init (struct draw_context *draw)
void draw_vs_destroy (struct draw_context *draw)
void draw_vs_set_viewport (struct draw_context *, const struct pipe_viewport_state *)
void draw_vs_set_constants (struct draw_context *, const float(*constants)[4], unsigned size)
boolean draw_pt_init (struct draw_context *draw)
void draw_pt_destroy (struct draw_context *draw)
void draw_pt_reset_vertex_ids (struct draw_context *draw)
boolean draw_pipeline_init (struct draw_context *draw)
void draw_pipeline_destroy (struct draw_context *draw)
void draw_pipeline_run (struct draw_context *draw, unsigned prim, struct vertex_header *vertices, unsigned vertex_count, unsigned stride, const ushort *elts, unsigned count)
void draw_pipeline_run_linear (struct draw_context *draw, unsigned prim, struct vertex_header *vertices, unsigned count, unsigned stride)
void draw_pipeline_flush (struct draw_context *draw, unsigned flags)
void draw_do_flush (struct draw_context *draw, unsigned flags)


Define Documentation

#define DRAW_FLUSH_BACKEND   0x10

Definition at line 307 of file draw_private.h.

#define DRAW_FLUSH_STATE_CHANGE   0x8

Definition at line 306 of file draw_private.h.

#define DRAW_PIPE_EDGE_FLAG_0   (0x1<<12)

Definition at line 274 of file draw_private.h.

#define DRAW_PIPE_EDGE_FLAG_1   (0x2<<12)

Definition at line 275 of file draw_private.h.

#define DRAW_PIPE_EDGE_FLAG_2   (0x4<<12)

Definition at line 276 of file draw_private.h.

#define DRAW_PIPE_EDGE_FLAG_ALL   (0x7<<12)

Definition at line 277 of file draw_private.h.

#define DRAW_PIPE_FLAG_MASK   (0xf<<12)

Definition at line 279 of file draw_private.h.

#define DRAW_PIPE_MAX_VERTICES   (0x1<<12)

Definition at line 273 of file draw_private.h.

#define DRAW_PIPE_RESET_STIPPLE   (0x8<<12)

Definition at line 278 of file draw_private.h.

#define UNDEFINED_VERTEX_ID   0xffff

Definition at line 78 of file draw_private.h.


Function Documentation

void draw_do_flush ( struct draw_context draw,
unsigned  flags 
)

Definition at line 400 of file draw_context.c.

References assert, draw_pipeline_flush(), FALSE, draw_context::flushing, draw_context::reduced_prim, draw_context::suspend_flushing, and TRUE.

00401 {
00402    if (!draw->suspend_flushing)
00403    {
00404       assert(!draw->flushing); /* catch inadvertant recursion */
00405 
00406       draw->flushing = TRUE;
00407 
00408       draw_pipeline_flush( draw, flags );
00409 
00410       draw->reduced_prim = ~0; /* is reduced_prim needed any more? */
00411       
00412       draw->flushing = FALSE;
00413    }
00414 }

void draw_pipeline_destroy ( struct draw_context draw  ) 

Definition at line 75 of file draw_pipe.c.

References draw_context::aaline, draw_context::aapoint, draw_context::clip, draw_context::cull, draw_stage::destroy, draw_context::flatshade, draw_context::offset, draw_context::pipeline, draw_context::pstipple, draw_context::rasterize, draw_context::stipple, draw_context::twoside, draw_context::unfilled, draw_context::validate, draw_context::wide_line, and draw_context::wide_point.

00076 {
00077    if (draw->pipeline.wide_line)
00078       draw->pipeline.wide_line->destroy( draw->pipeline.wide_line );
00079    if (draw->pipeline.wide_point)
00080       draw->pipeline.wide_point->destroy( draw->pipeline.wide_point );
00081    if (draw->pipeline.stipple)
00082       draw->pipeline.stipple->destroy( draw->pipeline.stipple );
00083    if (draw->pipeline.unfilled)
00084       draw->pipeline.unfilled->destroy( draw->pipeline.unfilled );
00085    if (draw->pipeline.twoside)
00086       draw->pipeline.twoside->destroy( draw->pipeline.twoside );
00087    if (draw->pipeline.offset)
00088       draw->pipeline.offset->destroy( draw->pipeline.offset );
00089    if (draw->pipeline.clip)
00090       draw->pipeline.clip->destroy( draw->pipeline.clip );
00091    if (draw->pipeline.flatshade)
00092       draw->pipeline.flatshade->destroy( draw->pipeline.flatshade );
00093    if (draw->pipeline.cull)
00094       draw->pipeline.cull->destroy( draw->pipeline.cull );
00095    if (draw->pipeline.validate)
00096       draw->pipeline.validate->destroy( draw->pipeline.validate );
00097    if (draw->pipeline.aaline)
00098       draw->pipeline.aaline->destroy( draw->pipeline.aaline );
00099    if (draw->pipeline.aapoint)
00100       draw->pipeline.aapoint->destroy( draw->pipeline.aapoint );
00101    if (draw->pipeline.pstipple)
00102       draw->pipeline.pstipple->destroy( draw->pipeline.pstipple );
00103    if (draw->pipeline.rasterize)
00104       draw->pipeline.rasterize->destroy( draw->pipeline.rasterize );
00105 }

void draw_pipeline_flush ( struct draw_context draw,
unsigned  flags 
)

Definition at line 314 of file draw_pipe.c.

References draw_context::first, draw_stage::flush, draw_context::pipeline, and draw_context::validate.

00316 {
00317    draw->pipeline.first->flush( draw->pipeline.first, flags );
00318    draw->pipeline.first = draw->pipeline.validate;
00319 }

boolean draw_pipeline_init ( struct draw_context draw  ) 

Definition at line 38 of file draw_pipe.c.

References draw_context::clip, draw_context::cull, draw_clip_stage(), draw_cull_stage(), draw_flatshade_stage(), draw_offset_stage(), draw_stipple_stage(), draw_twoside_stage(), draw_unfilled_stage(), draw_validate_stage(), draw_wide_line_stage(), draw_wide_point_stage(), FALSE, draw_context::first, draw_context::flatshade, draw_context::line_stipple, draw_context::offset, draw_context::pipeline, draw_context::point_sprite, draw_context::stipple, TRUE, draw_context::twoside, draw_context::unfilled, draw_context::validate, draw_context::wide_line, draw_context::wide_line_threshold, draw_context::wide_point, and draw_context::wide_point_threshold.

00039 {
00040    /* create pipeline stages */
00041    draw->pipeline.wide_line  = draw_wide_line_stage( draw );
00042    draw->pipeline.wide_point = draw_wide_point_stage( draw );
00043    draw->pipeline.stipple   = draw_stipple_stage( draw );
00044    draw->pipeline.unfilled  = draw_unfilled_stage( draw );
00045    draw->pipeline.twoside   = draw_twoside_stage( draw );
00046    draw->pipeline.offset    = draw_offset_stage( draw );
00047    draw->pipeline.clip      = draw_clip_stage( draw );
00048    draw->pipeline.flatshade = draw_flatshade_stage( draw );
00049    draw->pipeline.cull      = draw_cull_stage( draw );
00050    draw->pipeline.validate  = draw_validate_stage( draw );
00051    draw->pipeline.first     = draw->pipeline.validate;
00052 
00053    if (!draw->pipeline.wide_line ||
00054        !draw->pipeline.wide_point ||
00055        !draw->pipeline.stipple ||
00056        !draw->pipeline.unfilled ||
00057        !draw->pipeline.twoside ||
00058        !draw->pipeline.offset ||
00059        !draw->pipeline.clip ||
00060        !draw->pipeline.flatshade ||
00061        !draw->pipeline.cull ||
00062        !draw->pipeline.validate)
00063       return FALSE;
00064 
00065    /* these defaults are oriented toward the needs of softpipe */
00066    draw->pipeline.wide_point_threshold = 1000000.0; /* infinity */
00067    draw->pipeline.wide_line_threshold = 1.0;
00068    draw->pipeline.line_stipple = TRUE;
00069    draw->pipeline.point_sprite = TRUE;
00070 
00071    return TRUE;
00072 }

void draw_pipeline_run ( struct draw_context draw,
unsigned  prim,
struct vertex_header vertices,
unsigned  vertex_count,
unsigned  stride,
const ushort elts,
unsigned  count 
)

Definition at line 226 of file draw_pipe.c.

References draw_context::pipeline, draw_context::vertex_count, draw_context::vertex_stride, and draw_context::verts.

00233 {
00234    char *verts = (char *)vertices;
00235 
00236    draw->pipeline.verts = verts;
00237    draw->pipeline.vertex_stride = stride;
00238    draw->pipeline.vertex_count = vertex_count;
00239    
00240    pipe_run(draw, prim, vertices, stride, elts, count);
00241    
00242    draw->pipeline.verts = NULL;
00243    draw->pipeline.vertex_count = 0;
00244 }

void draw_pipeline_run_linear ( struct draw_context draw,
unsigned  prim,
struct vertex_header vertices,
unsigned  count,
unsigned  stride 
)

Definition at line 296 of file draw_pipe.c.

References draw_context::pipeline, draw_context::vertex_count, draw_context::vertex_stride, and draw_context::verts.

00301 {
00302    char *verts = (char *)vertices;
00303    draw->pipeline.verts = verts;
00304    draw->pipeline.vertex_stride = stride;
00305    draw->pipeline.vertex_count = count;
00306 
00307    pipe_run_linear(draw, prim, vertices, stride, count);
00308 
00309    draw->pipeline.verts = NULL;
00310    draw->pipeline.vertex_count = 0;
00311 }

void draw_pt_destroy ( struct draw_context draw  ) 

Definition at line 153 of file draw_pt.c.

References draw_context::front, draw_context::middle, and draw_context::pt.

00154 {
00155    if (draw->pt.middle.general) {
00156       draw->pt.middle.general->destroy( draw->pt.middle.general );
00157       draw->pt.middle.general = NULL;
00158    }
00159 
00160    if (draw->pt.middle.fetch_emit) {
00161       draw->pt.middle.fetch_emit->destroy( draw->pt.middle.fetch_emit );
00162       draw->pt.middle.fetch_emit = NULL;
00163    }
00164 
00165    if (draw->pt.middle.fetch_shade_emit) {
00166       draw->pt.middle.fetch_shade_emit->destroy( draw->pt.middle.fetch_shade_emit );
00167       draw->pt.middle.fetch_shade_emit = NULL;
00168    }
00169 
00170    if (draw->pt.front.vcache) {
00171       draw->pt.front.vcache->destroy( draw->pt.front.vcache );
00172       draw->pt.front.vcache = NULL;
00173    }
00174 
00175    if (draw->pt.front.varray) {
00176       draw->pt.front.varray->destroy( draw->pt.front.varray );
00177       draw->pt.front.varray = NULL;
00178    }
00179 }

boolean draw_pt_init ( struct draw_context draw  ) 

Definition at line 124 of file draw_pt.c.

References debug_get_bool_option(), draw_pt_fetch_emit(), draw_pt_fetch_pipeline_or_emit(), draw_pt_middle_fse(), draw_pt_varray(), draw_pt_vcache(), FALSE, draw_context::front, draw_context::middle, draw_context::no_fse, draw_context::pt, draw_context::test_fse, and TRUE.

00125 {
00126    draw->pt.test_fse = debug_get_bool_option("DRAW_FSE", FALSE);
00127    draw->pt.no_fse = debug_get_bool_option("DRAW_NO_FSE", FALSE);
00128 
00129    draw->pt.front.vcache = draw_pt_vcache( draw );
00130    if (!draw->pt.front.vcache)
00131       return FALSE;
00132 
00133    draw->pt.front.varray = draw_pt_varray(draw);
00134    if (!draw->pt.front.varray)
00135       return FALSE;
00136 
00137    draw->pt.middle.fetch_emit = draw_pt_fetch_emit( draw );
00138    if (!draw->pt.middle.fetch_emit)
00139       return FALSE;
00140 
00141    draw->pt.middle.fetch_shade_emit = draw_pt_middle_fse( draw );
00142    if (!draw->pt.middle.fetch_shade_emit)
00143       return FALSE;
00144 
00145    draw->pt.middle.general = draw_pt_fetch_pipeline_or_emit( draw );
00146    if (!draw->pt.middle.general)
00147       return FALSE;
00148 
00149    return TRUE;
00150 }

void draw_pt_reset_vertex_ids ( struct draw_context draw  ) 

void draw_vs_destroy ( struct draw_context draw  ) 

Definition at line 176 of file draw_vs.c.

References align_free(), draw_context::aligned_constant_storage, draw_context::aos_machine, draw_vs_aos_machine_destroy(), draw_context::emit_cache, draw_context::fetch_cache, tgsi_exec_machine::Inputs, draw_context::machine, tgsi_exec_machine::Outputs, tgsi_exec_machine_free_data(), translate_cache_destroy(), and draw_context::vs.

00177 {
00178    if (draw->vs.machine.Inputs)
00179       align_free(draw->vs.machine.Inputs);
00180 
00181    if (draw->vs.machine.Outputs)
00182       align_free(draw->vs.machine.Outputs);
00183 
00184    if (draw->vs.fetch_cache)
00185       translate_cache_destroy(draw->vs.fetch_cache);
00186 
00187    if (draw->vs.emit_cache)
00188       translate_cache_destroy(draw->vs.emit_cache);
00189 
00190    if (draw->vs.aos_machine)
00191       draw_vs_aos_machine_destroy(draw->vs.aos_machine);
00192 
00193    if (draw->vs.aligned_constant_storage)
00194       align_free((void*)draw->vs.aligned_constant_storage);
00195 
00196    tgsi_exec_machine_free_data(&draw->vs.machine);
00197 
00198 }

boolean draw_vs_init ( struct draw_context draw  ) 

Definition at line 144 of file draw_vs.c.

References align_malloc(), draw_context::aos_machine, draw_vs_aos_machine(), draw_context::emit_cache, FALSE, draw_context::fetch_cache, tgsi_exec_machine::Inputs, draw_context::machine, tgsi_exec_machine::Outputs, PIPE_MAX_ATTRIBS, tgsi_exec_machine_init(), translate_cache_create(), TRUE, and draw_context::vs.

00145 {
00146    tgsi_exec_machine_init(&draw->vs.machine);
00147 
00148    /* FIXME: give this machine thing a proper constructor:
00149     */
00150    draw->vs.machine.Inputs = align_malloc(PIPE_MAX_ATTRIBS * sizeof(struct tgsi_exec_vector), 16);
00151    if (!draw->vs.machine.Inputs)
00152       return FALSE;
00153 
00154    draw->vs.machine.Outputs = align_malloc(PIPE_MAX_ATTRIBS * sizeof(struct tgsi_exec_vector), 16);
00155    if (!draw->vs.machine.Outputs)
00156       return FALSE;
00157 
00158    draw->vs.emit_cache = translate_cache_create();
00159    if (!draw->vs.emit_cache) 
00160       return FALSE;
00161       
00162    draw->vs.fetch_cache = translate_cache_create();
00163    if (!draw->vs.fetch_cache) 
00164       return FALSE;
00165 
00166    draw->vs.aos_machine = draw_vs_aos_machine();
00167 #ifdef PIPE_ARCH_X86
00168    if (!draw->vs.aos_machine)
00169       return FALSE;
00170 #endif
00171       
00172    return TRUE;
00173 }

void draw_vs_set_constants ( struct draw_context ,
const float *  constants[4],
unsigned  size 
)

Definition at line 49 of file draw_vs.c.

References align_free(), align_malloc(), draw_context::aligned_constant_storage, draw_context::aligned_constants, draw_context::aos_machine, draw_context::const_storage_size, draw_vs_aos_machine_constants(), and draw_context::vs.

00052 {
00053    if (((unsigned)constants) & 0xf) {
00054       if (size > draw->vs.const_storage_size) {
00055          if (draw->vs.aligned_constant_storage)
00056             align_free((void *)draw->vs.aligned_constant_storage);
00057          draw->vs.aligned_constant_storage = align_malloc( size, 16 );
00058       }
00059       memcpy( (void*)draw->vs.aligned_constant_storage,
00060               constants, 
00061               size );
00062       constants = draw->vs.aligned_constant_storage;
00063    }
00064       
00065    draw->vs.aligned_constants = constants;
00066    draw_vs_aos_machine_constants( draw->vs.aos_machine, constants );
00067 }

void draw_vs_set_viewport ( struct draw_context ,
const struct pipe_viewport_state  
)

Definition at line 70 of file draw_vs.c.

References draw_context::aos_machine, draw_vs_aos_machine_viewport(), and draw_context::vs.

00072 {
00073    draw_vs_aos_machine_viewport( draw->vs.aos_machine, viewport );
00074 }


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