Removec uneccessary 64-byte align for RwMatrix.

This commit is contained in:
Falco Girgis
2025-03-15 13:20:58 -05:00
parent e0b6ac6ab7
commit 446d899c31
3 changed files with 6 additions and 13 deletions

View File

@@ -5779,7 +5779,9 @@ writeNativeSkin(Stream *stream, int32 len, void *object, int32 offset)
stream->write8(&skin->numBones, 4);
for(int32 i = 0; i < skin->numBones; i++){
Matrix &m = *reinterpret_cast<Matrix *>(&skin->inverseMatrices[i * 16]);
Matrix &m = *reinterpret_cast<Matrix *>(
&skin->inverseMatrices[i * 16]);
if(m.flags & MatrixBase::IDENTITY_OLD)
m.flags |= MatrixBase::IDENTITY;
m.pad0 = 0;
@@ -5787,6 +5789,7 @@ writeNativeSkin(Stream *stream, int32 len, void *object, int32 offset)
m.atw = 0.0f;
m.posw = 1.0f;
}
stream->write32(skin->inverseMatrices, skin->numBones*64);
return stream;
}

View File

@@ -56,7 +56,6 @@ size_t totalMemoryAllocated;
// We align managed memory blocks on a 16 byte boundary
#define ALIGN16(x) ((x) + 0xF & ~0xF)
#define ALIGN64(x) ((x) + 0x3F & ~0x3F)
void*
malloc_managed(size_t sz, uint32 hint)
{
@@ -66,13 +65,13 @@ malloc_managed(size_t sz, uint32 hint)
if(sz == 0) return nil;
bool align64 = !!(hint & ID_MATRIX);
origPtr = malloc(sz + sizeof(MemoryBlock) + ((align64)? 63 : 15));
origPtr = malloc(sz + sizeof(MemoryBlock) + 15);
if(origPtr == nil)
return nil;
totalMemoryAllocated += sz;
data = (uint8*)origPtr;
data += sizeof(MemoryBlock);
data = (uint8*) ((align64)? ALIGN64((uintptr)data) : ALIGN16((uintptr)data));
data = (uint8*) ALIGN16((uintptr)data);
mem = (MemoryBlock*)(data-sizeof(MemoryBlock));
mem->sz = sz;

View File

@@ -225,15 +225,6 @@ writeSkin(Stream *stream, int32 len, void *object, int32 offset, int32)
if(oldFormat)
stream->writeU32(0xdeaddead);
printf("ROFLCOPTER!\n"); fflush(stdout);
Matrix &m = *reinterpret_cast<Matrix *>(&skin->inverseMatrices[i * 16]);
if(m.flags & MatrixBase::IDENTITY_OLD)
m.flags |= MatrixBase::IDENTITY;
m.pad0 = 0;
m.upw = 0.0f;
m.atw = 0.0f;
m.posw = 1.0f;
stream->write32(&skin->inverseMatrices[i*16], 64);
}