From d07d2c3c5f95fd644ef563004dfa7f3c53904168 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Sat, 11 Jan 2014 21:26:01 -0800 Subject: [PATCH] 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 Reviewed-by: Markus Wick --- glamor/glamor_pixmap.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/glamor/glamor_pixmap.c b/glamor/glamor_pixmap.c index 1bbcc551b..1c258a2b8 100644 --- a/glamor/glamor_pixmap.c +++ b/glamor/glamor_pixmap.c @@ -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