[gtk] gl renderer: begin/end_frame around do_render
- From: Timm Bäder <baedert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk] gl renderer: begin/end_frame around do_render
- Date: Tue, 23 Apr 2019 15:27:58 +0000 (UTC)
commit cc878ec00fb527eaa3dd65d06985d0d7431ffe4d
Author: Timm Bäder <mail baedert org>
Date: Mon Apr 22 14:20:02 2019 +0200
gl renderer: begin/end_frame around do_render
This fixes rendering to a texture on intel hardware. The glClear calls
would throw a GL_FRAMEBUFFER_INCOMPLETE error here, because the
gsk_gl_driver_begin_frame() call in do_render() reset the framebuffer
object in use.
gsk/gl/gskgldriver.c | 6 ++++++
gsk/gl/gskgldriverprivate.h | 2 +-
gsk/gl/gskglrenderer.c | 9 +++++----
3 files changed, 12 insertions(+), 5 deletions(-)
---
diff --git a/gsk/gl/gskgldriver.c b/gsk/gl/gskgldriver.c
index ebc3e21349..de90d84d54 100644
--- a/gsk/gl/gskgldriver.c
+++ b/gsk/gl/gskgldriver.c
@@ -206,6 +206,12 @@ gsk_gl_driver_begin_frame (GskGLDriver *self)
#endif
}
+gboolean
+gsk_gl_driver_in_frame (GskGLDriver *self)
+{
+ return self->in_frame;
+}
+
void
gsk_gl_driver_end_frame (GskGLDriver *self)
{
diff --git a/gsk/gl/gskgldriverprivate.h b/gsk/gl/gskgldriverprivate.h
index 8ceecb183a..a73b62b2d0 100644
--- a/gsk/gl/gskgldriverprivate.h
+++ b/gsk/gl/gskgldriverprivate.h
@@ -28,7 +28,7 @@ int gsk_gl_driver_get_max_texture_size (GskGLDriver *driver
void gsk_gl_driver_begin_frame (GskGLDriver *driver);
void gsk_gl_driver_end_frame (GskGLDriver *driver);
-
+gboolean gsk_gl_driver_in_frame (GskGLDriver *driver);
int gsk_gl_driver_get_texture_for_texture (GskGLDriver *driver,
GdkTexture *texture,
int min_filter,
diff --git a/gsk/gl/gskglrenderer.c b/gsk/gl/gskglrenderer.c
index 7d00ecb290..1dafe4521e 100644
--- a/gsk/gl/gskglrenderer.c
+++ b/gsk/gl/gskglrenderer.c
@@ -2911,6 +2911,8 @@ gsk_gl_renderer_do_render (GskRenderer *renderer,
return;
}
+ g_assert (gsk_gl_driver_in_frame (self->gl_driver));
+
/* Set up the modelview and projection matrices to fit our viewport */
graphene_matrix_init_scale (&modelview, scale_factor, scale_factor, 1.0);
graphene_matrix_init_ortho (&projection,
@@ -2922,7 +2924,6 @@ gsk_gl_renderer_do_render (GskRenderer *renderer,
ORTHO_FAR_PLANE);
graphene_matrix_scale (&projection, 1, -1, 1);
- gsk_gl_driver_begin_frame (self->gl_driver);
gsk_gl_glyph_cache_begin_frame (&self->glyph_cache);
gsk_gl_shadow_cache_begin_frame (&self->shadow_cache, self->gl_driver);
@@ -2997,8 +2998,6 @@ gsk_gl_renderer_do_render (GskRenderer *renderer,
gsk_gl_renderer_render_ops (self, render_op_builder.buffer_size);
- gsk_gl_driver_end_frame (self->gl_driver);
-
#ifdef G_ENABLE_DEBUG
gsk_profiler_counter_inc (profiler, self->profile_counters.frames);
@@ -3047,7 +3046,6 @@ gsk_gl_renderer_render_texture (GskRenderer *renderer,
g_assert_cmphex (glCheckFramebufferStatus (GL_FRAMEBUFFER), ==, GL_FRAMEBUFFER_COMPLETE);
gsk_gl_renderer_clear (self);
- gsk_gl_driver_end_frame (self->gl_driver);
/* Render the actual scene */
gsk_gl_renderer_do_render (renderer, root, viewport, fbo_id, 1);
@@ -3057,6 +3055,7 @@ gsk_gl_renderer_render_texture (GskRenderer *renderer,
width, height,
NULL, NULL);
+ gsk_gl_driver_end_frame (self->gl_driver);
gsk_gl_renderer_clear_tree (self);
return texture;
}
@@ -3111,7 +3110,9 @@ gsk_gl_renderer_render (GskRenderer *renderer,
viewport.size.width = gdk_surface_get_width (surface) * self->scale_factor;
viewport.size.height = gdk_surface_get_height (surface) * self->scale_factor;
+ gsk_gl_driver_begin_frame (self->gl_driver);
gsk_gl_renderer_do_render (renderer, root, &viewport, 0, self->scale_factor);
+ gsk_gl_driver_end_frame (self->gl_driver);
gdk_gl_context_make_current (self->gl_context);
gsk_gl_renderer_clear_tree (self);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]