From 520ba25dc3111f731d42f7d97e41c8862d38150e Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Tue, 26 Sep 2006 09:27:54 +0000 Subject: [PATCH] Ensure that we don't wrap batchbuffers right at the beginning of a primitive, otherwise vertices can be emitted without the full-state preamble. Fixes gears + texobj lockup. --- src/mesa/drivers/dri/i915/intel_tris.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/mesa/drivers/dri/i915/intel_tris.c b/src/mesa/drivers/dri/i915/intel_tris.c index 65b249957a3..7dbbaa65751 100644 --- a/src/mesa/drivers/dri/i915/intel_tris.c +++ b/src/mesa/drivers/dri/i915/intel_tris.c @@ -84,6 +84,16 @@ intelStartInlinePrimitive(struct intel_context *intel, { BATCH_LOCALS; + /* Need to make sure at the very least that we don't wrap + * batchbuffers in BEGIN_BATCH below, otherwise the primitive will + * be emitted to a batchbuffer missing the required full-state + * preamble. + */ + if (intel_batchbuffer_space(intel->batch) < 100) { + intel_batchbuffer_flush(intel->batch); + intel->vtbl.emit_state(intel); + } + /* Emit a slot which will be filled with the inline primitive * command later. */