[gtk/wip/chergert/glproto: 61/94] more assertions
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/chergert/glproto: 61/94] more assertions
- Date: Fri, 1 Jan 2021 21:30:48 +0000 (UTC)
commit cb149ceb013183bff32a42923d7ab81cd71b02fe
Author: Christian Hergert <chergert redhat com>
Date: Mon Dec 28 10:29:26 2020 -0800
more assertions
gsk/next/gskglcommandqueue.c | 2 ++
gsk/next/gskgluniformstate.c | 11 ++++++-----
2 files changed, 8 insertions(+), 5 deletions(-)
---
diff --git a/gsk/next/gskglcommandqueue.c b/gsk/next/gskglcommandqueue.c
index 8c1cecf523..df72c4c70b 100644
--- a/gsk/next/gskglcommandqueue.c
+++ b/gsk/next/gskglcommandqueue.c
@@ -1008,6 +1008,8 @@ gsk_gl_command_queue_execute (GskGLCommandQueue *self)
guint index = batch->draw.uniform_offset + i;
GskGLCommandUniform *u = &g_array_index (self->batch_uniforms, GskGLCommandUniform, index);
+ g_assert (index < self->batch_uniforms->len);
+
apply_uniform (self->uniforms, &u->info, u->location);
}
}
diff --git a/gsk/next/gskgluniformstate.c b/gsk/next/gskgluniformstate.c
index c9dd6293e6..29bee45074 100644
--- a/gsk/next/gskgluniformstate.c
+++ b/gsk/next/gskgluniformstate.c
@@ -61,11 +61,12 @@ static guint8 uniform_sizes[] = {
0,
};
-#define REPLACE_UNIFORM(info, u, format, count) \
- G_STMT_START { \
- guint offset; \
- u = alloc_uniform_data(state->uniform_data, uniform_sizes[format] * count, &offset); \
- (info)->offset = offset; \
+#define REPLACE_UNIFORM(info, u, format, count) \
+ G_STMT_START { \
+ guint offset; \
+ g_assert (uniform_sizes[format] > 0); \
+ u = alloc_uniform_data(state->uniform_data, uniform_sizes[format] * MAX (1, count), &offset); \
+ (info)->offset = offset; \
} G_STMT_END
typedef struct
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]