[gtk/wip/chergert/glproto] cleanup our offset/4 hack
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/chergert/glproto] cleanup our offset/4 hack
- Date: Fri, 19 Feb 2021 04:17:57 +0000 (UTC)
commit 644f3dd38e56e2283870ebfc87851def76837dd4
Author: Christian Hergert <chergert redhat com>
Date: Thu Feb 18 20:17:52 2021 -0800
cleanup our offset/4 hack
gsk/next/gskgluniformstateprivate.h | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
---
diff --git a/gsk/next/gskgluniformstateprivate.h b/gsk/next/gskgluniformstateprivate.h
index 41f9f75d52..d084fa27a7 100644
--- a/gsk/next/gskgluniformstateprivate.h
+++ b/gsk/next/gskgluniformstateprivate.h
@@ -144,9 +144,8 @@ gpointer gsk_gl_uniform_state_init_value (GskGLUniformState
guint location,
GskGLUniformInfoElement **infoptr);
-#define gsk_gl_uniform_state_get_uniform_data(state,offset) \
- ((gconstpointer)(state->values_buf + (offset*4)))
-
+#define GSK_GL_UNIFORM_VALUE(base, offset) ((gpointer)((base) + ((offset) * 4)))
+#define gsk_gl_uniform_state_get_uniform_data(state,offset) GSK_GL_UNIFORM_VALUE((state)->values_buf, offset)
#define gsk_gl_uniform_state_snapshot(state, program_info, callback, user_data) \
G_STMT_START { \
for (guint z = 0; z < program_info->n_sparse; z++) \
@@ -192,7 +191,7 @@ gsk_gl_uniform_state_get_value (GskGLUniformState *state,
if G_LIKELY (format == info->info.format && array_count <= info->info.array_count)
{
*infoptr = info;
- return state->values_buf + (info->info.offset*4);
+ return GSK_GL_UNIFORM_VALUE (state->values_buf, info->info.offset);
}
return gsk_gl_uniform_state_init_value (state, program, format, array_count, location, infoptr);
@@ -230,14 +229,14 @@ gsk_gl_uniform_state_realloc (GskGLUniformState *state,
*offset = (state->values_pos + padding) / 4;
state->values_pos += padding + size;
- return state->values_buf + (*offset * 4);
+ return GSK_GL_UNIFORM_VALUE (state->values_buf, *offset);
}
#define GSK_GL_UNIFORM_STATE_REPLACE(info, u, type, count) \
G_STMT_START { \
if ((info)->info.initial && count == (info)->info.array_count) \
{ \
- u = (gpointer)(state->values_buf + ((info)->info.offset*4)); \
+ u = GSK_GL_UNIFORM_VALUE (state->values_buf, (info)->info.offset); \
} \
else \
{ \
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]