draw->reduced_prim = ~0; /* != any of PIPE_PRIM_x */
- draw_set_mapped_element_buffer( draw, 0, NULL );
-
tgsi_exec_machine_init(&draw->machine);
/* FIXME: give this machine thing a proper constructor:
{
assert(count <= PIPE_MAX_ATTRIBS);
- memcpy(draw->vertex_buffer, buffers, count * sizeof(buffers[0]));
- draw->nr_vertex_buffers = count;
+ memcpy(draw->pt.vertex_buffer, buffers, count * sizeof(buffers[0]));
+ draw->pt.nr_vertex_buffers = count;
}
{
assert(count <= PIPE_MAX_ATTRIBS);
- memcpy(draw->vertex_element, elements, count * sizeof(elements[0]));
- draw->nr_vertex_elements = count;
+ memcpy(draw->pt.vertex_element, elements, count * sizeof(elements[0]));
+ draw->pt.nr_vertex_elements = count;
}
draw_set_mapped_vertex_buffer(struct draw_context *draw,
unsigned attr, const void *buffer)
{
- draw->user.vbuffer[attr] = buffer;
+ draw->pt.user.vbuffer[attr] = buffer;
}
draw_set_mapped_constant_buffer(struct draw_context *draw,
const void *buffer)
{
- draw->user.constants = buffer;
+ draw->pt.user.constants = buffer;
}
void draw_set_edgeflags( struct draw_context *draw,
const unsigned *edgeflag )
{
- draw->user.edgeflag = edgeflag;
+ draw->pt.user.edgeflag = edgeflag;
}
-boolean draw_get_edgeflag( struct draw_context *draw,
- unsigned idx )
-{
- if (draw->user.edgeflag)
- return (draw->user.edgeflag[idx/32] & (1 << (idx%32))) != 0;
- else
- return 1;
-}
/**
draw_set_mapped_element_buffer( struct draw_context *draw,
unsigned eltSize, void *elements )
{
- draw->user.elts = elements;
- draw->user.eltSize = eltSize;
+ draw->pt.user.elts = elements;
+ draw->pt.user.eltSize = eltSize;
}
struct {
struct draw_pt_front_end *vcache;
} front;
+
+ struct pipe_vertex_buffer vertex_buffer[PIPE_MAX_ATTRIBS];
+ unsigned nr_vertex_buffers;
+
+ struct pipe_vertex_element vertex_element[PIPE_MAX_ATTRIBS];
+ unsigned nr_vertex_elements;
+
+ /* user-space vertex data, buffers */
+ struct {
+ const unsigned *edgeflag;
+
+ /** vertex element/index buffer (ex: glDrawElements) */
+ const void *elts;
+ /** bytes per index (0, 1, 2 or 4) */
+ unsigned eltSize;
+
+ /** vertex arrays */
+ const void *vbuffer[PIPE_MAX_ATTRIBS];
+
+ /** constant buffer (for vertex shader) */
+ const void *constants;
+ } user;
+
} pt;
boolean flushing;
const struct pipe_rasterizer_state *rasterizer;
struct pipe_viewport_state viewport;
- struct pipe_vertex_buffer vertex_buffer[PIPE_MAX_ATTRIBS];
- unsigned nr_vertex_buffers;
-
- struct pipe_vertex_element vertex_element[PIPE_MAX_ATTRIBS];
- unsigned nr_vertex_elements;
-
struct draw_vertex_shader *vertex_shader;
boolean identity_viewport;
uint num_vs_outputs; /**< convenience, from vertex_shader */
- /* user-space vertex data, buffers */
- struct {
- const unsigned *edgeflag;
-
- /** vertex element/index buffer (ex: glDrawElements) */
- const void *elts;
- /** bytes per index (0, 1, 2 or 4) */
- unsigned eltSize;
-
- /** vertex arrays */
- const void *vbuffer[PIPE_MAX_ATTRIBS];
-
- /** constant buffer (for vertex shader) */
- const void *constants;
- } user;
/* Clip derived state:
*/
void draw_do_flush( struct draw_context *draw, unsigned flags );
-boolean draw_get_edgeflag( struct draw_context *draw,
- unsigned idx );
-
draw_pt_arrays(draw, prim, start, count);
}
+boolean draw_pt_get_edgeflag( struct draw_context *draw,
+ unsigned idx )
+{
+ if (draw->pt.user.edgeflag)
+ return (draw->pt.user.edgeflag[idx/32] & (1 << (idx%32))) != 0;
+ else
+ return 1;
+}
/* More helpers:
*/
-void draw_pt_run_pipeline( struct draw_context *draw,
- unsigned prim,
- struct vertex_header *verts,
- unsigned vertex_count,
- unsigned vertex_stride,
- const ushort *elts,
- unsigned count );
+boolean draw_pt_get_edgeflag( struct draw_context *draw,
+ unsigned idx );
/*******************************************************************************
pt_elt_func draw_pt_elt_func( struct draw_context *draw )
{
- switch (draw->user.eltSize) {
+ switch (draw->pt.user.eltSize) {
case 0: return elt_vert;
case 1: return elt_ubyte;
case 2: return elt_ushort;
const void *draw_pt_elt_ptr( struct draw_context *draw,
unsigned start )
{
- const char *elts = draw->user.elts;
+ const char *elts = draw->pt.user.elts;
- switch (draw->user.eltSize) {
+ switch (draw->pt.user.eltSize) {
case 0:
return (const void *)(((const ubyte *)NULL) + start);
case 1:
/* Need to set header->vertex_id = 0xffff somehow.
*/
key.element[nr].input_format = PIPE_FORMAT_R32_FLOAT;
- key.element[nr].input_buffer = draw->nr_vertex_buffers;
+ key.element[nr].input_buffer = draw->pt.nr_vertex_buffers;
key.element[nr].input_offset = 0;
key.element[nr].output_format = PIPE_FORMAT_R32_FLOAT;
key.element[nr].output_offset = dst_offset;
}
- for (i = 0; i < draw->nr_vertex_elements; i++) {
- key.element[nr].input_format = draw->vertex_element[i].src_format;
- key.element[nr].input_buffer = draw->vertex_element[i].vertex_buffer_index;
- key.element[nr].input_offset = draw->vertex_element[i].src_offset;
+ for (i = 0; i < draw->pt.nr_vertex_elements; i++) {
+ key.element[nr].input_format = draw->pt.vertex_element[i].src_format;
+ key.element[nr].input_buffer = draw->pt.vertex_element[i].vertex_buffer_index;
+ key.element[nr].input_offset = draw->pt.vertex_element[i].src_offset;
key.element[nr].output_format = PIPE_FORMAT_R32G32B32A32_FLOAT;
key.element[nr].output_offset = dst_offset;
{
static struct vertex_header vh = { 0, 0, 0, 0xffff };
fetch->translate->set_buffer(fetch->translate,
- draw->nr_vertex_buffers,
+ draw->pt.nr_vertex_buffers,
&vh,
0);
}
struct translate *translate = fetch->translate;
unsigned i;
- for (i = 0; i < draw->nr_vertex_buffers; i++) {
+ for (i = 0; i < draw->pt.nr_vertex_buffers; i++) {
translate->set_buffer(translate,
i,
- ((char *)draw->user.vbuffer[i] +
- draw->vertex_buffer[i].buffer_offset),
- draw->vertex_buffer[i].pitch );
+ ((char *)draw->pt.user.vbuffer[i] +
+ draw->pt.vertex_buffer[i].buffer_offset),
+ draw->pt.vertex_buffer[i].pitch );
}
translate->run_elts( translate,
memset(&key, 0, sizeof(key));
for (i = 0; i < vinfo->num_attribs; i++) {
- const struct pipe_vertex_element *src = &draw->vertex_element[vinfo->src_index[i]];
+ const struct pipe_vertex_element *src = &draw->pt.vertex_element[vinfo->src_index[i]];
unsigned emit_sz = 0;
unsigned input_format = src->src_format;
break;
case EMIT_1F_PSIZE:
input_format = PIPE_FORMAT_R32_FLOAT;
- input_buffer = draw->nr_vertex_buffers;
+ input_buffer = draw->pt.nr_vertex_buffers;
input_offset = 0;
output_format = PIPE_FORMAT_R32_FLOAT;
emit_sz = 1 * sizeof(float);
feme->translate = translate_create( &key );
feme->translate->set_buffer(feme->translate,
- draw->nr_vertex_buffers,
+ draw->pt.nr_vertex_buffers,
&feme->point_size,
0);
}
shader->run_linear(shader,
(const float (*)[4])pipeline_verts->data,
( float (*)[4])pipeline_verts->data,
- (const float (*)[4])draw->user.constants,
+ (const float (*)[4])draw->pt.user.constants,
fetch_count,
fpme->vertex_size,
fpme->vertex_size);
unsigned idx,
unsigned mask )
{
- if (mask && draw_get_edgeflag(vcache->draw, idx))
+ if (mask && draw_pt_get_edgeflag(vcache->draw, idx))
return idx | DRAW_PT_EDGEFLAG;
else
return idx;
* unmap vertex/index buffers
*/
for (i = 0; i < PIPE_MAX_ATTRIBS; i++) {
- if (draw->vertex_buffer[i].buffer) {
+ if (draw->pt.vertex_buffer[i].buffer) {
pipe->winsys->buffer_unmap(pipe->winsys,
- draw->vertex_buffer[i].buffer);
- pipe_buffer_reference(winsys, &draw->vertex_buffer[i].buffer, NULL);
+ draw->pt.vertex_buffer[i].buffer);
+ pipe_buffer_reference(winsys, &draw->pt.vertex_buffer[i].buffer, NULL);
draw_set_mapped_vertex_buffer(draw, i, NULL);
}
}