draw_pt_varray.c File Reference

Include dependency graph for draw_pt_varray.c:

Go to the source code of this file.

Data Structures

struct  varray_frontend

Defines

#define FETCH_MAX   256
#define DRAW_MAX   (FETCH_MAX+8)
#define FUNC   varray_run

Functions

static void varray_flush_linear (struct varray_frontend *varray, unsigned start, unsigned count)
static void varray_line_loop_segment (struct varray_frontend *varray, unsigned start, unsigned segment_start, unsigned segment_count, boolean end)
static void varray_fan_segment (struct varray_frontend *varray, unsigned start, unsigned segment_start, unsigned segment_count)
static void varray_prepare (struct draw_pt_front_end *frontend, unsigned prim, struct draw_pt_middle_end *middle, unsigned opt)
static void varray_finish (struct draw_pt_front_end *frontend)
static void varray_destroy (struct draw_pt_front_end *frontend)
struct draw_pt_front_enddraw_pt_varray (struct draw_context *draw)

Variables

static unsigned decompose_prim [PIPE_PRIM_POLYGON+1]


Define Documentation

#define DRAW_MAX   (FETCH_MAX+8)

Definition at line 36 of file draw_pt_varray.c.

#define FETCH_MAX   256

Definition at line 35 of file draw_pt_varray.c.

#define FUNC   varray_run

Definition at line 120 of file draw_pt_varray.c.


Function Documentation

struct draw_pt_front_end* draw_pt_varray ( struct draw_context draw  )  [read]

Definition at line 175 of file draw_pt_varray.c.

References varray_frontend::base, CALLOC_STRUCT, draw_pt_front_end::destroy, varray_frontend::draw, varray_frontend::draw_elts, DRAW_MAX, draw_pt_front_end::finish, draw_pt_front_end::prepare, draw_pt_front_end::run, varray_destroy(), varray_finish(), and varray_prepare().

00176 {
00177    ushort i;
00178    struct varray_frontend *varray = CALLOC_STRUCT(varray_frontend);
00179    if (varray == NULL)
00180       return NULL;
00181 
00182    varray->base.prepare = varray_prepare;
00183    varray->base.run     = NULL;
00184    varray->base.finish  = varray_finish;
00185    varray->base.destroy = varray_destroy;
00186    varray->draw = draw;
00187 
00188    for (i = 0; i < DRAW_MAX; i++) {
00189       varray->draw_elts[i] = i;
00190    }
00191 
00192    return &varray->base;
00193 }

static void varray_destroy ( struct draw_pt_front_end frontend  )  [static]

Definition at line 169 of file draw_pt_varray.c.

References FREE.

00170 {
00171    FREE(frontend);
00172 }

static void varray_fan_segment ( struct varray_frontend varray,
unsigned  start,
unsigned  segment_start,
unsigned  segment_count 
) [static]

Definition at line 92 of file draw_pt_varray.c.

References assert, varray_frontend::draw_elts, varray_frontend::fetch_elts, FETCH_MAX, varray_frontend::fetch_max, varray_frontend::middle, and draw_pt_middle_end::run.

00096 {
00097    assert(segment_count+1 < varray->fetch_max);
00098    if (segment_count >= 2) {
00099       unsigned nr = 0, i;
00100 
00101       if (segment_start != 0)
00102          varray->fetch_elts[nr++] = start;
00103 
00104       for (i = 0 ; i < segment_count; i++) 
00105          varray->fetch_elts[nr++] = start + segment_start + i;
00106 
00107       assert(nr < FETCH_MAX);
00108 
00109       varray->middle->run(varray->middle, 
00110                           varray->fetch_elts,
00111                           nr,
00112                           varray->draw_elts, /* ie. linear */
00113                           nr);
00114    }
00115 }

static void varray_finish ( struct draw_pt_front_end frontend  )  [static]

Definition at line 162 of file draw_pt_varray.c.

References draw_pt_middle_end::finish, and varray_frontend::middle.

00163 {
00164    struct varray_frontend *varray = (struct varray_frontend *)frontend;
00165    varray->middle->finish(varray->middle);
00166    varray->middle = NULL;
00167 }

static void varray_flush_linear ( struct varray_frontend varray,
unsigned  start,
unsigned  count 
) [static]

Definition at line 55 of file draw_pt_varray.c.

References assert, varray_frontend::middle, and draw_pt_middle_end::run_linear.

00057 {
00058    if (count) {
00059       assert(varray->middle->run_linear);
00060       varray->middle->run_linear(varray->middle, start, count);
00061    }
00062 }

static void varray_line_loop_segment ( struct varray_frontend varray,
unsigned  start,
unsigned  segment_start,
unsigned  segment_count,
boolean  end 
) [static]

Definition at line 64 of file draw_pt_varray.c.

References assert, varray_frontend::draw_elts, varray_frontend::fetch_elts, FETCH_MAX, varray_frontend::fetch_max, varray_frontend::middle, and draw_pt_middle_end::run.

00069 {
00070    assert(segment_count+1 < varray->fetch_max);
00071    if (segment_count >= 1) {
00072       unsigned nr = 0, i;
00073 
00074       for (i = 0; i < segment_count; i++) 
00075          varray->fetch_elts[nr++] = start + segment_start + i;
00076 
00077       if (end) 
00078          varray->fetch_elts[nr++] = start;
00079 
00080       assert(nr < FETCH_MAX);
00081 
00082       varray->middle->run(varray->middle, 
00083                           varray->fetch_elts,
00084                           nr,
00085                           varray->draw_elts, /* ie. linear */
00086                           nr);
00087    }
00088 }

static void varray_prepare ( struct draw_pt_front_end frontend,
unsigned  prim,
struct draw_pt_middle_end middle,
unsigned  opt 
) [static]

Definition at line 138 of file draw_pt_varray.c.

References assert, varray_frontend::base, decompose_prim, varray_frontend::driver_fetch_max, FETCH_MAX, varray_frontend::fetch_max, varray_frontend::input_prim, varray_frontend::middle, MIN2, varray_frontend::output_prim, draw_pt_middle_end::prepare, and draw_pt_front_end::run.

00142 {
00143    struct varray_frontend *varray = (struct varray_frontend *)frontend;
00144 
00145    varray->base.run = varray_run;
00146 
00147    varray->input_prim = prim;
00148    varray->output_prim = decompose_prim[prim];
00149 
00150    varray->middle = middle;
00151    middle->prepare(middle, varray->output_prim, opt, &varray->driver_fetch_max );
00152 
00153    /* check that the max is even */
00154    assert((varray->driver_fetch_max & 1) == 0);
00155 
00156    varray->fetch_max = MIN2(FETCH_MAX, varray->driver_fetch_max);
00157 }


Variable Documentation

unsigned decompose_prim[PIPE_PRIM_POLYGON+1] [static]

Initial value:

Definition at line 123 of file draw_pt_varray.c.


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