[Mesa-dev] [PATCH 09/10] vbo: fix GL_LINE_LOOP stray line bug
Brian Paul
brianp at vmware.com
Sun Oct 18 14:09:08 PDT 2015
On 10/17/2015 07:31 PM, Charmaine Lee wrote:
>
>> From: Brian Paul <brianp at vmware.com>
>> Sent: Friday, October 16, 2015 2:25 PM
>> To: mesa-dev at lists.freedesktop.org
>> Cc: Charmaine Lee; Jose Fonseca; Sinclair Yeh
>> Subject: [PATCH 09/10] vbo: fix GL_LINE_LOOP stray line bug
>
>> When long GL_LINE_LOOP primitives don't fit in one vertex buffer they
>> have to be split across buffers. The code to do this was basically correct
>> but drivers had to pay special attention to the _mesa_prim::begin,end flags
>> in order to draw the sections of the line loop properly. Apparently, the
>> only drivers to do this were those using the old 'tnl' module for software
>> vertex processing.
>
>> Now we convert the split pieces of GL_LINE_LOOP prims into GL_LINE_STRIP
>> primitives so that drivers don't have to worry about the special begin/end
>> flags. The only time a driver will get a GL_LINE_LOOP prim is when the
>> whole thing fits in one vertex buffer.
>
>> Most fixes bug 81174, but not completely. There's another bug somewhere
>> in the src/gallium/auxiliary/draw/ code. If the piglit lineloop test is
>> run with -count 4096, rendering is correct, but with -count 4097 there are
>> stray lines. 4096 is a magic number in the draw code (search for "4096").
>
>> Also note that this does not fix long line loops in display lists. The
>> next patch fixes that.
>
>> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=81174
>> ---
>> src/mesa/vbo/vbo_context.h | 5 ++++-
>> src/mesa/vbo/vbo_exec_api.c | 38 +++++++++++++++++++++++++++++++++++++-
>> src/mesa/vbo/vbo_exec_draw.c | 12 ++++++++++++
>> 3 files changed, 53 insertions(+), 2 deletions(-)
>
>> diff --git a/src/mesa/vbo/vbo_context.h b/src/mesa/vbo/vbo_context.h
>> index 1e85335..28f43b4 100644
>> --- a/src/mesa/vbo/vbo_context.h
>> +++ b/src/mesa/vbo/vbo_context.h
>> @@ -205,7 +205,10 @@ vbo_get_default_vals_as_union(GLenum format)
>> static inline unsigned
>> vbo_compute_max_verts(const struct vbo_exec_context *exec)
>> {
>> - return (VBO_VERT_BUFFER_SIZE - exec->vtx.buffer_used) /
>> + /* Subtract one so we're always sure to have room for an extra
>> + * vertex for GL_LINE_LOOP -> GL_LINE_STRIP conversion.
>> + */
>> + return (VBO_VERT_BUFFER_SIZE - exec->vtx.buffer_used - 1) /
>> (exec->vtx.vertex_size * sizeof(GLfloat));
>
> Shouldn't this be
> (VBO_VERT_BUFFER_SIZE - exec->vtx.buffer_used) / (exec->vtx.vertex_size *sizeof(GLfloat)) - 1;
Yes, of course. I'll fix that.
-Brian
More information about the mesa-dev
mailing list