From 63aeb9cafae4102fd62a0d88e6723be2eafe8a7f Mon Sep 17 00:00:00 2001 From: Jari Vetoniemi Date: Thu, 26 Jan 2017 09:04:49 +0200 Subject: glFlush after glRadPixels Tell driver we want this data soonish(tm) --- glcapture.c | 1 + glwrangle.h | 3 +++ 2 files changed, 4 insertions(+) diff --git a/glcapture.c b/glcapture.c index c9dcd91..37a0e81 100644 --- a/glcapture.c +++ b/glcapture.c @@ -400,6 +400,7 @@ capture_frame_pbo(struct gl *gl, const GLint view[4], const uint64_t ts) } glReadPixels(view[0], view[1], view[2], view[3], frame.format, GL_UNSIGNED_BYTE, NULL); + glFlush(); for (size_t i = 0; i < ARRAY_SIZE(map); ++i) glPixelStorei(map[i].t, map[i].o); diff --git a/glwrangle.h b/glwrangle.h index d423f47..428d911 100644 --- a/glwrangle.h +++ b/glwrangle.h @@ -1,5 +1,6 @@ #pragma once +static void (*_glFlush)(void); static GLenum (*_glGetError)(void); static void (*_glGetIntegerv)(GLenum, GLint*); static void (*_glGetFloatv)(GLenum, GLfloat*); @@ -33,6 +34,7 @@ struct gl_version { static enum gl_variant OPENGL_VARIANT; static struct gl_version OPENGL_VERSION; +#define glFlush _glFlush #define glGetError _glGetError #define glGetIntegerv _glGetIntegerv #define glGetFloatv _glGetFloatv @@ -99,6 +101,7 @@ load_gl_function_pointers(void* (*procs[])(const char*), const size_t memb) #define GL_REQUIRED(x) do { if (!(_##x = proc(#x))) { ERRX(EXIT_FAILURE, "Failed to load %s", #x); } } while (0) #define GL_OPTIONAL(x) do { _##x = proc(#x); } while (0) + GL_REQUIRED(glFlush); GL_REQUIRED(glGetError); GL_REQUIRED(glGetIntegerv); GL_REQUIRED(glGetFloatv); -- cgit v1.2.3-70-g09d2