[gtk] gl renderer: Ignore subsequent render target ops



commit 57efdcfbbef4fb63aba0f8c829733d40f3c5ea5b
Author: Timm Bäder <mail baedert org>
Date:   Wed Dec 5 10:37:02 2018 +0100

    gl renderer: Ignore subsequent render target ops

 gsk/gl/gskglrenderops.c | 25 ++++++++++++++++++++++---
 1 file changed, 22 insertions(+), 3 deletions(-)
---
diff --git a/gsk/gl/gskglrenderops.c b/gsk/gl/gskglrenderops.c
index dc85c2e8f5..9b2e299ebe 100644
--- a/gsk/gl/gskglrenderops.c
+++ b/gsk/gl/gskglrenderops.c
@@ -426,9 +426,28 @@ ops_set_render_target (RenderOpBuilder *builder,
     return render_target_id;
 
   prev_render_target = builder->current_render_target;
-  op.op = OP_CHANGE_RENDER_TARGET;
-  op.render_target_id = render_target_id;
-  g_array_append_val (builder->render_ops, op);
+
+  if (builder->render_ops->len > 0)
+    {
+      RenderOp *last_op = &g_array_index (builder->render_ops, RenderOp, builder->render_ops->len - 1);
+      if (last_op->op == OP_CHANGE_RENDER_TARGET)
+        {
+          last_op->render_target_id = render_target_id;
+        }
+      else
+        {
+          op.op = OP_CHANGE_RENDER_TARGET;
+          op.render_target_id = render_target_id;
+          g_array_append_val (builder->render_ops, op);
+        }
+    }
+  else
+    {
+      op.op = OP_CHANGE_RENDER_TARGET;
+      op.render_target_id = render_target_id;
+      g_array_append_val (builder->render_ops, op);
+    }
+
   builder->current_render_target = render_target_id;
 
   return prev_render_target;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]