Optimize the vertex buffer code

Review Request #109688 - Created March 24, 2013 and submitted

Fredrik Höglund
This is the first part of an optimization branch I was originally hoping to
merge before the 4.10 freeze.

I've decided to break it up into several review requests to make it easier
to review.

The branch is layered on top of my kwin-opengl3 branch because it depends on
some GLShader changes in that branch.

commit 5ae24841de91aab296ad3b307211efc5b87730bd
Author: Fredrik Höglund <fredrik@kde.org>
Date:   Fri Sep 21 19:04:26 2012 +0200

    kwin: Bind attributes to the same indices in all shaders

    This saves us from having to look up the attribute locations each
    time we update the vertex array state.

commit e7ccabf293b3092dc158266b6683cda7fbad4d00
Author: Fredrik Höglund <fredrik@kde.org>
Date:   Wed Sep 12 22:16:22 2012 +0200

    kwin: Update the GL1 code in GLVertexBuffer to match the VBO code

    This saves two memory allocations in the GL1 path in setData().

commit 5b3c3fc95dd388846049b9f83ee201b000ec1d46
Author: Fredrik Höglund <fredrik@kde.org>
Date:   Tue Sep 11 17:49:33 2012 +0200

    kwin: Don't reallocate the vertex buffer on every setData() call

    Allocate enough space to hold the geometry for multiple draw calls,
    and use glMapBufferRange() to gradually fill the buffer.  Once the
    data store is full, it's orphaned and a new one is allocated.

commit 4fb88dbb9c1a955487a2cd7eafff8bfec65555ff
Author: Fredrik Höglund <fredrik@kde.org>
Date:   Tue Sep 11 17:30:21 2012 +0200

    kwin: Use one buffer object in GLVertexBuffer

    Store the vertex positions and texture coordinates in the same buffer
    object. This saves one buffer allocation in every setData() call.

    The attributes are also interleaved as they are uploaded into the buffer
    to maximize locality of reference.

commit 80591f629a94a41a4cbad2d14335715630bae9c6
Author: Fredrik Höglund <fredrik@kde.org>
Date:   Wed Sep 26 23:29:11 2012 +0200

    kwin/es: Resolve functions for GL_EXT_map_buffer_range

commit 9085c4ad3f3bfa5e398941a7b36b7640706aac56
Author: Fredrik Höglund <fredrik@kde.org>
Date:   Wed Sep 26 23:27:18 2012 +0200

    kwin/es: Resolve functions for GL_OES_mapbuffer

commit ae7d57086ea5cbbcf81ac737ddce972f3bb6b5f2
Author: Fredrik Höglund <fredrik@kde.org>
Date:   Sun Jul 22 15:03:53 2012 +0200

    kwin: Resolve functions for GL_ARB_map_buffer_range

commit 5566aa97d070a7ccd109bdaa217300bf4a7bb62a
Author: Fredrik Höglund <fredrik@kde.org>
Date:   Sun Jul 22 14:59:43 2012 +0200

    kwin: Resolve more functions from ARB_vertex_buffer_object

    This patch resolves:

Martin Flöser
Fredrik Höglund
Review request changed

Status: Closed (submitted)