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

Fixes #510
This commit is contained in:
rdb 2022-03-02 09:54:37 +01:00
parent 370b635534
commit 46c1b887ea
21 changed files with 42 additions and 29 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -20,13 +20,14 @@
#include "bullet_utils.h" #include "bullet_utils.h"
#include "luse.h" #include "luse.h"
#include "memoryBase.h"
#include "pandaNode.h" #include "pandaNode.h"
#include "collideMask.h" #include "collideMask.h"
/** /**
* *
*/ */
struct EXPCL_PANDABULLET BulletRayHit { struct EXPCL_PANDABULLET BulletRayHit : public MemoryBase {
PUBLISHED: PUBLISHED:
INLINE static BulletRayHit empty(); 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: PUBLISHED:
INLINE static BulletAllHitsRayResult empty(); INLINE static BulletAllHitsRayResult empty();

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -16,7 +16,7 @@ class FLOATNAME(UnalignedLMatrix4);
/** /**
* This is a 4-by-4 transform matrix. * 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: public:
typedef FLOATTYPE numeric_type; typedef FLOATTYPE numeric_type;
typedef const FLOATTYPE *iterator; typedef const FLOATTYPE *iterator;

View File

@ -20,7 +20,7 @@ class FLOATNAME(UnalignedLVecBase4);
/** /**
* This is the base class for all three-component vectors and points. * 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: PUBLISHED:
typedef FLOATTYPE numeric_type; typedef FLOATTYPE numeric_type;
typedef const FLOATTYPE *iterator; typedef const FLOATTYPE *iterator;

View File

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

View File

@ -16,6 +16,7 @@
#include "pandabase.h" #include "pandabase.h"
#include "luse.h" #include "luse.h"
#include "memoryBase.h"
#include "vector_int.h" #include "vector_int.h"
/** /**
@ -29,7 +30,7 @@
* *
* It works strictly on 2-d points. See Triangulator3 for 3-d points. * 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: PUBLISHED:
Triangulator(); Triangulator();

View File

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

View File

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

View File

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

View File

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