diff options
author | Brian <[email protected]> | 2008-02-25 17:01:20 -0700 |
---|---|---|
committer | Brian <[email protected]> | 2008-02-25 17:01:20 -0700 |
commit | b02fc948348db5559d658251dd3a6d4f3390d686 (patch) | |
tree | 9062e7268d9ae93e822f857a9d50daa4b99f23e7 /src/gallium/drivers/i915simple/i915_prim_emit.c | |
parent | bc3f2c908e085538ed0956159503e97825161bb9 (diff) |
gallium/i915: compute vertex size _after_ state validation in emit_prim().
Fixes crash when drawing aa lines.
Diffstat (limited to 'src/gallium/drivers/i915simple/i915_prim_emit.c')
-rw-r--r-- | src/gallium/drivers/i915simple/i915_prim_emit.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/gallium/drivers/i915simple/i915_prim_emit.c b/src/gallium/drivers/i915simple/i915_prim_emit.c index 44c43259369..6da42b3846c 100644 --- a/src/gallium/drivers/i915simple/i915_prim_emit.c +++ b/src/gallium/drivers/i915simple/i915_prim_emit.c @@ -72,6 +72,8 @@ emit_hw_vertex( struct i915_context *i915, uint i; uint count = 0; /* for debug/sanity */ + assert(!i915->dirty); + for (i = 0; i < vinfo->num_attribs; i++) { switch (vinfo->emit[i]) { case EMIT_OMIT: @@ -122,17 +124,19 @@ emit_prim( struct draw_stage *stage, unsigned nr ) { struct i915_context *i915 = setup_stage(stage)->i915; - unsigned vertex_size = i915->current.vertex_info.size * 4; /* in bytes */ + unsigned vertex_size; unsigned i; - assert(vertex_size >= 12); /* never smaller than 12 bytes */ - if (i915->dirty) i915_update_derived( i915 ); if (i915->hardware_dirty) i915_emit_hardware_state( i915 ); + /* need to do this after validation! */ + vertex_size = i915->current.vertex_info.size * 4; /* in bytes */ + assert(vertex_size >= 12); /* never smaller than 12 bytes */ + if (!BEGIN_BATCH( 1 + nr * vertex_size / 4, 0 )) { FLUSH_BATCH(); |