Browse Source

Fix heap alignment with SSE2 on 32-bit Windows by inheriting MemoryBase

Fixes #510
rdb 3 years ago
parent
commit
46c1b887ea

+ 5 - 5
contrib/src/rplight/shadowSource.h

@@ -30,6 +30,7 @@
 
 #include "pandabase.h"
 #include "luse.h"
+#include "memoryBase.h"
 #include "transformState.h"
 #include "look_at.h"
 #include "compose_matrix.h"
@@ -48,7 +49,7 @@
  *   and a view-projection matrix. The shadow manager regenerates the shadow maps
  *   using the data from the shadow sources.
  */
-class ShadowSource {
+class ShadowSource : public MemoryBase {
 public:
   ShadowSource();
 
@@ -78,14 +79,13 @@ public:
   inline const BoundingSphere& get_bounds() const;
 
 private:
-  int _slot;
-  bool _needs_update;
-  size_t _resolution;
   LMatrix4 _mvp;
   LVecBase4i _region;
   LVecBase4 _region_uv;
-
   BoundingSphere _bounds;
+  int _slot;
+  bool _needs_update;
+  size_t _resolution;
 };
 
 #include "shadowSource.I"

+ 2 - 1
direct/src/motiontrail/cMotionTrail.h

@@ -21,11 +21,12 @@
 #include "geomVertexWriter.h"
 #include "geomTriangles.h"
 #include "luse.h"
+#include "memoryBase.h"
 #include "nurbsCurveEvaluator.h"
 #include "plist.h"
 #include "epvector.h"
 
-class CMotionTrailVertex {
+class CMotionTrailVertex : public MemoryBase {
 public:
   LPoint4 _vertex;
   LVecBase4 _start_color;

+ 1 - 0
dtool/src/prc/configFlags.h

@@ -17,6 +17,7 @@
 #include "dtoolbase.h"
 #include "numeric_types.h"
 #include "atomicAdjust.h"
+#include "memoryBase.h"
 
 /**
  * This class is the base class of both ConfigVariable and ConfigVariableCore.

+ 2 - 1
dtool/src/prc/configVariableBase.h

@@ -21,6 +21,7 @@
 #include "configVariableManager.h"
 #include "vector_string.h"
 #include "pset.h"
+#include "memoryBase.h"
 
 // Use this macro to wrap around a description passed to a ConfigVariable
 // constructor.  This allows the description to be completely compiled out, so
@@ -42,7 +43,7 @@
  * and/or ConfigDeclaration, more or less duplicating the interface presented
  * there.
  */
-class EXPCL_DTOOL_PRC ConfigVariableBase : public ConfigFlags {
+class EXPCL_DTOOL_PRC ConfigVariableBase : public ConfigFlags, public MemoryBase {
 protected:
   INLINE ConfigVariableBase(const std::string &name, ValueType type);
   ConfigVariableBase(const std::string &name, ValueType type,

+ 2 - 1
dtool/src/prc/configVariableCore.h

@@ -18,6 +18,7 @@
 #include "configFlags.h"
 #include "configPageManager.h"
 #include "pnotify.h"
+#include "memoryBase.h"
 
 #include <vector>
 
@@ -31,7 +32,7 @@ class ConfigDeclaration;
  * make() method, which may return a shared instance.  Once created, these
  * objects are never destructed.
  */
-class EXPCL_DTOOL_PRC ConfigVariableCore : public ConfigFlags {
+class EXPCL_DTOOL_PRC ConfigVariableCore : public ConfigFlags, public MemoryBase {
 private:
   ConfigVariableCore(const std::string &name);
   ConfigVariableCore(const ConfigVariableCore &templ, const std::string &name);

+ 3 - 2
panda/src/bullet/bulletAllHitsRayResult.h

@@ -20,13 +20,14 @@
 #include "bullet_utils.h"
 
 #include "luse.h"
+#include "memoryBase.h"
 #include "pandaNode.h"
 #include "collideMask.h"
 
 /**
  *
  */
-struct EXPCL_PANDABULLET BulletRayHit {
+struct EXPCL_PANDABULLET BulletRayHit : public MemoryBase {
 
 PUBLISHED:
   INLINE static BulletRayHit empty();
@@ -61,7 +62,7 @@ private:
 /**
  *
  */
-struct EXPCL_PANDABULLET BulletAllHitsRayResult : public btCollisionWorld::AllHitsRayResultCallback {
+struct EXPCL_PANDABULLET BulletAllHitsRayResult : public btCollisionWorld::AllHitsRayResultCallback, public MemoryBase {
 
 PUBLISHED:
   INLINE static BulletAllHitsRayResult empty();

+ 2 - 1
panda/src/bullet/bulletClosestHitRayResult.h

@@ -20,13 +20,14 @@
 #include "bullet_utils.h"
 
 #include "luse.h"
+#include "memoryBase.h"
 #include "pandaNode.h"
 #include "collideMask.h"
 
 /**
  *
  */
-struct EXPCL_PANDABULLET BulletClosestHitRayResult : public btCollisionWorld::ClosestRayResultCallback {
+struct EXPCL_PANDABULLET BulletClosestHitRayResult : public btCollisionWorld::ClosestRayResultCallback, public MemoryBase {
 
 PUBLISHED:
   INLINE static BulletClosestHitRayResult empty();

+ 2 - 1
panda/src/bullet/bulletClosestHitSweepResult.h

@@ -20,13 +20,14 @@
 #include "bullet_utils.h"
 
 #include "luse.h"
+#include "memoryBase.h"
 #include "pandaNode.h"
 #include "collideMask.h"
 
 /**
  *
  */
-struct EXPCL_PANDABULLET BulletClosestHitSweepResult : public btCollisionWorld::ClosestConvexResultCallback {
+struct EXPCL_PANDABULLET BulletClosestHitSweepResult : public btCollisionWorld::ClosestConvexResultCallback, public MemoryBase {
 
 PUBLISHED:
   INLINE static BulletClosestHitSweepResult empty();

+ 1 - 1
panda/src/device/inputDeviceManager.h

@@ -30,7 +30,7 @@ class WinRawInputDevice;
  *
  * @since 1.10.0
  */
-class EXPCL_PANDA_DEVICE InputDeviceManager {
+class EXPCL_PANDA_DEVICE InputDeviceManager : public MemoryBase {
 protected:
   InputDeviceManager();
   ~InputDeviceManager() = default;

+ 1 - 1
panda/src/device/trackerData.h

@@ -20,7 +20,7 @@
 /**
  * Stores the kinds of data that a tracker might output.
  */
-class EXPCL_PANDA_DEVICE TrackerData {
+class EXPCL_PANDA_DEVICE TrackerData : public MemoryBase {
 public:
   INLINE TrackerData();
   INLINE TrackerData(const TrackerData &copy);

+ 2 - 1
panda/src/egg/eggTransform.h

@@ -16,6 +16,7 @@
 
 #include "pandabase.h"
 #include "luse.h"
+#include "memoryBase.h"
 #include "eggObject.h"
 
 /**
@@ -26,7 +27,7 @@
  * This may be either a 3-d transform, and therefore described by a 4x4
  * matrix, or a 2-d transform, described by a 3x3 matrix.
  */
-class EXPCL_PANDA_EGG EggTransform {
+class EXPCL_PANDA_EGG EggTransform : public MemoryBase {
 PUBLISHED:
   EggTransform();
   EggTransform(const EggTransform &copy);

+ 2 - 2
panda/src/gobj/samplerState.h

@@ -17,8 +17,8 @@
 #include "pandabase.h"
 
 #include "typedObject.h"
-#include "namable.h"
 #include "luse.h"
+#include "memoryBase.h"
 #include "numeric_types.h"
 #include "bamReader.h"
 #include "config_gobj.h"
@@ -33,7 +33,7 @@ class SamplerContext;
  * can be used to sample the same texture using different settings in
  * different places.
  */
-class EXPCL_PANDA_GOBJ SamplerState {
+class EXPCL_PANDA_GOBJ SamplerState : public MemoryBase {
 PUBLISHED:
   enum FilterType {
     // Mag Filter and Min Filter

+ 4 - 4
panda/src/grutil/shaderTerrainMesh.h

@@ -102,7 +102,7 @@ private:
                                        Thread *current_thread) const;
 
   // Chunk data
-  struct Chunk {
+  struct Chunk : public MemoryBase {
     // Depth, starting at 0
     size_t depth;
 
@@ -115,12 +115,12 @@ private:
     // Children, in the order (0, 0) (1, 0) (0, 1) (1, 1)
     Chunk* children[4];
 
-    // Chunk heights, used for culling
-    PN_stdfloat avg_height, min_height, max_height;
-
     // Edge heights, used for lod computation, in the same order as the children
     LVector4 edges;
 
+    // Chunk heights, used for culling
+    PN_stdfloat avg_height, min_height, max_height;
+
     // Last CLOD factor, stored while computing LOD, used for seamless transitions between lods
     PN_stdfloat last_clod;
 

+ 1 - 1
panda/src/linmath/lmatrix4_src.h

@@ -16,7 +16,7 @@ class FLOATNAME(UnalignedLMatrix4);
 /**
  * This is a 4-by-4 transform matrix.
  */
-class EXPCL_PANDA_LINMATH ALIGN_LINMATH FLOATNAME(LMatrix4) {
+class EXPCL_PANDA_LINMATH ALIGN_LINMATH FLOATNAME(LMatrix4) : public MemoryBase {
 public:
   typedef FLOATTYPE numeric_type;
   typedef const FLOATTYPE *iterator;

+ 1 - 1
panda/src/linmath/lvecBase4_src.h

@@ -20,7 +20,7 @@ class FLOATNAME(UnalignedLVecBase4);
 /**
  * This is the base class for all three-component vectors and points.
  */
-class EXPCL_PANDA_LINMATH ALIGN_LINMATH FLOATNAME(LVecBase4) {
+class EXPCL_PANDA_LINMATH ALIGN_LINMATH FLOATNAME(LVecBase4) : public MemoryBase {
 PUBLISHED:
   typedef FLOATTYPE numeric_type;
   typedef const FLOATTYPE *iterator;

+ 2 - 1
panda/src/mathutil/perlinNoise.h

@@ -18,6 +18,7 @@
 #include "pvector.h"
 #include "vector_int.h"
 #include "luse.h"
+#include "memoryBase.h"
 #include "randomizer.h"
 
 /**
@@ -25,7 +26,7 @@
  * dimensions of Perlin noise implementation.  The base class just collects
  * the common functionality.
  */
-class EXPCL_PANDA_MATHUTIL PerlinNoise {
+class EXPCL_PANDA_MATHUTIL PerlinNoise : public MemoryBase {
 protected:
   PerlinNoise(int table_size, unsigned long seed);
   PerlinNoise(const PerlinNoise &copy);

+ 2 - 1
panda/src/mathutil/triangulator.h

@@ -16,6 +16,7 @@
 
 #include "pandabase.h"
 #include "luse.h"
+#include "memoryBase.h"
 #include "vector_int.h"
 
 /**
@@ -29,7 +30,7 @@
  *
  * It works strictly on 2-d points.  See Triangulator3 for 3-d points.
  */
-class EXPCL_PANDA_MATHUTIL Triangulator {
+class EXPCL_PANDA_MATHUTIL Triangulator : public MemoryBase {
 PUBLISHED:
   Triangulator();
 

+ 1 - 1
panda/src/pgraph/shaderInput.h

@@ -37,7 +37,7 @@
  * This is a small container class that can hold any one of the value types
  * that can be passed as input to a shader.
  */
-class EXPCL_PANDA_PGRAPH ShaderInput {
+class EXPCL_PANDA_PGRAPH ShaderInput : public MemoryBase {
 PUBLISHED:
   // Used when binding texture images.
   enum AccessFlags {

+ 2 - 1
panda/src/pnmimage/pnmImageHeader.h

@@ -20,6 +20,7 @@
 
 #include "typedObject.h"
 #include "filename.h"
+#include "memoryBase.h"
 #include "pnotify.h"
 #include "pmap.h"
 #include "pvector.h"
@@ -37,7 +38,7 @@ class PNMWriter;
  * image except the image data itself.  It's the sort of information you
  * typically read from the image file's header.
  */
-class EXPCL_PANDA_PNMIMAGE PNMImageHeader {
+class EXPCL_PANDA_PNMIMAGE PNMImageHeader : public MemoryBase {
 PUBLISHED:
   INLINE PNMImageHeader();
   INLINE PNMImageHeader(const PNMImageHeader &copy);

+ 2 - 1
panda/src/text/textGraphic.h

@@ -17,6 +17,7 @@
 #include "pandabase.h"
 
 #include "config_text.h"
+#include "memoryBase.h"
 #include "nodePath.h"
 
 /**
@@ -34,7 +35,7 @@
  * within this rectangle, but if it does not, it may visually overlap with
  * nearby text.
  */
-class EXPCL_PANDA_TEXT TextGraphic {
+class EXPCL_PANDA_TEXT TextGraphic : public MemoryBase {
 PUBLISHED:
   INLINE TextGraphic();
   INLINE explicit TextGraphic(const NodePath &model, const LVecBase4 &frame);

+ 2 - 1
panda/src/text/textProperties.h

@@ -18,6 +18,7 @@
 
 #include "config_text.h"
 #include "luse.h"
+#include "memoryBase.h"
 #include "textFont.h"
 #include "pointerTo.h"
 #include "renderState.h"
@@ -38,7 +39,7 @@
  * the string; each nested TextProperties structure modifies the appearance of
  * subsequent text within the block.
  */
-class EXPCL_PANDA_TEXT TextProperties {
+class EXPCL_PANDA_TEXT TextProperties : public MemoryBase {
 PUBLISHED:
   enum Alignment {
     A_left,