[gtk/wip/chergert/glproto] more assertions
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/chergert/glproto] more assertions
- Date: Fri, 19 Feb 2021 04:09:26 +0000 (UTC)
commit 4c0febbccfca60a60a962205904719736f11ccd4
Author: Christian Hergert <chergert redhat com>
Date: Thu Feb 18 19:51:56 2021 -0800
more assertions
gsk/next/gskgluniformstate.c | 6 ++++++
1 file changed, 6 insertions(+)
---
diff --git a/gsk/next/gskgluniformstate.c b/gsk/next/gskgluniformstate.c
index 8345accdb1..ec133d3cc6 100644
--- a/gsk/next/gskgluniformstate.c
+++ b/gsk/next/gskgluniformstate.c
@@ -105,7 +105,10 @@ gsk_gl_uniform_state_init_value (GskGLUniformState *state,
g_assert ((int)format >= 0 && format < GSK_GL_UNIFORM_FORMAT_LAST);
g_assert (format > 0);
g_assert (program != NULL);
+ g_assert (program->sparse != NULL);
+ g_assert (program->n_sparse < program->n_uniforms);
g_assert (location < GL_MAX_UNIFORM_LOCATIONS || location == (guint)-1);
+ g_assert (location < program->n_uniforms);
/* Handle unused uniforms gracefully */
if G_UNLIKELY (location == (guint)-1)
@@ -243,6 +246,9 @@ gsk_gl_uniform_state_get_program (GskGLUniformState *state,
gsize sparse_size = n_uniforms * sizeof (guint);
gsize size = sizeof (GskGLUniformProgram) + uniform_size + sparse_size;
+ /* Must be multiple of 4 for space pointer to align */
+ G_STATIC_ASSERT (sizeof (GskGLUniformInfoElement) == 8);
+
ret = g_malloc0 (size);
ret->program_id = program;
ret->n_uniforms = n_uniforms;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]