Skip to content

Commit

Permalink
#1358: deal with glClear exceptions more gracefully: log a warning an…
Browse files Browse the repository at this point in the history
…d try to continue anyway

git-svn-id: https://xpra.org/svn/Xpra/trunk@14431 3bb7dfac-3a0b-4e04-842a-767bc560f471
  • Loading branch information
totaam committed Nov 16, 2016
1 parent 70987a0 commit cb714f1
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/xpra/client/gl/gl_window_backing_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Expand All @@ -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:
Expand Down

0 comments on commit cb714f1

Please sign in to comment.