[gtk/wip/chergert/glproto: 918/920] cleanup a bit
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/chergert/glproto: 918/920] cleanup a bit
- Date: Mon, 8 Feb 2021 19:15:49 +0000 (UTC)
commit ebcef6c6dd84a61233e548c0c29683380b3e9abc
Author: Christian Hergert <chergert redhat com>
Date: Mon Feb 8 10:34:57 2021 -0800
cleanup a bit
gsk/next/gskglcommandqueue.c | 22 ++++++++++++++++------
1 file changed, 16 insertions(+), 6 deletions(-)
---
diff --git a/gsk/next/gskglcommandqueue.c b/gsk/next/gskglcommandqueue.c
index 13bb3e27f1..5dc9159c3f 100644
--- a/gsk/next/gskglcommandqueue.c
+++ b/gsk/next/gskglcommandqueue.c
@@ -761,6 +761,20 @@ apply_scissor (gboolean *state,
}
}
+static inline gboolean
+apply_framebuffer (int *framebuffer,
+ guint new_framebuffer)
+{
+ if G_UNLIKELY (new_framebuffer != *framebuffer)
+ {
+ *framebuffer = new_framebuffer;
+ glBindFramebuffer (GL_FRAMEBUFFER, new_framebuffer);
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
/**
* gsk_gl_command_queue_execute:
* @self: a #GskGLCommandQueue
@@ -859,10 +873,8 @@ gsk_gl_command_queue_execute (GskGLCommandQueue *self,
switch (batch->any.kind)
{
case GSK_GL_COMMAND_KIND_CLEAR:
- if G_UNLIKELY (batch->clear.framebuffer != framebuffer)
+ if (apply_framebuffer (&framebuffer, batch->clear.framebuffer))
{
- framebuffer = batch->clear.framebuffer;
- glBindFramebuffer (GL_FRAMEBUFFER, framebuffer);
apply_scissor (&scissor_state, framebuffer, &scissor_test, has_scissor);
n_fbos++;
}
@@ -895,10 +907,8 @@ gsk_gl_command_queue_execute (GskGLCommandQueue *self,
glUseProgram (program);
}
- if G_UNLIKELY (batch->draw.framebuffer != framebuffer)
+ if (apply_framebuffer (&framebuffer, batch->draw.framebuffer))
{
- framebuffer = batch->draw.framebuffer;
- glBindFramebuffer (GL_FRAMEBUFFER, framebuffer);
apply_scissor (&scissor_state, framebuffer, &scissor_test, has_scissor);
n_fbos++;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]