glamor: Don't forget to unmap our PBOs before using them to upload.

From the GL_ARB_vertex_buffer_object spec:

    After the client has specified the contents of a mapped data store,
    and before the data in that store are dereferenced by any GL commands,
    the mapping must be relinquished by calling

        boolean UnmapBufferARB(enum target);

Our mappings were only getting reaped at PBO destroy time, after the
upload.  If the GL implementation wasn't coherent, it would have used
stale data to do the texture upload.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Markus Wick <markus@selfnet.de>
This commit is contained in:
Eric Anholt 2014-01-11 21:26:01 -08:00
parent 64146e4560
commit d07d2c3c5f

View File

@ -726,8 +726,10 @@ __glamor_upload_pixmap_to_texture(PixmapPtr pixmap, unsigned int *tex,
glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
assert(pbo || bits != 0);
if (bits == NULL)
if (bits == NULL) {
glBindBuffer(GL_PIXEL_UNPACK_BUFFER, pbo);
glUnmapBuffer(GL_PIXEL_UNPACK_BUFFER);
}
if (non_sub)
glTexImage2D(GL_TEXTURE_2D, 0, iformat, w, h, 0, format, type, bits);
else