[Cogl] [PATCH] Remove padding from eulers and quaternions

Robert Bragg robert at sixbynine.org
Mon Oct 14 10:16:22 PDT 2013


From: Robert Bragg <robert at linux.intel.com>

One of the notable advantages of a Euler representation of a rotation is
that it is compact but we negate that benefit if all CoglEulers have
enough padding to potentially cache a quaternion in the future. Having
padding for all CoglQuaternions is probably also unnecessary as higher
level code can find its own ways of caching data relating to
quaternions.
---
 cogl/cogl-euler.h      | 10 +---------
 cogl/cogl-quaternion.h |  8 +-------
 2 files changed, 2 insertions(+), 16 deletions(-)

diff --git a/cogl/cogl-euler.h b/cogl/cogl-euler.h
index bf526d7..c73cc81 100644
--- a/cogl/cogl-euler.h
+++ b/cogl/cogl-euler.h
@@ -146,16 +146,8 @@ struct _CoglEuler
   float heading;
   float pitch;
   float roll;
-
-  /*< private > */
-  /* May cached a quaternion here in the future */
-  float padding0;
-  float padding1;
-  float padding2;
-  float padding3;
-  float padding4;
 };
-COGL_STRUCT_SIZE_ASSERT (CoglEuler, 32);
+COGL_STRUCT_SIZE_ASSERT (CoglEuler, 12);
 
 /**
  * cogl_euler_init:
diff --git a/cogl/cogl-quaternion.h b/cogl/cogl-quaternion.h
index 02be22e..5db274c 100644
--- a/cogl/cogl-quaternion.h
+++ b/cogl/cogl-quaternion.h
@@ -128,14 +128,8 @@ struct _CoglQuaternion
   float x;
   float y;
   float z;
-
-  /*< private >*/
-  float padding0;
-  float padding1;
-  float padding2;
-  float padding3;
 };
-COGL_STRUCT_SIZE_ASSERT (CoglQuaternion, 32);
+COGL_STRUCT_SIZE_ASSERT (CoglQuaternion, 16);
 
 /**
  * cogl_quaternion_init:
-- 
1.8.3.1



More information about the Cogl mailing list