summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/gallium/auxiliary/draw/draw_context.c5
-rw-r--r--src/gallium/auxiliary/draw/draw_context.h1
-rw-r--r--src/gallium/drivers/i915/i915_context.c8
-rw-r--r--src/gallium/drivers/i915/i915_context.h1
-rw-r--r--src/gallium/drivers/i915/i915_prim_vbuf.c9
-rw-r--r--src/gallium/drivers/i915/i915_state_derived.c5
6 files changed, 29 insertions, 0 deletions
diff --git a/src/gallium/auxiliary/draw/draw_context.c b/src/gallium/auxiliary/draw/draw_context.c
index 2e38dacd1f4..0b8ba4065e1 100644
--- a/src/gallium/auxiliary/draw/draw_context.c
+++ b/src/gallium/auxiliary/draw/draw_context.c
@@ -199,6 +199,11 @@ void draw_flush( struct draw_context *draw )
draw_do_flush( draw, DRAW_FLUSH_BACKEND );
}
+void draw_flush_state( struct draw_context *draw )
+{
+ draw_do_flush( draw, DRAW_FLUSH_STATE_CHANGE );
+}
+
/**
* Specify the Minimum Resolvable Depth factor for polygon offset.
diff --git a/src/gallium/auxiliary/draw/draw_context.h b/src/gallium/auxiliary/draw/draw_context.h
index a0b217e4d33..065f28cdbdb 100644
--- a/src/gallium/auxiliary/draw/draw_context.h
+++ b/src/gallium/auxiliary/draw/draw_context.h
@@ -60,6 +60,7 @@ draw_create_gallivm(struct pipe_context *pipe, struct gallivm_state *gallivm);
void draw_destroy( struct draw_context *draw );
void draw_flush(struct draw_context *draw);
+void draw_flush_state(struct draw_context *draw);
void draw_set_viewport_state( struct draw_context *draw,
const struct pipe_viewport_state *viewport );
diff --git a/src/gallium/drivers/i915/i915_context.c b/src/gallium/drivers/i915/i915_context.c
index 7a98ef73c1f..8448f7ca468 100644
--- a/src/gallium/drivers/i915/i915_context.c
+++ b/src/gallium/drivers/i915/i915_context.c
@@ -66,6 +66,14 @@ i915_draw_vbo(struct pipe_context *pipe, const struct pipe_draw_info *info)
i915_update_derived(i915);
/*
+ * Can only do this here
+ */
+ if (i915->vertex_info_dirty) {
+ draw_flush_state(i915->draw);
+ i915->vertex_info_dirty = 0;
+ }
+
+ /*
* Map index buffer, if present
*/
if (info->indexed && i915->index_buffer.buffer)
diff --git a/src/gallium/drivers/i915/i915_context.h b/src/gallium/drivers/i915/i915_context.h
index dacf50e870d..7d5d7ced9a3 100644
--- a/src/gallium/drivers/i915/i915_context.h
+++ b/src/gallium/drivers/i915/i915_context.h
@@ -249,6 +249,7 @@ struct i915_context {
unsigned dynamic_dirty : I915_MAX_DYNAMIC;
unsigned static_dirty : 4;
unsigned flush_dirty : 2;
+ unsigned vertex_info_dirty;
struct i915_winsys_buffer *validation_buffers[2 + 1 + I915_TEX_UNITS];
int num_validation_buffers;
diff --git a/src/gallium/drivers/i915/i915_prim_vbuf.c b/src/gallium/drivers/i915/i915_prim_vbuf.c
index 79db3b650eb..55f164ecdc5 100644
--- a/src/gallium/drivers/i915/i915_prim_vbuf.c
+++ b/src/gallium/drivers/i915/i915_prim_vbuf.c
@@ -143,6 +143,9 @@ i915_vbuf_render_get_vertex_info(struct vbuf_render *render)
i915_update_derived(i915);
}
+ /* Ack vertex info dirty here */
+ i915->vertex_info_dirty = 0;
+
return &i915->current.vertex_info;
}
@@ -479,6 +482,8 @@ draw_arrays_fallback(struct vbuf_render *render,
}
}
+ assert(!i915->vertex_info_dirty);
+
OUT_BATCH(_3DPRIMITIVE |
PRIM_INDIRECT |
i915_render->hwprim |
@@ -527,6 +532,8 @@ i915_vbuf_render_draw_arrays(struct vbuf_render *render,
}
}
+ assert(!i915->vertex_info_dirty);
+
OUT_BATCH(_3DPRIMITIVE |
PRIM_INDIRECT |
PRIM_INDIRECT_SEQUENTIAL |
@@ -647,6 +654,8 @@ i915_vbuf_render_draw_elements(struct vbuf_render *render,
}
}
+ assert(!i915->vertex_info_dirty);
+
OUT_BATCH(_3DPRIMITIVE |
PRIM_INDIRECT |
i915_render->hwprim |
diff --git a/src/gallium/drivers/i915/i915_state_derived.c b/src/gallium/drivers/i915/i915_state_derived.c
index 59ac2f7292a..bc842087ab5 100644
--- a/src/gallium/drivers/i915/i915_state_derived.c
+++ b/src/gallium/drivers/i915/i915_state_derived.c
@@ -143,6 +143,11 @@ static void calculate_vertex_layout(struct i915_context *i915)
*/
i915->dirty |= I915_NEW_VERTEX_FORMAT;
+ /* Need to set this flag so that we do a more proper flush in
+ * i915_draw_vbo so that the draw module revalidates its state
+ */
+ i915->vertex_info_dirty = 1;
+
memcpy(&i915->current.vertex_info, &vinfo, sizeof(vinfo));
}
}