[Mesa-dev] [PATCH 27/28] mesa: move ADD_POINTERS to macros.h

Dylan Baker dylan at pnwbakers.com
Fri Nov 9 18:40:20 UTC 2018


I'm not really sure where else to put it. Since imports.h only has two
things left in it (neither of which are abstractions for smoothing away
libc differences) I'd like to get them out of there. macros.h is the
only place I can think of to put this macro.
---
 src/mesa/main/imports.h    | 9 ---------
 src/mesa/main/macros.h     | 9 +++++++++
 src/mesa/main/pbo.c        | 2 +-
 src/mesa/tnl/t_rebase.c    | 2 +-
 src/mesa/vbo/vbo_private.h | 1 +
 5 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/src/mesa/main/imports.h b/src/mesa/main/imports.h
index f51e9d9b7a6..a357cd84992 100644
--- a/src/mesa/main/imports.h
+++ b/src/mesa/main/imports.h
@@ -47,15 +47,6 @@
 extern "C" {
 #endif
 
-/*
- * For GL_ARB_vertex_buffer_object we need to treat vertex array pointers
- * as offsets into buffer stores.  Since the vertex array pointer and
- * buffer store pointer are both pointers and we need to add them, we use
- * this macro.
- * Both pointers/offsets are expressed in bytes.
- */
-#define ADD_POINTERS(A, B)  ( (GLubyte *) (A) + (uintptr_t) (B) )
-
 
 /**
  * Sometimes we treat GLfloats as GLints.  On x86 systems, moving a float
diff --git a/src/mesa/main/macros.h b/src/mesa/main/macros.h
index 6547706b6fe..97d48c42df4 100644
--- a/src/mesa/main/macros.h
+++ b/src/mesa/main/macros.h
@@ -808,4 +808,13 @@ DIFFERENT_SIGNS(GLfloat x, GLfloat y)
 /* Stringify */
 #define STRINGIFY(x) #x
 
+/*
+ * For GL_ARB_vertex_buffer_object we need to treat vertex array pointers
+ * as offsets into buffer stores.  Since the vertex array pointer and
+ * buffer store pointer are both pointers and we need to add them, we use
+ * this macro.
+ * Both pointers/offsets are expressed in bytes.
+ */
+#define ADD_POINTERS(A, B)  ( (GLubyte *) (A) + (uintptr_t) (B) )
+
 #endif
diff --git a/src/mesa/main/pbo.c b/src/mesa/main/pbo.c
index cea55f2a0d2..0f74d326d03 100644
--- a/src/mesa/main/pbo.c
+++ b/src/mesa/main/pbo.c
@@ -36,8 +36,8 @@
 #include "bufferobj.h"
 #include "glformats.h"
 #include "image.h"
-#include "imports.h"
 #include "mtypes.h"
+#include "macros.h"
 #include "pbo.h"
 
 
diff --git a/src/mesa/tnl/t_rebase.c b/src/mesa/tnl/t_rebase.c
index b6950e04fec..242fef2ee1a 100644
--- a/src/mesa/tnl/t_rebase.c
+++ b/src/mesa/tnl/t_rebase.c
@@ -50,7 +50,7 @@
 #include "main/bufferobj.h"
 #include "main/errors.h"
 #include "main/glheader.h"
-#include "main/imports.h"
+#include "main/macros.h"
 #include "main/mtypes.h"
 #include "vbo/vbo.h"
 
diff --git a/src/mesa/vbo/vbo_private.h b/src/mesa/vbo/vbo_private.h
index 86f6b41b793..4cbadbdef16 100644
--- a/src/mesa/vbo/vbo_private.h
+++ b/src/mesa/vbo/vbo_private.h
@@ -36,6 +36,7 @@
 #include "vbo/vbo_exec.h"
 #include "vbo/vbo_save.h"
 #include "main/varray.h"
+#include "main/macros.h"
 
 
 struct _glapi_table;
-- 
2.19.1



More information about the mesa-dev mailing list