Some more refactoring in GLVertexBuffer

Review Request #110366 - Created May 8, 2013 and submitted

Fredrik Höglund
This is the next part of my optimization branch.

It does some more refactoring and adds a new setData() overload, which isn't used yet.
There should be no functional changes.

I'm not 100% sure about the new setAttribLayout() API. I suspect we may need a real
GLAttribLayout class if we start using vertex array objects in the future.

commit 682b73bf1169254c5cf015cee0ffe4ba0753a7a4
Author: Fredrik Höglund <>
Date:   Thu Sep 27 17:26:19 2012 +0200

    kwin: Add a new setData() method in GLVertexBuffer
    This overload makes it possible to upload data of an arbitrary size and
    type into the buffer object.  The intent is for this method to be used
    to upload interleaved vertex data.
    This commit also adds setVertexCount() and setAttribLayout().
    The rationale for decoupling attribute specification from data uploading
    is that the attribute formats and layout change less frequently than
    the vertex data.
    The vertex count is also specified using a separate function to enable
    the caller to upload data for multiple draw calls at the same time.

commit 24201f76ddef80713d502476250de1f572d552e5
Author: Fredrik Höglund <>
Date:   Thu Sep 27 17:21:33 2012 +0200

    kwin: Change the way attrib formats are stored in GLVertexBuffer
    Store the formats as an array in GLVertexBufferPrivate.
    This simplifies the code for enabling the generic vertex arrays,
    and also makes it easier to add new arrays.

commit 0b084f234516c1b54360cf8391d9253bfcd7f484
Author: Fredrik Höglund <>
Date:   Fri Mar 15 13:25:39 2013 +0100

    kwin: Add convenience classes for working with bitfields

commit 86f48cfe2a220d28109d8f9f4426ac4ab8e15762
Author: Fredrik Höglund <>
Date:   Wed Mar 20 20:06:18 2013 +0100

    kwin: Add a Color uniform in GLShader
    And use it in GLVertexBufferPrivate::bindArrays(). Also store the color
    as a QVector4D in GLVertexBufferPrivate.

commit bdfc62a865601b4723228a9f479460157a7ab2ce
Author: Fredrik Höglund <>
Date:   Wed Sep 26 22:34:12 2012 +0200

    kwin: Do some more refactoring in GLVertexBuffer
    Consolidate the code for binding and unbinding the vertex arrays into
    two new methods called bindArrays() and unbindArrays() respectively.
    This patch also removes the three paint implementations, since the only
    difference between them is the code that sets up the arrays. The actual
    painting code is moved into GLVertexBuffer::render(), which uses the
    new methods to bind and unbind the arrays.

Martin Flöser
Casian Andrei
Martin Flöser
Fredrik Höglund
Review request changed

Status: Closed (submitted)