vrend: Clean error state before querying the features

We don't know whether the caller cleans up the error states they are
responsible for, so do this here. This is needed to correctly query
some features, because otherwise checks that rely on correct error
reporting might give the wrong result.

v2: Log stale error codes (Gurchetan)

Closes #148

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
macos/master
Gert Wollny 5 years ago
parent 4e40b7aef1
commit 3ec182aaf7
  1. 7
      src/vrend_renderer.c

@ -9797,6 +9797,7 @@ void vrend_renderer_fill_caps(uint32_t set, UNUSED uint32_t version,
union virgl_caps *caps)
{
int gl_ver, gles_ver;
GLenum err;
bool fill_capset2 = false;
if (!caps)
@ -9816,6 +9817,12 @@ void vrend_renderer_fill_caps(uint32_t set, UNUSED uint32_t version,
fill_capset2 = true;
}
/* We don't want to deal with stale error states that the caller might not
* have cleaned up propperly, so read the error state until we are okay.
*/
while ((err = glGetError()) != GL_NO_ERROR)
vrend_printf("%s: Entering with stale GL error: %d\n", __func__, err);
if (vrend_state.use_gles) {
gles_ver = epoxy_gl_version();
gl_ver = 0;

Loading…
Cancel
Save