summaryrefslogtreecommitdiff
path: root/src/gallium/auxiliary/draw/draw_pt_fetch_emit.c
diff options
context:
space:
mode:
authorKeith Whitwell <keith@tungstengraphics.com>2008-04-02 11:55:03 +0100
committerKeith Whitwell <keith@tungstengraphics.com>2008-04-02 12:02:32 +0100
commitae3c91e98ce3355bca22738440f8ba313b3b8b23 (patch)
tree11165b5c156a0f35c7ce831841a0d59b4cfa19d7 /src/gallium/auxiliary/draw/draw_pt_fetch_emit.c
parent8e33194837dd206d920889851d9cf22190100c99 (diff)
draw: Set the backend prim in the pt 'prepare' operation
Leaving it until 'run' is bad as the primitive is pretty much state for some drivers and so needs to get set early. In some drivers this is used to determine things like vertex format, etc -- by the time we get to 'run', it's too late to change this.
Diffstat (limited to 'src/gallium/auxiliary/draw/draw_pt_fetch_emit.c')
-rw-r--r--src/gallium/auxiliary/draw/draw_pt_fetch_emit.c33
1 files changed, 18 insertions, 15 deletions
diff --git a/src/gallium/auxiliary/draw/draw_pt_fetch_emit.c b/src/gallium/auxiliary/draw/draw_pt_fetch_emit.c
index 9b098bc173..9339cf1f88 100644
--- a/src/gallium/auxiliary/draw/draw_pt_fetch_emit.c
+++ b/src/gallium/auxiliary/draw/draw_pt_fetch_emit.c
@@ -203,16 +203,29 @@ fetch_store_general( struct fetch_emit_middle_end *feme,
-static void fetch_emit_prepare( struct draw_pt_middle_end *middle )
+static void fetch_emit_prepare( struct draw_pt_middle_end *middle,
+ unsigned prim )
{
static const float zero = 0;
struct fetch_emit_middle_end *feme = (struct fetch_emit_middle_end *)middle;
struct draw_context *draw = feme->draw;
- const struct vertex_info *vinfo = draw->render->get_vertex_info(draw->render);
- unsigned nr_attrs = vinfo->num_attribs;
+ const struct vertex_info *vinfo;
unsigned i;
+ boolean ok;
+
+
+ ok = draw->render->set_primitive( draw->render,
+ prim );
+ if (!ok) {
+ assert(0);
+ return;
+ }
+
+ /* Must do this after set_primitive() above:
+ */
+ vinfo = draw->render->get_vertex_info(draw->render);
- for (i = 0; i < nr_attrs; i++) {
+ for (i = 0; i < vinfo->num_attribs; i++) {
unsigned src_element = vinfo->src_index[i];
unsigned src_buffer = draw->vertex_element[src_element].vertex_buffer_index;
@@ -275,7 +288,7 @@ static void fetch_emit_prepare( struct draw_pt_middle_end *middle )
}
}
- feme->nr_fetch = nr_attrs;
+ feme->nr_fetch = vinfo->num_attribs;
feme->hw_vertex_size = vinfo->size * 4;
}
@@ -284,7 +297,6 @@ static void fetch_emit_prepare( struct draw_pt_middle_end *middle )
static void fetch_emit_run( struct draw_pt_middle_end *middle,
- unsigned prim,
const unsigned *fetch_elts,
unsigned fetch_count,
const ushort *draw_elts,
@@ -293,16 +305,7 @@ static void fetch_emit_run( struct draw_pt_middle_end *middle,
struct fetch_emit_middle_end *feme = (struct fetch_emit_middle_end *)middle;
struct draw_context *draw = feme->draw;
void *hw_verts;
- boolean ok;
-
- ok = draw->render->set_primitive( draw->render,
- prim );
- if (!ok) {
- assert(0);
- return;
- }
-
hw_verts = draw->render->allocate_vertices( draw->render,
(ushort)feme->hw_vertex_size,
(ushort)fetch_count );