Merge branch 'development' into cmake/SPEC-7484
Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> # Conflicts: # Code/Editor/CryEditDoc.cpp # Code/Editor/CryEditDoc.h # Code/Legacy/CryCommon/CryArray.h # Code/Legacy/CryCommon/CryString.h # Code/Legacy/CryCommon/UnicodeBinding.h # Code/Legacy/CrySystem/LocalizedStringManager.cpp # Gems/LyShine/Code/Source/StringUtfUtils.h # Gems/PhysXDebug/Code/Source/SystemComponent.cpp
This commit is contained in:
@@ -11,7 +11,7 @@
|
||||
#define CRYINCLUDE_CRYCOMMON_CRYARRAY_H
|
||||
#pragma once
|
||||
|
||||
#include "CryLegacyAllocator.h"
|
||||
#include <CryLegacyAllocator.h>
|
||||
#include <AzCore/std/string/string.h>
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
@@ -664,7 +664,7 @@ namespace NArray
|
||||
|
||||
I capacity() const
|
||||
{
|
||||
I aligned_bytes = Align(size() * sizeof(T), sizeof(I));
|
||||
I aligned_bytes = static_cast<I>(Align(size() * sizeof(T), sizeof(I)));
|
||||
if (m_nSizeCap & nCAP_BIT)
|
||||
{
|
||||
// Capacity stored in word following data
|
||||
@@ -682,7 +682,7 @@ namespace NArray
|
||||
// Store size, and assert against overflow.
|
||||
assert(s <= c);
|
||||
m_nSizeCap = s;
|
||||
I aligned_bytes = Align(s * sizeof(T), sizeof(I));
|
||||
I aligned_bytes = static_cast<I>(Align(s * sizeof(T), sizeof(I)));
|
||||
if (c * sizeof(T) >= aligned_bytes + sizeof(I))
|
||||
{
|
||||
// Has extra capacity, more than word-alignment
|
||||
|
||||
@@ -10,8 +10,6 @@
|
||||
|
||||
#include "LegacyAllocator.h"
|
||||
|
||||
#include <AzCore/std/algorithm.h>
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// CryModule allocation API
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -95,128 +93,3 @@ inline void* CryModuleReallocAlignImpl(void* prev, size_t size, size_t alignment
|
||||
|
||||
return ptr;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// CryCrt alloc API
|
||||
//-----------------------------------------------------------------------------
|
||||
inline size_t CryCrtSize(void* p)
|
||||
{
|
||||
return AZ::AllocatorInstance<AZ::LegacyAllocator>::Get().AllocationSize(p);
|
||||
}
|
||||
|
||||
inline void* CryCrtMalloc(size_t size)
|
||||
{
|
||||
return CryModuleMalloc(size);
|
||||
}
|
||||
|
||||
inline size_t CryCrtFree(void* p)
|
||||
{
|
||||
size_t size = CryCrtSize(p);
|
||||
CryModuleFree(p);
|
||||
return size;
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// CrySystemCrt alloc API
|
||||
//-----------------------------------------------------------------------------
|
||||
inline size_t CrySystemCrtSize(void* p)
|
||||
{
|
||||
return AZ::AllocatorInstance<AZ::LegacyAllocator>::Get().AllocationSize(p);
|
||||
}
|
||||
|
||||
inline void* CrySystemCrtMalloc(size_t size)
|
||||
{
|
||||
return AZ::AllocatorInstance<AZ::LegacyAllocator>::Get().Allocate(size, 0, 0, "AZ::LegacyAllocator");
|
||||
}
|
||||
|
||||
inline void* CrySystemCrtRealloc(void* p, size_t size)
|
||||
{
|
||||
// Use LegacyAllocator's special ReAllocate
|
||||
return AZ::AllocatorInstance<AZ::LegacyAllocator>::Get().ReAllocate(p, size, 0);
|
||||
}
|
||||
|
||||
inline size_t CrySystemCrtFree(void* p)
|
||||
{
|
||||
size_t size = CrySystemCrtSize(p);
|
||||
CryModuleFree(p);
|
||||
return size;
|
||||
}
|
||||
|
||||
inline size_t CrySystemCrtGetUsedSpace()
|
||||
{
|
||||
return AZ::AllocatorInstance<AZ::LegacyAllocator>::Get().NumAllocatedBytes();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// CryMalloc API
|
||||
//-----------------------------------------------------------------------------
|
||||
inline void* CryMalloc(size_t size, size_t& allocated, size_t alignment)
|
||||
{
|
||||
if (!size)
|
||||
{
|
||||
allocated = 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// The original implementation guaranteed 16 byte min alignment
|
||||
alignment = AZStd::GetMax<size_t>(alignment, 16);
|
||||
void* ptr = AZ::AllocatorInstance<AZ::LegacyAllocator>::Get().Allocate(size, alignment, 0, "CryMalloc", __FILE__, __LINE__);
|
||||
allocated = AZ::AllocatorInstance<AZ::LegacyAllocator>::Get().AllocationSize(ptr);
|
||||
return ptr;
|
||||
}
|
||||
|
||||
inline void* CryRealloc(void* memblock, size_t size, size_t& allocated, size_t& oldsize, size_t alignment)
|
||||
{
|
||||
oldsize = AZ::AllocatorInstance<AZ::LegacyAllocator>::Get().AllocationSize(memblock);
|
||||
void* ptr = AZ::AllocatorInstance<AZ::LegacyAllocator>::Get().ReAllocate(memblock, size, alignment);
|
||||
allocated = AZ::AllocatorInstance<AZ::LegacyAllocator>::Get().AllocationSize(ptr);
|
||||
return ptr;
|
||||
}
|
||||
|
||||
inline size_t CryFree(void* p, size_t /*alignment*/)
|
||||
{
|
||||
size_t size = AZ::AllocatorInstance<AZ::LegacyAllocator>::Get().AllocationSize(p);
|
||||
AZ::AllocatorInstance<AZ::LegacyAllocator>::Get().DeAllocate(p, size);
|
||||
return size;
|
||||
}
|
||||
|
||||
inline size_t CryGetMemSize(void* memblock, size_t /*sourceSize*/)
|
||||
{
|
||||
return AZ::AllocatorInstance<AZ::LegacyAllocator>::Get().AllocationSize(memblock);
|
||||
}
|
||||
|
||||
inline int CryMemoryGetAllocatedSize()
|
||||
{
|
||||
return AZ::AllocatorInstance<AZ::LegacyAllocator>::Get().NumAllocatedBytes();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
inline int CryMemoryGetPoolSize()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
inline int CryStats([[maybe_unused]] char* buf)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
inline int CryGetUsedHeapSize()
|
||||
{
|
||||
return AZ::AllocatorInstance<AZ::LegacyAllocator>::Get().NumAllocatedBytes();
|
||||
}
|
||||
|
||||
inline int CryGetWastedHeapSize()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
inline void CryCleanup()
|
||||
{
|
||||
AZ::AllocatorInstance<AZ::LegacyAllocator>::Get().GarbageCollect();
|
||||
}
|
||||
|
||||
inline void CryResetStats(void)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ struct INameTable
|
||||
const char* GetStr() { return (char*)(this + 1); }
|
||||
void AddRef() { nRefCount++; /*InterlockedIncrement(&_header()->nRefCount);*/};
|
||||
int Release() { return --nRefCount; };
|
||||
int GetMemoryUsage() { return sizeof(SNameEntry) + strlen(GetStr()); }
|
||||
int GetMemoryUsage() { return static_cast<int>(sizeof(SNameEntry) + strlen(GetStr())); }
|
||||
int GetLength(){return nLength; }
|
||||
};
|
||||
|
||||
@@ -102,14 +102,14 @@ public:
|
||||
if (!pEntry)
|
||||
{
|
||||
// Create a new entry.
|
||||
unsigned int nLen = strlen(str);
|
||||
unsigned int allocLen = sizeof(SNameEntry) + (nLen + 1) * sizeof(char);
|
||||
size_t nLen = strlen(str);
|
||||
size_t allocLen = sizeof(SNameEntry) + (nLen + 1) * sizeof(char);
|
||||
pEntry = (SNameEntry*)CryModuleMalloc(allocLen);
|
||||
assert(pEntry != NULL);
|
||||
pEntry->nTag = SNameEntry::TAG;
|
||||
pEntry->nRefCount = 0;
|
||||
pEntry->nLength = nLen;
|
||||
pEntry->nAllocSize = allocLen;
|
||||
pEntry->nLength = static_cast<int>(nLen);
|
||||
pEntry->nAllocSize = static_cast<int>(allocLen);
|
||||
// Copy string to the end of name entry.
|
||||
char* pEntryStr = const_cast<char*>(pEntry->GetStr());
|
||||
memcpy(pEntryStr, str, nLen + 1);
|
||||
@@ -134,7 +134,7 @@ public:
|
||||
int n = 0;
|
||||
for (it = m_nameMap.begin(); it != m_nameMap.end(); it++)
|
||||
{
|
||||
nSize += strlen(it->first);
|
||||
nSize += static_cast<int>(strlen(it->first));
|
||||
nSize += it->second->GetMemoryUsage();
|
||||
n++;
|
||||
}
|
||||
@@ -149,7 +149,7 @@ public:
|
||||
}
|
||||
virtual int GetNumberOfEntries()
|
||||
{
|
||||
return m_nameMap.size();
|
||||
return static_cast<int>(m_nameMap.size());
|
||||
}
|
||||
|
||||
// Log all names inside CryName table.
|
||||
|
||||
@@ -159,8 +159,8 @@ public:
|
||||
return numElements != m_elements.size();
|
||||
}
|
||||
|
||||
ILINE int Count() const { return m_elements.size(); }
|
||||
ILINE unsigned int Size() const { return m_elements.size(); }
|
||||
ILINE size_t Count() const { return m_elements.size(); }
|
||||
ILINE size_t Size() const { return m_elements.size(); }
|
||||
|
||||
ILINE int IsEmpty() const { return m_elements.empty(); }
|
||||
|
||||
|
||||
@@ -2094,7 +2094,7 @@ public:
|
||||
{
|
||||
if (activeStreams & (1U << i))
|
||||
{
|
||||
nMeshSize += ((i == VSF_GENERAL) ? sizeof(SVF_P3S_C4B_T2S) : cSizeStream[i]) * GetVertexCount();
|
||||
nMeshSize += static_cast<uint32>(((i == VSF_GENERAL) ? sizeof(SVF_P3S_C4B_T2S) : cSizeStream[i]) * GetVertexCount());
|
||||
nMeshSize += TARGET_DEFAULT_ALIGN - (nMeshSize & (TARGET_DEFAULT_ALIGN - 1));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1425,9 +1425,9 @@ struct STexSamplerFX
|
||||
SAFE_RELEASE(m_pITarget);
|
||||
}
|
||||
|
||||
int Size()
|
||||
size_t Size()
|
||||
{
|
||||
int nSize = sizeof(*this);
|
||||
size_t nSize = sizeof(*this);
|
||||
nSize += m_szName.capacity();
|
||||
nSize += m_szTexture.capacity();
|
||||
#if SHADER_REFLECT_TEXTURE_SLOTS
|
||||
@@ -1804,9 +1804,9 @@ struct SEfResTexture
|
||||
return m_Ext.m_pTexModifier;
|
||||
}
|
||||
|
||||
int Size() const
|
||||
size_t Size() const
|
||||
{
|
||||
int nSize = sizeof(SEfResTexture) - sizeof(STexSamplerRT) - sizeof(SEfResTextureExt);
|
||||
size_t nSize = sizeof(SEfResTexture) - sizeof(STexSamplerRT) - sizeof(SEfResTextureExt);
|
||||
nSize += m_Name.size();
|
||||
nSize += m_Sampler.Size();
|
||||
nSize += m_Ext.Size();
|
||||
@@ -1899,9 +1899,9 @@ struct SBaseShaderResources
|
||||
|
||||
uint8 m_VoxelCoverage;
|
||||
|
||||
int Size() const
|
||||
size_t Size() const
|
||||
{
|
||||
int nSize = sizeof(SBaseShaderResources) + m_ShaderParams.size() * sizeof(SShaderParam);
|
||||
size_t nSize = sizeof(SBaseShaderResources) + m_ShaderParams.size() * sizeof(SShaderParam);
|
||||
return nSize;
|
||||
}
|
||||
|
||||
@@ -2031,9 +2031,9 @@ struct SInputShaderResources
|
||||
TexturesResourcesMap m_TexturesResourcesMap; // a map of all textures resources used by the shader by name
|
||||
SDeformInfo m_DeformInfo;
|
||||
|
||||
int Size() const
|
||||
size_t Size() const
|
||||
{
|
||||
int nSize = SBaseShaderResources::Size();// -sizeof(SEfResTexture) * m_TexturesResourcesMap.size();
|
||||
size_t nSize = SBaseShaderResources::Size();// -sizeof(SEfResTexture) * m_TexturesResourcesMap.size();
|
||||
nSize += m_TexturePath.size();
|
||||
nSize += sizeof(SDeformInfo);
|
||||
|
||||
|
||||
@@ -408,8 +408,7 @@ typename VectorMap<K, V, T, A>::key_compare VectorMap<K, V, T, A>::key_comp() co
|
||||
template <typename K, typename V, typename T, typename A>
|
||||
typename VectorMap<K, V, T, A>::iterator VectorMap<K, V, T, A>::lower_bound(const key_type& key)
|
||||
{
|
||||
int count = 0;
|
||||
count = m_entries.size();
|
||||
int count = static_cast<int>(m_entries.size());
|
||||
iterator first = m_entries.begin();
|
||||
iterator last = m_entries.end();
|
||||
for (; 0 < count; )
|
||||
@@ -432,8 +431,7 @@ typename VectorMap<K, V, T, A>::iterator VectorMap<K, V, T, A>::lower_bound(cons
|
||||
template <typename K, typename V, typename T, typename A>
|
||||
typename VectorMap<K, V, T, A>::const_iterator VectorMap<K, V, T, A>::lower_bound(const key_type& key) const
|
||||
{
|
||||
int count = 0;
|
||||
count = m_entries.size();
|
||||
int count = static_cast<int>(m_entries.size());
|
||||
const_iterator first = m_entries.begin();
|
||||
const_iterator last = m_entries.end();
|
||||
for (; 0 < count; )
|
||||
|
||||
@@ -475,8 +475,6 @@ ILINE DestinationType alias_cast(SourceType pPtr)
|
||||
return conv_union.pDst;
|
||||
}
|
||||
|
||||
#include "CryLegacyAllocator.h"
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
#ifndef DEPRECATED
|
||||
#define DEPRECATED
|
||||
|
||||
Reference in New Issue
Block a user