mirror of
https://github.com/overte-org/overte.git
synced 2025-08-10 08:23:04 +02:00
added SIMPLE_CHILD_ARRAY implementation to temporarily work around memory corruption
This commit is contained in:
parent
ce524714d9
commit
e3c64429b9
2 changed files with 25 additions and 1 deletions
|
@ -76,6 +76,11 @@ void VoxelNode::init(unsigned char * octalCode) {
|
||||||
}
|
}
|
||||||
#endif // def HAS_AUDIT_CHILDREN
|
#endif // def HAS_AUDIT_CHILDREN
|
||||||
|
|
||||||
|
#ifdef SIMPLE_CHILD_ARRAY
|
||||||
|
for (int i = 0; i < NUMBER_OF_CHILDREN; i++) {
|
||||||
|
_simpleChildArray[i] = NULL;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
_unknownBufferIndex = true;
|
_unknownBufferIndex = true;
|
||||||
setBufferIndex(GLBUFFER_INDEX_UNKNOWN);
|
setBufferIndex(GLBUFFER_INDEX_UNKNOWN);
|
||||||
|
@ -320,6 +325,9 @@ uint64_t VoxelNode::_couldStoreFourChildrenInternally = 0;
|
||||||
uint64_t VoxelNode::_couldNotStoreFourChildrenInternally = 0;
|
uint64_t VoxelNode::_couldNotStoreFourChildrenInternally = 0;
|
||||||
|
|
||||||
VoxelNode* VoxelNode::getChildAtIndex(int childIndex) const {
|
VoxelNode* VoxelNode::getChildAtIndex(int childIndex) const {
|
||||||
|
#ifdef SIMPLE_CHILD_ARRAY
|
||||||
|
return _simpleChildArray[childIndex];
|
||||||
|
#else
|
||||||
PerformanceWarning warn(false,"getChildAtIndex",false,&_getChildAtIndexTime,&_getChildAtIndexCalls);
|
PerformanceWarning warn(false,"getChildAtIndex",false,&_getChildAtIndexTime,&_getChildAtIndexCalls);
|
||||||
VoxelNode* result = NULL;
|
VoxelNode* result = NULL;
|
||||||
int childCount = getChildCount();
|
int childCount = getChildCount();
|
||||||
|
@ -428,6 +436,7 @@ VoxelNode* VoxelNode::getChildAtIndex(int childIndex) const {
|
||||||
}
|
}
|
||||||
#endif // def HAS_AUDIT_CHILDREN
|
#endif // def HAS_AUDIT_CHILDREN
|
||||||
return result;
|
return result;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void VoxelNode::storeTwoChildren(VoxelNode* childOne, VoxelNode* childTwo) {
|
void VoxelNode::storeTwoChildren(VoxelNode* childOne, VoxelNode* childTwo) {
|
||||||
|
@ -680,6 +689,14 @@ void VoxelNode::deleteAllChildren() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void VoxelNode::setChildAtIndex(int childIndex, VoxelNode* child) {
|
void VoxelNode::setChildAtIndex(int childIndex, VoxelNode* child) {
|
||||||
|
#ifdef SIMPLE_CHILD_ARRAY
|
||||||
|
if (child) {
|
||||||
|
setAtBit(_childBitmask, childIndex);
|
||||||
|
} else {
|
||||||
|
clearAtBit(_childBitmask, childIndex);
|
||||||
|
}
|
||||||
|
_simpleChildArray[childIndex] = child;
|
||||||
|
#else
|
||||||
PerformanceWarning warn(false,"setChildAtIndex",false,&_setChildAtIndexTime,&_setChildAtIndexCalls);
|
PerformanceWarning warn(false,"setChildAtIndex",false,&_setChildAtIndexTime,&_setChildAtIndexCalls);
|
||||||
|
|
||||||
// Here's how we store things...
|
// Here's how we store things...
|
||||||
|
@ -1020,6 +1037,8 @@ void VoxelNode::setChildAtIndex(int childIndex, VoxelNode* child) {
|
||||||
_childrenArray[childIndex] = child;
|
_childrenArray[childIndex] = child;
|
||||||
auditChildren("setChildAtIndex()");
|
auditChildren("setChildAtIndex()");
|
||||||
#endif // def HAS_AUDIT_CHILDREN
|
#endif // def HAS_AUDIT_CHILDREN
|
||||||
|
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
#define __hifi__VoxelNode__
|
#define __hifi__VoxelNode__
|
||||||
|
|
||||||
//#define HAS_AUDIT_CHILDREN
|
//#define HAS_AUDIT_CHILDREN
|
||||||
|
#define SIMPLE_CHILD_ARRAY
|
||||||
|
|
||||||
#include <SharedUtil.h>
|
#include <SharedUtil.h>
|
||||||
#include "AABox.h"
|
#include "AABox.h"
|
||||||
|
@ -172,6 +173,10 @@ private:
|
||||||
uint64_t _lastChanged; /// Client and server, timestamp this node was last changed, 8 bytes
|
uint64_t _lastChanged; /// Client and server, timestamp this node was last changed, 8 bytes
|
||||||
|
|
||||||
/// Client and server, pointers to child nodes, various encodings
|
/// Client and server, pointers to child nodes, various encodings
|
||||||
|
#ifdef SIMPLE_CHILD_ARRAY
|
||||||
|
VoxelNode* _simpleChildArray[8]; /// Only used when HAS_AUDIT_CHILDREN is enabled to help debug children encoding
|
||||||
|
#endif
|
||||||
|
|
||||||
union children_t {
|
union children_t {
|
||||||
VoxelNode* single;
|
VoxelNode* single;
|
||||||
int32_t offsetsTwoChildren[2];
|
int32_t offsetsTwoChildren[2];
|
||||||
|
|
Loading…
Reference in a new issue