[gtk/wip/chergert/glproto] next: warn once if we truncate batches
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/chergert/glproto] next: warn once if we truncate batches
- Date: Tue, 23 Feb 2021 19:35:23 +0000 (UTC)
commit 129f5841e4ce75a76abfd95d58491af84cfc6c04
Author: Christian Hergert <chergert redhat com>
Date: Tue Feb 23 11:31:56 2021 -0800
next: warn once if we truncate batches
gsk/next/gskglcommandqueue.c | 22 ++++++++++++++++++----
gsk/next/gskglcommandqueueprivate.h | 3 +++
2 files changed, 21 insertions(+), 4 deletions(-)
---
diff --git a/gsk/next/gskglcommandqueue.c b/gsk/next/gskglcommandqueue.c
index 622502af03..10e5f2fae4 100644
--- a/gsk/next/gskglcommandqueue.c
+++ b/gsk/next/gskglcommandqueue.c
@@ -229,6 +229,21 @@ gsk_gl_command_queue_capture_png (GskGLCommandQueue *self,
g_free (data);
}
+static inline gboolean
+will_ignore_batch (GskGLCommandQueue *self)
+{
+ if G_LIKELY (self->batches.len < G_MAXINT16)
+ return FALSE;
+
+ if (!self->have_truncated)
+ {
+ self->have_truncated = TRUE;
+ g_critical ("GL command queue too large, truncating further batches.");
+ }
+
+ return TRUE;
+}
+
static inline guint
snapshot_attachments (const GskGLAttachmentState *state,
GskGLCommandBinds *array)
@@ -499,7 +514,7 @@ gsk_gl_command_queue_begin_draw (GskGLCommandQueue *self,
/* Our internal links use 16-bits, so that is our max number
* of batches we can have in one frame.
*/
- if (self->batches.len == G_MAXINT16)
+ if (will_ignore_batch (self))
return;
self->program_info = program;
@@ -532,8 +547,7 @@ gsk_gl_command_queue_end_draw (GskGLCommandQueue *self)
g_assert (GSK_IS_GL_COMMAND_QUEUE (self));
g_assert (self->batches.len > 0);
- /* Max batches is 16-bit */
- if (self->batches.len == G_MAXINT16)
+ if (will_ignore_batch (self))
return;
batch = gsk_gl_command_batches_tail (&self->batches);
@@ -648,7 +662,7 @@ gsk_gl_command_queue_clear (GskGLCommandQueue *self,
g_assert (GSK_IS_GL_COMMAND_QUEUE (self));
g_assert (self->in_draw == FALSE);
- if (self->batches.len == G_MAXINT16)
+ if (will_ignore_batch (self))
return;
if (clear_bits == 0)
diff --git a/gsk/next/gskglcommandqueueprivate.h b/gsk/next/gskglcommandqueueprivate.h
index 39d6fd0315..706a7ca03f 100644
--- a/gsk/next/gskglcommandqueueprivate.h
+++ b/gsk/next/gskglcommandqueueprivate.h
@@ -263,6 +263,9 @@ struct _GskGLCommandQueue
/* If we're inside of a begin_draw()/end_draw() pair. */
guint in_draw : 1;
+
+ /* If we've warned about truncating batches */
+ guint have_truncated : 1;
};
GskGLCommandQueue *gsk_gl_command_queue_new (GdkGLContext *context,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]