fix shadowmap crash on some Intel GPUs, see https://github.com/bulletphysics/bullet3/issues/4

remove targetdir from all libraries in premake, so it is much easier to create a separate folder for all binary+lib
transmit the serialized btMultiBody data back from server to client, after the server loads a URDF file. This includes base+link+joint names
tweak the serialization routines, so it is easier to skip pointers and to serialize directly to a shared memory buffer
also tweak the serialization code to allow to process data without 'DNA' schema data (assuming file-DNA = memory DNA)
This commit is contained in:
erwincoumans
2015-07-10 22:20:06 -07:00
parent f6f76901fd
commit 6c9ce344ea
35 changed files with 340 additions and 120 deletions

View File

@@ -174,6 +174,7 @@ protected:
btAlignedObjectArray<short> mTlens;
btHashMap<btHashInt, int> mStructReverse;
btHashMap<btHashString,int> mTypeLookup;
btHashMap<btHashPtr,void*> m_chunkP;
@@ -185,6 +186,7 @@ protected:
int m_totalSize;
unsigned char* m_buffer;
bool m_ownsBuffer;
int m_currentSize;
void* m_dna;
int m_dnaLength;
@@ -196,6 +198,7 @@ protected:
protected:
virtual void* findPointer(void* oldPtr)
{
void** ptr = m_chunkP.find(oldPtr);
@@ -384,17 +387,25 @@ protected:
public:
btHashMap<btHashPtr,void*> m_skipPointers;
btDefaultSerializer(int totalSize=0)
btDefaultSerializer(int totalSize=0, unsigned char* buffer=0)
:m_totalSize(totalSize),
m_currentSize(0),
m_dna(0),
m_dnaLength(0),
m_serializationFlags(0)
{
m_buffer = m_totalSize?(unsigned char*)btAlignedAlloc(totalSize,16):0;
if (buffer==0)
{
m_buffer = m_totalSize?(unsigned char*)btAlignedAlloc(totalSize,16):0;
m_ownsBuffer = true;
} else
{
m_buffer = buffer;
m_ownsBuffer = false;
}
const bool VOID_IS_8 = ((sizeof(void*)==8));
@@ -429,12 +440,18 @@ public:
virtual ~btDefaultSerializer()
{
if (m_buffer)
if (m_buffer && m_ownsBuffer)
btAlignedFree(m_buffer);
if (m_dna)
btAlignedFree(m_dna);
}
void insertHeader()
{
writeHeader(m_buffer);
m_currentSize += BT_HEADER_LENGTH;
}
void writeHeader(unsigned char* buffer) const
{
@@ -515,6 +532,7 @@ public:
mTlens.clear();
mStructReverse.clear();
mTypeLookup.clear();
m_skipPointers.clear();
m_chunkP.clear();
m_nameMap.clear();
m_uniquePointers.clear();
@@ -531,6 +549,13 @@ public:
{
return uptr->m_ptr;
}
void** ptr2 = m_skipPointers[oldPtr];
if (ptr2)
{
return 0;
}
m_uniqueIdGenerator++;
btPointerUid uid;
@@ -684,10 +709,15 @@ struct btInMemorySerializer : public btDefaultSerializer
btHashMap<btHashPtr,btChunk*> m_uid2ChunkPtr;
btHashMap<btHashPtr,void*> m_orgPtr2UniqueDataPtr;
btHashMap<btHashString,const void*> m_names2Ptr;
btHashMap<btHashPtr,void*> m_skipPointers;
btBulletSerializedArrays m_arrays;
btInMemorySerializer(int totalSize=0, unsigned char* buffer=0)
:btDefaultSerializer(totalSize,buffer)
{
}
virtual void startSerialization()
{
@@ -696,6 +726,8 @@ struct btInMemorySerializer : public btDefaultSerializer
btDefaultSerializer::startSerialization();
}
btChunk* findChunkFromUniquePointer(void* uniquePointer)
{
btChunk** chkPtr = m_uid2ChunkPtr[uniquePointer];