Go to the source code of this file.
Data Structures | |
struct | draw_pt_front_end |
struct | draw_pt_middle_end |
Defines | |
#define | PT_SHADE 0x1 |
#define | PT_CLIPTEST 0x2 |
#define | PT_PIPELINE 0x4 |
#define | PT_MAX_MIDDLE 0x8 |
Typedefs | |
typedef unsigned(* | pt_elt_func )(const void *elts, unsigned idx) |
Functions | |
pt_elt_func | draw_pt_elt_func (struct draw_context *draw) |
const void * | draw_pt_elt_ptr (struct draw_context *draw, unsigned start) |
struct draw_pt_front_end * | draw_pt_vcache (struct draw_context *draw) |
struct draw_pt_front_end * | draw_pt_varray (struct draw_context *draw) |
struct draw_pt_middle_end * | draw_pt_fetch_emit (struct draw_context *draw) |
struct draw_pt_middle_end * | draw_pt_middle_fse (struct draw_context *draw) |
struct draw_pt_middle_end * | draw_pt_fetch_pipeline_or_emit (struct draw_context *draw) |
boolean | draw_pt_get_edgeflag (struct draw_context *draw, unsigned idx) |
void | draw_pt_emit_prepare (struct pt_emit *emit, unsigned prim, unsigned *max_vertices) |
void | draw_pt_emit (struct pt_emit *emit, const float(*vertex_data)[4], unsigned vertex_count, unsigned stride, const ushort *elts, unsigned count) |
void | draw_pt_emit_linear (struct pt_emit *emit, const float(*vertex_data)[4], unsigned vertex_count, unsigned stride, unsigned start, unsigned count) |
void | draw_pt_emit_destroy (struct pt_emit *emit) |
struct pt_emit * | draw_pt_emit_create (struct draw_context *draw) |
void | draw_pt_fetch_prepare (struct pt_fetch *fetch, unsigned vertex_size) |
void | draw_pt_fetch_run (struct pt_fetch *fetch, const unsigned *elts, unsigned count, char *verts) |
void | draw_pt_fetch_run_linear (struct pt_fetch *fetch, unsigned start, unsigned count, char *verts) |
void | draw_pt_fetch_destroy (struct pt_fetch *fetch) |
struct pt_fetch * | draw_pt_fetch_create (struct draw_context *draw) |
boolean | draw_pt_post_vs_run (struct pt_post_vs *pvs, struct vertex_header *pipeline_verts, unsigned stride, unsigned count) |
void | draw_pt_post_vs_prepare (struct pt_post_vs *pvs, boolean bypass_clipping, boolean identity_viewport, boolean opengl) |
struct pt_post_vs * | draw_pt_post_vs_create (struct draw_context *draw) |
void | draw_pt_post_vs_destroy (struct pt_post_vs *pvs) |
void | draw_pt_split_prim (unsigned prim, unsigned *first, unsigned *incr) |
unsigned | draw_pt_reduced_prim (unsigned prim) |
typedef unsigned(* pt_elt_func)(const void *elts, unsigned idx) |
pt_elt_func draw_pt_elt_func | ( | struct draw_context * | draw | ) |
Definition at line 60 of file draw_pt_elts.c.
References elt_ubyte(), elt_uint(), elt_ushort(), elt_vert(), draw_context::pt, and draw_context::user.
00061 { 00062 switch (draw->pt.user.eltSize) { 00063 case 0: return &elt_vert; 00064 case 1: return &elt_ubyte; 00065 case 2: return &elt_ushort; 00066 case 4: return &elt_uint; 00067 default: return NULL; 00068 } 00069 }
const void* draw_pt_elt_ptr | ( | struct draw_context * | draw, | |
unsigned | start | |||
) |
Definition at line 71 of file draw_pt_elts.c.
References draw_context::pt, and draw_context::user.
00073 { 00074 const char *elts = draw->pt.user.elts; 00075 00076 switch (draw->pt.user.eltSize) { 00077 case 0: 00078 return (const void *)(((const ubyte *)NULL) + start); 00079 case 1: 00080 return (const void *)(((const ubyte *)elts) + start); 00081 case 2: 00082 return (const void *)(((const ushort *)elts) + start); 00083 case 4: 00084 return (const void *)(((const uint *)elts) + start); 00085 default: 00086 return NULL; 00087 } 00088 }
void draw_pt_emit | ( | struct pt_emit * | emit, | |
const float * | vertex_data[4], | |||
unsigned | vertex_count, | |||
unsigned | stride, | |||
const ushort * | elts, | |||
unsigned | count | |||
) |
Definition at line 152 of file draw_pt_emit.c.
References vbuf_render::allocate_vertices, assert, vbuf_render::draw, pt_emit::draw, draw, draw_do_flush(), DRAW_FLUSH_BACKEND, translate::key, translate_key::output_stride, pipe_rasterizer_state::point_size, pt_emit::prim, draw_context::rasterizer, vbuf_render::release_vertices, draw_context::render, translate::set_buffer, vbuf_render::set_primitive, and pt_emit::translate.
00158 { 00159 struct draw_context *draw = emit->draw; 00160 struct translate *translate = emit->translate; 00161 struct vbuf_render *render = draw->render; 00162 void *hw_verts; 00163 00164 /* XXX: need to flush to get prim_vbuf.c to release its allocation?? 00165 */ 00166 draw_do_flush( draw, DRAW_FLUSH_BACKEND ); 00167 00168 /* XXX: and work out some way to coordinate the render primitive 00169 * between vbuf.c and here... 00170 */ 00171 if (!draw->render->set_primitive(draw->render, emit->prim)) { 00172 assert(0); 00173 return; 00174 } 00175 00176 hw_verts = render->allocate_vertices(render, 00177 (ushort)translate->key.output_stride, 00178 (ushort)vertex_count); 00179 if (!hw_verts) { 00180 assert(0); 00181 return; 00182 } 00183 00184 translate->set_buffer(translate, 00185 0, 00186 vertex_data, 00187 stride ); 00188 00189 translate->set_buffer(translate, 00190 1, 00191 &draw->rasterizer->point_size, 00192 0); 00193 00194 translate->run( translate, 00195 0, 00196 vertex_count, 00197 hw_verts ); 00198 00199 render->draw(render, 00200 elts, 00201 count); 00202 00203 render->release_vertices(render, 00204 hw_verts, 00205 translate->key.output_stride, 00206 vertex_count); 00207 }
struct pt_emit* draw_pt_emit_create | ( | struct draw_context * | draw | ) | [read] |
Definition at line 276 of file draw_pt_emit.c.
References pt_emit::cache, CALLOC_STRUCT, pt_emit::draw, FREE, and translate_cache_create().
00277 { 00278 struct pt_emit *emit = CALLOC_STRUCT(pt_emit); 00279 if (!emit) 00280 return NULL; 00281 00282 emit->draw = draw; 00283 emit->cache = translate_cache_create(); 00284 if (!emit->cache) { 00285 FREE(emit); 00286 return NULL; 00287 } 00288 00289 return emit; 00290 }
void draw_pt_emit_destroy | ( | struct pt_emit * | emit | ) |
Definition at line 292 of file draw_pt_emit.c.
References pt_emit::cache, FREE, and translate_cache_destroy().
00293 { 00294 if (emit->cache) 00295 translate_cache_destroy(emit->cache); 00296 00297 FREE(emit); 00298 }
void draw_pt_emit_linear | ( | struct pt_emit * | emit, | |
const float * | vertex_data[4], | |||
unsigned | vertex_count, | |||
unsigned | stride, | |||
unsigned | start, | |||
unsigned | count | |||
) |
Definition at line 210 of file draw_pt_emit.c.
References vbuf_render::allocate_vertices, assert, debug_printf(), pt_emit::draw, draw, vbuf_render::draw_arrays, draw_do_flush(), draw_dump_emitted_vertex(), DRAW_FLUSH_BACKEND, translate::key, translate_key::output_stride, pipe_rasterizer_state::point_size, pt_emit::prim, draw_context::rasterizer, vbuf_render::release_vertices, draw_context::render, translate::set_buffer, vbuf_render::set_primitive, pt_emit::translate, and pt_emit::vinfo.
00216 { 00217 struct draw_context *draw = emit->draw; 00218 struct translate *translate = emit->translate; 00219 struct vbuf_render *render = draw->render; 00220 void *hw_verts; 00221 00222 #if 0 00223 debug_printf("Linear emit\n"); 00224 #endif 00225 /* XXX: need to flush to get prim_vbuf.c to release its allocation?? 00226 */ 00227 draw_do_flush( draw, DRAW_FLUSH_BACKEND ); 00228 00229 /* XXX: and work out some way to coordinate the render primitive 00230 * between vbuf.c and here... 00231 */ 00232 if (!draw->render->set_primitive(draw->render, emit->prim)) { 00233 assert(0); 00234 return; 00235 } 00236 00237 hw_verts = render->allocate_vertices(render, 00238 (ushort)translate->key.output_stride, 00239 (ushort)count); 00240 if (!hw_verts) { 00241 assert(0); 00242 return; 00243 } 00244 00245 translate->set_buffer(translate, 0, 00246 vertex_data, stride); 00247 00248 translate->set_buffer(translate, 1, 00249 &draw->rasterizer->point_size, 00250 0); 00251 00252 translate->run(translate, 00253 0, 00254 vertex_count, 00255 hw_verts); 00256 00257 if (0) { 00258 unsigned i; 00259 for (i = 0; i < vertex_count; i++) { 00260 debug_printf("\n\n%s vertex %d:\n", __FUNCTION__, i); 00261 draw_dump_emitted_vertex( emit->vinfo, 00262 (const uint8_t *)hw_verts + 00263 translate->key.output_stride * i ); 00264 } 00265 } 00266 00267 00268 render->draw_arrays(render, start, count); 00269 00270 render->release_vertices(render, 00271 hw_verts, 00272 translate->key.output_stride, 00273 vertex_count); 00274 }
void draw_pt_emit_prepare | ( | struct pt_emit * | emit, | |
unsigned | prim, | |||
unsigned * | max_vertices | |||
) |
Definition at line 48 of file draw_pt_emit.c.
References assert, vertex_info::attrib, pt_emit::cache, pt_emit::draw, draw, draw_do_flush(), DRAW_FLUSH_BACKEND, translate_key::element, vertex_info::emit, EMIT_1F, EMIT_1F_PSIZE, EMIT_2F, EMIT_3F, EMIT_4F, EMIT_4UB, vbuf_render::get_vertex_info, translate_element::input_buffer, translate_element::input_format, translate_element::input_offset, translate::key, vbuf_render::max_vertex_buffer_bytes, translate_key::nr_elements, vertex_info::num_attribs, translate_element::output_format, translate_element::output_offset, translate_key::output_stride, PIPE_FORMAT_B8G8R8A8_UNORM, PIPE_FORMAT_NONE, PIPE_FORMAT_R32_FLOAT, PIPE_FORMAT_R32G32_FLOAT, PIPE_FORMAT_R32G32B32_FLOAT, PIPE_FORMAT_R32G32B32A32_FLOAT, pt_emit::prim, draw_context::render, vbuf_render::set_primitive, vertex_info::size, vertex_info::src_index, pt_emit::translate, translate_cache_find(), translate_key_compare(), translate_key_sanitize(), and pt_emit::vinfo.
00051 { 00052 struct draw_context *draw = emit->draw; 00053 const struct vertex_info *vinfo; 00054 unsigned dst_offset; 00055 struct translate_key hw_key; 00056 unsigned i; 00057 boolean ok; 00058 00059 /* XXX: need to flush to get prim_vbuf.c to release its allocation?? 00060 */ 00061 draw_do_flush( draw, DRAW_FLUSH_BACKEND ); 00062 00063 00064 /* XXX: may need to defensively reset this later on as clipping can 00065 * clobber this state in the render backend. 00066 */ 00067 emit->prim = prim; 00068 00069 ok = draw->render->set_primitive(draw->render, emit->prim); 00070 if (!ok) { 00071 assert(0); 00072 return; 00073 } 00074 00075 /* Must do this after set_primitive() above: 00076 */ 00077 emit->vinfo = vinfo = draw->render->get_vertex_info(draw->render); 00078 00079 00080 /* Translate from pipeline vertices to hw vertices. 00081 */ 00082 dst_offset = 0; 00083 for (i = 0; i < vinfo->num_attribs; i++) { 00084 unsigned emit_sz = 0; 00085 unsigned src_buffer = 0; 00086 unsigned output_format; 00087 unsigned src_offset = (vinfo->attrib[i].src_index * 4 * sizeof(float) ); 00088 00089 00090 00091 switch (vinfo->attrib[i].emit) { 00092 case EMIT_4F: 00093 output_format = PIPE_FORMAT_R32G32B32A32_FLOAT; 00094 emit_sz = 4 * sizeof(float); 00095 break; 00096 case EMIT_3F: 00097 output_format = PIPE_FORMAT_R32G32B32_FLOAT; 00098 emit_sz = 3 * sizeof(float); 00099 break; 00100 case EMIT_2F: 00101 output_format = PIPE_FORMAT_R32G32_FLOAT; 00102 emit_sz = 2 * sizeof(float); 00103 break; 00104 case EMIT_1F: 00105 output_format = PIPE_FORMAT_R32_FLOAT; 00106 emit_sz = 1 * sizeof(float); 00107 break; 00108 case EMIT_1F_PSIZE: 00109 output_format = PIPE_FORMAT_R32_FLOAT; 00110 emit_sz = 1 * sizeof(float); 00111 src_buffer = 1; 00112 src_offset = 0; 00113 break; 00114 case EMIT_4UB: 00115 output_format = PIPE_FORMAT_B8G8R8A8_UNORM; 00116 emit_sz = 4 * sizeof(ubyte); 00117 break; 00118 default: 00119 assert(0); 00120 output_format = PIPE_FORMAT_NONE; 00121 emit_sz = 0; 00122 break; 00123 } 00124 00125 hw_key.element[i].input_format = PIPE_FORMAT_R32G32B32A32_FLOAT; 00126 hw_key.element[i].input_buffer = src_buffer; 00127 hw_key.element[i].input_offset = src_offset; 00128 hw_key.element[i].output_format = output_format; 00129 hw_key.element[i].output_offset = dst_offset; 00130 00131 dst_offset += emit_sz; 00132 } 00133 00134 hw_key.nr_elements = vinfo->num_attribs; 00135 hw_key.output_stride = vinfo->size * 4; 00136 00137 if (!emit->translate || 00138 translate_key_compare(&emit->translate->key, &hw_key) != 0) 00139 { 00140 translate_key_sanitize(&hw_key); 00141 emit->translate = translate_cache_find(emit->cache, &hw_key); 00142 } 00143 00144 *max_vertices = (draw->render->max_vertex_buffer_bytes / 00145 (vinfo->size * 4)); 00146 00147 /* even number */ 00148 *max_vertices = *max_vertices & ~1; 00149 }
struct pt_fetch* draw_pt_fetch_create | ( | struct draw_context * | draw | ) | [read] |
Definition at line 205 of file draw_pt_fetch.c.
References pt_fetch::cache, CALLOC_STRUCT, pt_fetch::draw, FREE, and translate_cache_create().
00206 { 00207 struct pt_fetch *fetch = CALLOC_STRUCT(pt_fetch); 00208 if (!fetch) 00209 return NULL; 00210 00211 fetch->draw = draw; 00212 fetch->cache = translate_cache_create(); 00213 if (!fetch->cache) { 00214 FREE(fetch); 00215 return NULL; 00216 } 00217 00218 return fetch; 00219 }
void draw_pt_fetch_destroy | ( | struct pt_fetch * | fetch | ) |
Definition at line 221 of file draw_pt_fetch.c.
References pt_fetch::cache, FREE, and translate_cache_destroy().
00222 { 00223 if (fetch->cache) 00224 translate_cache_destroy(fetch->cache); 00225 00226 FREE(fetch); 00227 }
struct draw_pt_middle_end* draw_pt_fetch_emit | ( | struct draw_context * | draw | ) | [read] |
Definition at line 390 of file draw_pt_fetch_emit.c.
References fetch_emit_middle_end::base, fetch_emit_middle_end::cache, CALLOC_STRUCT, draw_pt_middle_end::destroy, fetch_emit_middle_end::draw, fetch_emit_destroy(), fetch_emit_finish(), fetch_emit_prepare(), fetch_emit_run(), fetch_emit_run_linear(), fetch_emit_run_linear_elts(), draw_pt_middle_end::finish, FREE, draw_pt_middle_end::prepare, draw_pt_middle_end::run, draw_pt_middle_end::run_linear, draw_pt_middle_end::run_linear_elts, and translate_cache_create().
00391 { 00392 struct fetch_emit_middle_end *fetch_emit = CALLOC_STRUCT( fetch_emit_middle_end ); 00393 if (fetch_emit == NULL) 00394 return NULL; 00395 00396 fetch_emit->cache = translate_cache_create(); 00397 if (!fetch_emit->cache) { 00398 FREE(fetch_emit); 00399 return NULL; 00400 } 00401 00402 fetch_emit->base.prepare = fetch_emit_prepare; 00403 fetch_emit->base.run = fetch_emit_run; 00404 fetch_emit->base.run_linear = fetch_emit_run_linear; 00405 fetch_emit->base.run_linear_elts = fetch_emit_run_linear_elts; 00406 fetch_emit->base.finish = fetch_emit_finish; 00407 fetch_emit->base.destroy = fetch_emit_destroy; 00408 00409 fetch_emit->draw = draw; 00410 00411 return &fetch_emit->base; 00412 }
struct draw_pt_middle_end* draw_pt_fetch_pipeline_or_emit | ( | struct draw_context * | draw | ) | [read] |
Definition at line 362 of file draw_pt_fetch_shade_pipeline.c.
References fetch_pipeline_middle_end::base, CALLOC_STRUCT, draw_pt_middle_end::destroy, fetch_pipeline_middle_end::draw, draw_pt_emit_create(), draw_pt_fetch_create(), draw_pt_post_vs_create(), fetch_pipeline_middle_end::emit, fetch_pipeline_middle_end::fetch, fetch_pipeline_destroy(), fetch_pipeline_finish(), fetch_pipeline_linear_run(), fetch_pipeline_linear_run_elts(), fetch_pipeline_prepare(), fetch_pipeline_run(), draw_pt_middle_end::finish, fetch_pipeline_middle_end::post_vs, draw_pt_middle_end::prepare, draw_pt_middle_end::run, draw_pt_middle_end::run_linear, and draw_pt_middle_end::run_linear_elts.
00363 { 00364 struct fetch_pipeline_middle_end *fpme = CALLOC_STRUCT( fetch_pipeline_middle_end ); 00365 if (!fpme) 00366 goto fail; 00367 00368 fpme->base.prepare = fetch_pipeline_prepare; 00369 fpme->base.run = fetch_pipeline_run; 00370 fpme->base.run_linear = fetch_pipeline_linear_run; 00371 fpme->base.run_linear_elts = fetch_pipeline_linear_run_elts; 00372 fpme->base.finish = fetch_pipeline_finish; 00373 fpme->base.destroy = fetch_pipeline_destroy; 00374 00375 fpme->draw = draw; 00376 00377 fpme->fetch = draw_pt_fetch_create( draw ); 00378 if (!fpme->fetch) 00379 goto fail; 00380 00381 fpme->post_vs = draw_pt_post_vs_create( draw ); 00382 if (!fpme->post_vs) 00383 goto fail; 00384 00385 fpme->emit = draw_pt_emit_create( draw ); 00386 if (!fpme->emit) 00387 goto fail; 00388 00389 return &fpme->base; 00390 00391 fail: 00392 if (fpme) 00393 fetch_pipeline_destroy( &fpme->base ); 00394 00395 return NULL; 00396 }
void draw_pt_fetch_prepare | ( | struct pt_fetch * | fetch, | |
unsigned | vertex_size | |||
) |
Definition at line 58 of file draw_pt_fetch.c.
References assert, pt_fetch::cache, pt_fetch::draw, draw, translate_key::element, pipe_rasterizer_state::fill_ccw, pipe_rasterizer_state::fill_cw, translate_element::input_buffer, translate_element::input_format, translate_element::input_offset, translate::key, pt_fetch::need_edgeflags, translate_key::nr_elements, draw_context::nr_vertex_buffers, draw_context::nr_vertex_elements, translate_element::output_format, translate_element::output_offset, translate_key::output_stride, PIPE_FORMAT_R32_FLOAT, PIPE_FORMAT_R32G32B32A32_FLOAT, PIPE_POLYGON_MODE_FILL, draw_context::pt, draw_context::rasterizer, translate::set_buffer, pipe_vertex_element::src_format, pipe_vertex_element::src_offset, pt_fetch::translate, translate_cache_find(), translate_key_compare(), translate_key_sanitize(), UNDEFINED_VERTEX_ID, draw_context::user, pipe_vertex_element::vertex_buffer_index, draw_context::vertex_element, and pt_fetch::vertex_size.
00060 { 00061 struct draw_context *draw = fetch->draw; 00062 unsigned i, nr = 0; 00063 unsigned dst_offset = 0; 00064 struct translate_key key; 00065 00066 fetch->vertex_size = vertex_size; 00067 00068 /* Always emit/leave space for a vertex header. 00069 * 00070 * It's worth considering whether the vertex headers should contain 00071 * a pointer to the 'data', rather than having it inline. 00072 * Something to look at after we've fully switched over to the pt 00073 * paths. 00074 */ 00075 { 00076 /* Need to set header->vertex_id = 0xffff somehow. 00077 */ 00078 key.element[nr].input_format = PIPE_FORMAT_R32_FLOAT; 00079 key.element[nr].input_buffer = draw->pt.nr_vertex_buffers; 00080 key.element[nr].input_offset = 0; 00081 key.element[nr].output_format = PIPE_FORMAT_R32_FLOAT; 00082 key.element[nr].output_offset = dst_offset; 00083 dst_offset += 1 * sizeof(float); 00084 nr++; 00085 00086 00087 /* Just leave the clip[] array untouched. 00088 */ 00089 dst_offset += 4 * sizeof(float); 00090 } 00091 00092 00093 for (i = 0; i < draw->pt.nr_vertex_elements; i++) { 00094 key.element[nr].input_format = draw->pt.vertex_element[i].src_format; 00095 key.element[nr].input_buffer = draw->pt.vertex_element[i].vertex_buffer_index; 00096 key.element[nr].input_offset = draw->pt.vertex_element[i].src_offset; 00097 key.element[nr].output_format = PIPE_FORMAT_R32G32B32A32_FLOAT; 00098 key.element[nr].output_offset = dst_offset; 00099 00100 dst_offset += 4 * sizeof(float); 00101 nr++; 00102 } 00103 00104 assert(dst_offset <= vertex_size); 00105 00106 key.nr_elements = nr; 00107 key.output_stride = vertex_size; 00108 00109 00110 if (!fetch->translate || 00111 translate_key_compare(&fetch->translate->key, &key) != 0) 00112 { 00113 translate_key_sanitize(&key); 00114 fetch->translate = translate_cache_find(fetch->cache, &key); 00115 00116 { 00117 static struct vertex_header vh = { 0, 1, 0, UNDEFINED_VERTEX_ID, { .0f, .0f, .0f, .0f } }; 00118 fetch->translate->set_buffer(fetch->translate, 00119 draw->pt.nr_vertex_buffers, 00120 &vh, 00121 0); 00122 } 00123 } 00124 00125 fetch->need_edgeflags = ((draw->rasterizer->fill_cw != PIPE_POLYGON_MODE_FILL || 00126 draw->rasterizer->fill_ccw != PIPE_POLYGON_MODE_FILL) && 00127 draw->pt.user.edgeflag); 00128 }
void draw_pt_fetch_run | ( | struct pt_fetch * | fetch, | |
const unsigned * | elts, | |||
unsigned | count, | |||
char * | verts | |||
) |
Definition at line 133 of file draw_pt_fetch.c.
References pipe_vertex_buffer::buffer_offset, pt_fetch::draw, draw, draw_pt_get_edgeflag(), vertex_header::edgeflag, pt_fetch::need_edgeflags, draw_context::nr_vertex_buffers, pipe_vertex_buffer::pitch, draw_context::pt, translate::set_buffer, pt_fetch::translate, draw_context::user, draw_context::vertex_buffer, and pt_fetch::vertex_size.
00137 { 00138 struct draw_context *draw = fetch->draw; 00139 struct translate *translate = fetch->translate; 00140 unsigned i; 00141 00142 for (i = 0; i < draw->pt.nr_vertex_buffers; i++) { 00143 translate->set_buffer(translate, 00144 i, 00145 ((char *)draw->pt.user.vbuffer[i] + 00146 draw->pt.vertex_buffer[i].buffer_offset), 00147 draw->pt.vertex_buffer[i].pitch ); 00148 } 00149 00150 translate->run_elts( translate, 00151 elts, 00152 count, 00153 verts ); 00154 00155 /* Edgeflags are hard to fit into a translate program, populate 00156 * them separately if required. In the setup above they are 00157 * defaulted to one, so only need this if there is reason to change 00158 * that default: 00159 */ 00160 if (fetch->need_edgeflags) { 00161 for (i = 0; i < count; i++) { 00162 struct vertex_header *vh = (struct vertex_header *)(verts + i * fetch->vertex_size); 00163 vh->edgeflag = draw_pt_get_edgeflag( draw, elts[i] ); 00164 } 00165 } 00166 }
void draw_pt_fetch_run_linear | ( | struct pt_fetch * | fetch, | |
unsigned | start, | |||
unsigned | count, | |||
char * | verts | |||
) |
Definition at line 169 of file draw_pt_fetch.c.
References pipe_vertex_buffer::buffer_offset, pt_fetch::draw, draw, draw_pt_get_edgeflag(), vertex_header::edgeflag, pt_fetch::need_edgeflags, draw_context::nr_vertex_buffers, pipe_vertex_buffer::pitch, draw_context::pt, translate::set_buffer, pt_fetch::translate, draw_context::user, draw_context::vertex_buffer, and pt_fetch::vertex_size.
00173 { 00174 struct draw_context *draw = fetch->draw; 00175 struct translate *translate = fetch->translate; 00176 unsigned i; 00177 00178 for (i = 0; i < draw->pt.nr_vertex_buffers; i++) { 00179 translate->set_buffer(translate, 00180 i, 00181 ((char *)draw->pt.user.vbuffer[i] + 00182 draw->pt.vertex_buffer[i].buffer_offset), 00183 draw->pt.vertex_buffer[i].pitch ); 00184 } 00185 00186 translate->run( translate, 00187 start, 00188 count, 00189 verts ); 00190 00191 /* Edgeflags are hard to fit into a translate program, populate 00192 * them separately if required. In the setup above they are 00193 * defaulted to one, so only need this if there is reason to change 00194 * that default: 00195 */ 00196 if (fetch->need_edgeflags) { 00197 for (i = 0; i < count; i++) { 00198 struct vertex_header *vh = (struct vertex_header *)(verts + i * fetch->vertex_size); 00199 vh->edgeflag = draw_pt_get_edgeflag( draw, start + i ); 00200 } 00201 } 00202 }
boolean draw_pt_get_edgeflag | ( | struct draw_context * | draw, | |
unsigned | idx | |||
) |
Definition at line 316 of file draw_pt.c.
References draw_context::pt, and draw_context::user.
00318 { 00319 if (draw->pt.user.edgeflag) 00320 return (draw->pt.user.edgeflag[idx/32] & (1 << (idx%32))) != 0; 00321 else 00322 return 1; 00323 }
struct draw_pt_middle_end* draw_pt_middle_fse | ( | struct draw_context * | draw | ) | [read] |
Definition at line 394 of file draw_pt_fetch_shade_emit.c.
References fetch_shade_emit::base, CALLOC_STRUCT, draw_pt_middle_end::destroy, fetch_shade_emit::draw, draw_pt_middle_end::finish, fse_destroy(), fse_finish(), fse_prepare(), fse_run(), fse_run_linear(), fse_run_linear_elts(), draw_pt_middle_end::prepare, draw_pt_middle_end::run, draw_pt_middle_end::run_linear, and draw_pt_middle_end::run_linear_elts.
00395 { 00396 struct fetch_shade_emit *fse = CALLOC_STRUCT(fetch_shade_emit); 00397 if (!fse) 00398 return NULL; 00399 00400 fse->base.prepare = fse_prepare; 00401 fse->base.run = fse_run; 00402 fse->base.run_linear = fse_run_linear; 00403 fse->base.run_linear_elts = fse_run_linear_elts; 00404 fse->base.finish = fse_finish; 00405 fse->base.destroy = fse_destroy; 00406 fse->draw = draw; 00407 00408 return &fse->base; 00409 }
struct pt_post_vs* draw_pt_post_vs_create | ( | struct draw_context * | draw | ) | [read] |
Definition at line 219 of file draw_pt_post_vs.c.
References CALLOC_STRUCT, and pt_post_vs::draw.
00220 { 00221 struct pt_post_vs *pvs = CALLOC_STRUCT( pt_post_vs ); 00222 if (!pvs) 00223 return NULL; 00224 00225 pvs->draw = draw; 00226 00227 return pvs; 00228 }
void draw_pt_post_vs_destroy | ( | struct pt_post_vs * | pvs | ) |
void draw_pt_post_vs_prepare | ( | struct pt_post_vs * | pvs, | |
boolean | bypass_clipping, | |||
boolean | identity_viewport, | |||
boolean | opengl | |||
) |
Definition at line 201 of file draw_pt_post_vs.c.
References post_vs_cliptest_viewport_gl(), post_vs_none(), post_vs_viewport(), and pt_post_vs::run.
00205 { 00206 if (bypass_clipping) { 00207 if (identity_viewport) 00208 pvs->run = post_vs_none; 00209 else 00210 pvs->run = post_vs_viewport; 00211 } 00212 else { 00213 //if (opengl) 00214 pvs->run = post_vs_cliptest_viewport_gl; 00215 } 00216 }
boolean draw_pt_post_vs_run | ( | struct pt_post_vs * | pvs, | |
struct vertex_header * | pipeline_verts, | |||
unsigned | stride, | |||
unsigned | count | |||
) |
unsigned draw_pt_reduced_prim | ( | unsigned | prim | ) |
Definition at line 80 of file draw_pt_util.c.
References assert, PIPE_PRIM_LINE_LOOP, PIPE_PRIM_LINE_STRIP, PIPE_PRIM_LINES, PIPE_PRIM_POINTS, PIPE_PRIM_POLYGON, PIPE_PRIM_QUAD_STRIP, PIPE_PRIM_QUADS, PIPE_PRIM_TRIANGLE_FAN, PIPE_PRIM_TRIANGLE_STRIP, and PIPE_PRIM_TRIANGLES.
00081 { 00082 switch (prim) { 00083 case PIPE_PRIM_POINTS: 00084 return PIPE_PRIM_POINTS; 00085 case PIPE_PRIM_LINES: 00086 case PIPE_PRIM_LINE_STRIP: 00087 case PIPE_PRIM_LINE_LOOP: 00088 return PIPE_PRIM_LINES; 00089 case PIPE_PRIM_TRIANGLES: 00090 case PIPE_PRIM_TRIANGLE_STRIP: 00091 case PIPE_PRIM_TRIANGLE_FAN: 00092 case PIPE_PRIM_POLYGON: 00093 case PIPE_PRIM_QUADS: 00094 case PIPE_PRIM_QUAD_STRIP: 00095 return PIPE_PRIM_TRIANGLES; 00096 default: 00097 assert(0); 00098 return PIPE_PRIM_POINTS; 00099 } 00100 }
void draw_pt_split_prim | ( | unsigned | prim, | |
unsigned * | first, | |||
unsigned * | incr | |||
) |
Definition at line 37 of file draw_pt_util.c.
References assert, PIPE_PRIM_LINE_LOOP, PIPE_PRIM_LINE_STRIP, PIPE_PRIM_LINES, PIPE_PRIM_POINTS, PIPE_PRIM_POLYGON, PIPE_PRIM_QUAD_STRIP, PIPE_PRIM_QUADS, PIPE_PRIM_TRIANGLE_FAN, PIPE_PRIM_TRIANGLE_STRIP, and PIPE_PRIM_TRIANGLES.
00038 { 00039 switch (prim) { 00040 case PIPE_PRIM_POINTS: 00041 *first = 1; 00042 *incr = 1; 00043 break; 00044 case PIPE_PRIM_LINES: 00045 *first = 2; 00046 *incr = 2; 00047 break; 00048 case PIPE_PRIM_LINE_STRIP: 00049 case PIPE_PRIM_LINE_LOOP: 00050 *first = 2; 00051 *incr = 1; 00052 break; 00053 case PIPE_PRIM_TRIANGLES: 00054 *first = 3; 00055 *incr = 3; 00056 break; 00057 case PIPE_PRIM_TRIANGLE_STRIP: 00058 case PIPE_PRIM_TRIANGLE_FAN: 00059 case PIPE_PRIM_POLYGON: 00060 *first = 3; 00061 *incr = 1; 00062 break; 00063 case PIPE_PRIM_QUADS: 00064 *first = 4; 00065 *incr = 4; 00066 break; 00067 case PIPE_PRIM_QUAD_STRIP: 00068 *first = 4; 00069 *incr = 2; 00070 break; 00071 default: 00072 assert(0); 00073 *first = 0; 00074 *incr = 1; /* set to one so that count % incr works */ 00075 break; 00076 } 00077 }
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 }
struct draw_pt_front_end* draw_pt_vcache | ( | struct draw_context * | draw | ) | [read] |
Definition at line 485 of file draw_pt_vcache.c.
References vcache_frontend::base, CALLOC_STRUCT, draw_pt_front_end::destroy, vcache_frontend::draw, draw_pt_front_end::finish, vcache_frontend::in, draw_pt_front_end::prepare, draw_pt_front_end::run, vcache_destroy(), vcache_finish(), and vcache_prepare().
00486 { 00487 struct vcache_frontend *vcache = CALLOC_STRUCT( vcache_frontend ); 00488 if (vcache == NULL) 00489 return NULL; 00490 00491 vcache->base.prepare = vcache_prepare; 00492 vcache->base.run = NULL; 00493 vcache->base.finish = vcache_finish; 00494 vcache->base.destroy = vcache_destroy; 00495 vcache->draw = draw; 00496 00497 memset(vcache->in, ~0, sizeof(vcache->in)); 00498 00499 return &vcache->base; 00500 }