From cb714f19e1028d451994a91191a3c921b66cbbb4 Mon Sep 17 00:00:00 2001 From: Antoine Martin Date: Wed, 16 Nov 2016 03:30:39 +0000 Subject: [PATCH] #1358: deal with glClear exceptions more gracefully: log a warning and try to continue anyway git-svn-id: https://xpra.org/svn/Xpra/trunk@14431 3bb7dfac-3a0b-4e04-842a-767bc560f471 --- src/xpra/client/gl/gl_window_backing_base.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/xpra/client/gl/gl_window_backing_base.py b/src/xpra/client/gl/gl_window_backing_base.py index 253a1884b6..c24979848a 100644 --- a/src/xpra/client/gl/gl_window_backing_base.py +++ b/src/xpra/client/gl/gl_window_backing_base.py @@ -432,13 +432,21 @@ def gl_init(self): if self.textures is None: self.gl_init_textures() + def clear_fbo(): + try: + glClear(GL_COLOR_BUFFER_BIT) + except Exception as e: + log("glClear error", exc_info=True) + log.warn("Warning: failed to clear FBO") + log.warn(" %r", e) + # Define empty tmp FBO glBindTexture(GL_TEXTURE_RECTANGLE_ARB, self.textures[TEX_TMP_FBO]) set_texture_level() glTexImage2D(GL_TEXTURE_RECTANGLE_ARB, 0, self.texture_pixel_format, w, h, 0, self.texture_pixel_format, GL_UNSIGNED_BYTE, None) glBindFramebuffer(GL_FRAMEBUFFER, self.tmp_fbo) glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_RECTANGLE_ARB, self.textures[TEX_TMP_FBO], 0) - glClear(GL_COLOR_BUFFER_BIT) + clear_fbo() # Define empty FBO texture and set rendering to FBO glBindTexture(GL_TEXTURE_RECTANGLE_ARB, self.textures[TEX_FBO]) @@ -447,7 +455,7 @@ def gl_init(self): glTexImage2D(GL_TEXTURE_RECTANGLE_ARB, 0, self.texture_pixel_format, w, h, 0, self.texture_pixel_format, GL_UNSIGNED_BYTE, None) glBindFramebuffer(GL_FRAMEBUFFER, self.offscreen_fbo) glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_RECTANGLE_ARB, self.textures[TEX_FBO], 0) - glClear(GL_COLOR_BUFFER_BIT) + clear_fbo() # Create and assign fragment programs if not self.shaders: