Merge branch 'development' into cmake/linux_fix_warn_unused
Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com>
This commit is contained in:
@@ -675,14 +675,14 @@ void AzAssetBrowserRequestHandler::OpenAssetInAssociatedEditor(const AZ::Data::A
|
||||
firstValidOpener = &openerDetails;
|
||||
}
|
||||
// bind a callback such that when the menu item is clicked, it sets that as the opener to use.
|
||||
menu.addAction(openerDetails.m_iconToUse, QObject::tr(openerDetails.m_displayText.c_str()), mainWindow, AZStd::bind(switchToOpener, &openerDetails));
|
||||
menu.addAction(openerDetails.m_iconToUse, QObject::tr(openerDetails.m_displayText.c_str()), mainWindow, [switchToOpener, details = &openerDetails] { return switchToOpener(details); });
|
||||
}
|
||||
}
|
||||
|
||||
if (numValidOpeners > 1) // more than one option was added
|
||||
{
|
||||
menu.addSeparator();
|
||||
menu.addAction(QObject::tr("Cancel"), AZStd::bind(switchToOpener, nullptr)); // just something to click on to avoid doing anything.
|
||||
menu.addAction(QObject::tr("Cancel"), [switchToOpener] { return switchToOpener(nullptr); }); // just something to click on to avoid doing anything.
|
||||
menu.exec(QCursor::pos());
|
||||
}
|
||||
else if (numValidOpeners == 1)
|
||||
|
||||
@@ -145,7 +145,7 @@ bool UserPopupWidgetHandler::ReadValuesIntoGUI(size_t index, UserPropertyEditor*
|
||||
QWidget* FloatCurveHandler::CreateGUI(QWidget *pParent)
|
||||
{
|
||||
CSplineCtrl *cSpline = new CSplineCtrl(pParent);
|
||||
cSpline->SetUpdateCallback(AZStd::bind(&FloatCurveHandler::OnSplineChange, this, AZStd::placeholders::_1));
|
||||
cSpline->SetUpdateCallback([this](CSplineCtrl* spl) { OnSplineChange(spl); });
|
||||
cSpline->SetTimeRange(0, 1);
|
||||
cSpline->SetValueRange(0, 1);
|
||||
cSpline->SetGrid(12, 12);
|
||||
|
||||
@@ -172,8 +172,8 @@ ReflectedPropertyItem::ReflectedPropertyItem(ReflectedPropertyControl *control,
|
||||
if (parent)
|
||||
parent->AddChild(this);
|
||||
|
||||
m_onSetCallback = AZStd::bind(&ReflectedPropertyItem::OnVariableChange, this, AZStd::placeholders::_1);
|
||||
m_onSetEnumCallback = AZStd::bind(&ReflectedPropertyItem::OnVariableEnumChange, this, AZStd::placeholders::_1);
|
||||
m_onSetCallback = [this](IVariable* var) { OnVariableChange(var); };
|
||||
m_onSetEnumCallback = [this](IVariable* var) { OnVariableEnumChange(var); };
|
||||
}
|
||||
|
||||
ReflectedPropertyItem::~ReflectedPropertyItem()
|
||||
|
||||
@@ -2634,7 +2634,6 @@ void EditorViewportWidget::ShowCursor()
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void EditorViewportWidget::PushDisableRendering()
|
||||
{
|
||||
assert(m_disableRenderingCount >= 0);
|
||||
++m_disableRenderingCount;
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace UnitTest
|
||||
m_inputChannelMapper = AZStd::make_unique<AzToolsFramework::QtEventToAzInputMapper>(m_rootWidget.get(), TestViewportId);
|
||||
}
|
||||
|
||||
void TearDown()
|
||||
void TearDown() override
|
||||
{
|
||||
m_inputChannelMapper.reset();
|
||||
|
||||
|
||||
@@ -24,10 +24,10 @@ namespace UnitTest
|
||||
void Disconnect();
|
||||
|
||||
// EditorInteractionSystemViewportSelectionRequestBus overrides ...
|
||||
void SetHandler(const AzToolsFramework::ViewportSelectionRequestsBuilderFn& interactionRequestsBuilder);
|
||||
void SetDefaultHandler();
|
||||
bool InternalHandleMouseViewportInteraction(const MouseInteractionEvent& mouseInteraction);
|
||||
bool InternalHandleMouseManipulatorInteraction(const MouseInteractionEvent& mouseInteraction);
|
||||
void SetHandler(const AzToolsFramework::ViewportSelectionRequestsBuilderFn& interactionRequestsBuilder) override;
|
||||
void SetDefaultHandler() override;
|
||||
bool InternalHandleMouseViewportInteraction(const MouseInteractionEvent& mouseInteraction) override;
|
||||
bool InternalHandleMouseManipulatorInteraction(const MouseInteractionEvent& mouseInteraction) override;
|
||||
|
||||
AZStd::function<bool(const MouseInteractionEvent& mouseInteraction)> m_internalHandleMouseViewportInteraction;
|
||||
AZStd::function<bool(const MouseInteractionEvent& mouseInteraction)> m_internalHandleMouseManipulatorInteraction;
|
||||
@@ -92,7 +92,7 @@ namespace UnitTest
|
||||
m_inputChannelMapper = AZStd::make_unique<AzToolsFramework::QtEventToAzInputMapper>(m_rootWidget.get(), TestViewportId);
|
||||
}
|
||||
|
||||
void TearDown()
|
||||
void TearDown() override
|
||||
{
|
||||
m_inputChannelMapper.reset();
|
||||
|
||||
|
||||
@@ -1767,7 +1767,7 @@ void MainWindow::RegisterOpenWndCommands()
|
||||
cmdUI.tooltip = (QString("Open ") + className).toUtf8().data();
|
||||
cmdUI.iconFilename = className.toUtf8().data();
|
||||
GetIEditor()->GetCommandManager()->RegisterUICommand("editor", openCommandName.toUtf8().data(),
|
||||
"", "", AZStd::bind(&CEditorOpenViewCommand::Execute, pCmd), cmdUI);
|
||||
"", "", [pCmd] { pCmd->Execute(); }, cmdUI);
|
||||
GetIEditor()->GetCommandManager()->GetUIInfo("editor", openCommandName.toUtf8().data(), cmdUI);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1515,8 +1515,8 @@ void CBaseObject::Serialize(CObjectArchive& ar)
|
||||
SetFrozen(bFrozen);
|
||||
SetHidden(bHidden);
|
||||
|
||||
ar.SetResolveCallback(this, parentId, AZStd::bind(&CBaseObject::ResolveParent, this, AZStd::placeholders::_1 ));
|
||||
ar.SetResolveCallback(this, lookatId, AZStd::bind(&CBaseObject::SetLookAt, this, AZStd::placeholders::_1));
|
||||
ar.SetResolveCallback(this, parentId, [this](CBaseObject* parent) { ResolveParent(parent); });
|
||||
ar.SetResolveCallback(this, lookatId, [this](CBaseObject* target) { SetLookAt(target); });
|
||||
|
||||
InvalidateTM(0);
|
||||
SetModified(false);
|
||||
@@ -2038,7 +2038,7 @@ bool CBaseObject::HitHelperAtTest(HitContext& hc, const Vec3& pos)
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
CBaseObject* CBaseObject::GetChild(size_t const i) const
|
||||
{
|
||||
assert(i >= 0 && i < m_childs.size());
|
||||
assert(i < m_childs.size());
|
||||
return m_childs[i];
|
||||
}
|
||||
|
||||
@@ -2729,7 +2729,7 @@ void CBaseObject::SetMinSpec(uint32 nSpec, bool bSetChildren)
|
||||
// Set min spec for all childs.
|
||||
if (bSetChildren)
|
||||
{
|
||||
for (size_t i = m_childs.size() - 1; i >= 0; --i)
|
||||
for (int i = static_cast<int>(m_childs.size()) - 1; i >= 0; --i)
|
||||
{
|
||||
m_childs[i]->SetMinSpec(nSpec, true);
|
||||
}
|
||||
|
||||
@@ -230,25 +230,25 @@ CEntityObject::CEntityObject()
|
||||
m_attachmentType = eAT_Pivot;
|
||||
|
||||
// cache all the variable callbacks, must match order of enum defined in header
|
||||
m_onSetCallbacksCache.push_back(AZStd::bind(&CEntityObject::OnAreaHeightChange, this, AZStd::placeholders::_1));
|
||||
m_onSetCallbacksCache.push_back(AZStd::bind(&CEntityObject::OnAreaLightChange, this, AZStd::placeholders::_1));
|
||||
m_onSetCallbacksCache.push_back(AZStd::bind(&CEntityObject::OnAreaLightSizeChange, this, AZStd::placeholders::_1));
|
||||
m_onSetCallbacksCache.push_back(AZStd::bind(&CEntityObject::OnAreaWidthChange, this, AZStd::placeholders::_1));
|
||||
m_onSetCallbacksCache.push_back(AZStd::bind(&CEntityObject::OnBoxHeightChange, this, AZStd::placeholders::_1));
|
||||
m_onSetCallbacksCache.push_back(AZStd::bind(&CEntityObject::OnBoxLengthChange, this, AZStd::placeholders::_1));
|
||||
m_onSetCallbacksCache.push_back(AZStd::bind(&CEntityObject::OnBoxProjectionChange, this, AZStd::placeholders::_1));
|
||||
m_onSetCallbacksCache.push_back(AZStd::bind(&CEntityObject::OnBoxSizeXChange, this, AZStd::placeholders::_1));
|
||||
m_onSetCallbacksCache.push_back(AZStd::bind(&CEntityObject::OnBoxSizeYChange, this, AZStd::placeholders::_1));
|
||||
m_onSetCallbacksCache.push_back(AZStd::bind(&CEntityObject::OnBoxSizeZChange, this, AZStd::placeholders::_1));
|
||||
m_onSetCallbacksCache.push_back(AZStd::bind(&CEntityObject::OnBoxWidthChange, this, AZStd::placeholders::_1));
|
||||
m_onSetCallbacksCache.push_back(AZStd::bind(&CEntityObject::OnColorChange, this, AZStd::placeholders::_1));
|
||||
m_onSetCallbacksCache.push_back(AZStd::bind(&CEntityObject::OnInnerRadiusChange, this, AZStd::placeholders::_1));
|
||||
m_onSetCallbacksCache.push_back(AZStd::bind(&CEntityObject::OnOuterRadiusChange, this, AZStd::placeholders::_1));
|
||||
m_onSetCallbacksCache.push_back(AZStd::bind(&CEntityObject::OnProjectInAllDirsChange, this, AZStd::placeholders::_1));
|
||||
m_onSetCallbacksCache.push_back(AZStd::bind(&CEntityObject::OnProjectorFOVChange, this, AZStd::placeholders::_1));
|
||||
m_onSetCallbacksCache.push_back(AZStd::bind(&CEntityObject::OnProjectorTextureChange, this, AZStd::placeholders::_1));
|
||||
m_onSetCallbacksCache.push_back(AZStd::bind(&CEntityObject::OnPropertyChange, this, AZStd::placeholders::_1));
|
||||
m_onSetCallbacksCache.push_back(AZStd::bind(&CEntityObject::OnRadiusChange, this, AZStd::placeholders::_1));
|
||||
m_onSetCallbacksCache.emplace_back([this](IVariable* var) { OnAreaHeightChange(var); });
|
||||
m_onSetCallbacksCache.emplace_back([this](IVariable* var) { OnAreaLightChange(var); });
|
||||
m_onSetCallbacksCache.emplace_back([this](IVariable* var) { OnAreaLightSizeChange(var); });
|
||||
m_onSetCallbacksCache.emplace_back([this](IVariable* var) { OnAreaWidthChange(var); });
|
||||
m_onSetCallbacksCache.emplace_back([this](IVariable* var) { OnBoxHeightChange(var); });
|
||||
m_onSetCallbacksCache.emplace_back([this](IVariable* var) { OnBoxLengthChange(var); });
|
||||
m_onSetCallbacksCache.emplace_back([this](IVariable* var) { OnBoxProjectionChange(var); });
|
||||
m_onSetCallbacksCache.emplace_back([this](IVariable* var) { OnBoxSizeXChange(var); });
|
||||
m_onSetCallbacksCache.emplace_back([this](IVariable* var) { OnBoxSizeYChange(var); });
|
||||
m_onSetCallbacksCache.emplace_back([this](IVariable* var) { OnBoxSizeZChange(var); });
|
||||
m_onSetCallbacksCache.emplace_back([this](IVariable* var) { OnBoxWidthChange(var); });
|
||||
m_onSetCallbacksCache.emplace_back([this](IVariable* var) { OnColorChange(var); });
|
||||
m_onSetCallbacksCache.emplace_back([this](IVariable* var) { OnInnerRadiusChange(var); });
|
||||
m_onSetCallbacksCache.emplace_back([this](IVariable* var) { OnOuterRadiusChange(var); });
|
||||
m_onSetCallbacksCache.emplace_back([this](IVariable* var) { OnProjectInAllDirsChange(var); });
|
||||
m_onSetCallbacksCache.emplace_back([this](IVariable* var) { OnProjectorFOVChange(var); });
|
||||
m_onSetCallbacksCache.emplace_back([this](IVariable* var) { OnProjectorTextureChange(var); });
|
||||
m_onSetCallbacksCache.emplace_back([this](IVariable* var) { OnPropertyChange(var); });
|
||||
m_onSetCallbacksCache.emplace_back([this](IVariable* var) { OnRadiusChange(var); });
|
||||
}
|
||||
|
||||
CEntityObject::~CEntityObject()
|
||||
@@ -938,11 +938,14 @@ void CEntityObject::Serialize(CObjectArchive& ar)
|
||||
eventTarget->getAttr("TargetId", targetId);
|
||||
eventTarget->getAttr("Event", et.event);
|
||||
eventTarget->getAttr("SourceEvent", et.sourceEvent);
|
||||
m_eventTargets.push_back(et);
|
||||
m_eventTargets.emplace_back(AZStd::move(et));
|
||||
if (targetId != GUID_NULL)
|
||||
{
|
||||
using namespace AZStd::placeholders;
|
||||
ar.SetResolveCallback(this, targetId, AZStd::bind(&CEntityObject::ResolveEventTarget, this, _1, _2), i);
|
||||
ar.SetResolveCallback(
|
||||
this, targetId,
|
||||
[this](CBaseObject* object, unsigned int index) { ResolveEventTarget(object, index); },
|
||||
i);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1413,7 +1416,7 @@ void CEntityObject::PostClone(CBaseObject* pFromObject, CObjectCloneContext& ctx
|
||||
void CEntityObject::ResolveEventTarget(CBaseObject* object, unsigned int index)
|
||||
{
|
||||
// Find target id.
|
||||
assert(index >= 0 && index < m_eventTargets.size());
|
||||
assert(index < m_eventTargets.size());
|
||||
if (object)
|
||||
{
|
||||
object->AddEventListener(this);
|
||||
|
||||
@@ -12,6 +12,8 @@
|
||||
#include <QPainter>
|
||||
#include <QPalette>
|
||||
|
||||
#include <AzCore/Casting/numeric_cast.h>
|
||||
|
||||
namespace DrawingPrimitives
|
||||
{
|
||||
void DrawTimeSlider(QPainter& painter, const QPalette& palette, const STimeSliderOptions& options)
|
||||
|
||||
@@ -110,7 +110,7 @@ void CTrackViewKeyPropertiesDlg::PopulateVariables()
|
||||
m_wndProps->RemoveAllItems();
|
||||
m_wndProps->AddVarBlock(m_pVarBlock);
|
||||
|
||||
m_wndProps->SetUpdateCallback(AZStd::bind(&CTrackViewKeyPropertiesDlg::OnVarChange, this, AZStd::placeholders::_1));
|
||||
m_wndProps->SetUpdateCallback([this](IVariable* var) { OnVarChange(var); });
|
||||
//m_wndProps->m_props.ExpandAll();
|
||||
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ public:
|
||||
}
|
||||
void Undo(bool bUndo) override
|
||||
{
|
||||
for (size_t i = m_undoSteps.size() - 1; i >= 0; i--)
|
||||
for (int i = static_cast<int>(m_undoSteps.size()) - 1; i >= 0; i--)
|
||||
{
|
||||
m_undoSteps[i]->Undo(bUndo);
|
||||
}
|
||||
|
||||
@@ -58,36 +58,26 @@ bool C3DConnexionDriver::InitDevice()
|
||||
//Doc says RIM_TYPEHID: Data comes from an HID that is not a keyboard or a mouse.
|
||||
if (m_pRawInputDeviceList[i].dwType == RIM_TYPEHID)
|
||||
{
|
||||
UINT nchars = 300;
|
||||
TCHAR deviceName[300];
|
||||
if (GetRawInputDeviceInfo(m_pRawInputDeviceList[i].hDevice,
|
||||
RIDI_DEVICENAME, deviceName, &nchars) >= 0)
|
||||
{
|
||||
//_RPT3(_CRT_WARN, "Device[%d]: handle=0x%x name = %S\n", i, g_pRawInputDeviceList[i].hDevice, deviceName);
|
||||
}
|
||||
|
||||
RID_DEVICE_INFO dinfo;
|
||||
UINT sizeofdinfo = sizeof(dinfo);
|
||||
dinfo.cbSize = sizeofdinfo;
|
||||
if (GetRawInputDeviceInfo(m_pRawInputDeviceList[i].hDevice,
|
||||
RIDI_DEVICEINFO, &dinfo, &sizeofdinfo) >= 0)
|
||||
GetRawInputDeviceInfo(m_pRawInputDeviceList[i].hDevice,
|
||||
RIDI_DEVICEINFO, &dinfo, &sizeofdinfo);
|
||||
if (dinfo.dwType == RIM_TYPEHID)
|
||||
{
|
||||
if (dinfo.dwType == RIM_TYPEHID)
|
||||
RID_DEVICE_INFO_HID* phidInfo = &dinfo.hid;
|
||||
// Add this one to the list of interesting devices?
|
||||
// Actually only have to do this once to get input from all usage 1, usagePage 8 devices
|
||||
// This just keeps out the other usages.
|
||||
// You might want to put up a list for users to select amongst the different devices.
|
||||
// In particular, to assign separate functionality to the different devices.
|
||||
if (phidInfo->usUsagePage == 1 && phidInfo->usUsage == 8)
|
||||
{
|
||||
RID_DEVICE_INFO_HID* phidInfo = &dinfo.hid;
|
||||
// Add this one to the list of interesting devices?
|
||||
// Actually only have to do this once to get input from all usage 1, usagePage 8 devices
|
||||
// This just keeps out the other usages.
|
||||
// You might want to put up a list for users to select amongst the different devices.
|
||||
// In particular, to assign separate functionality to the different devices.
|
||||
if (phidInfo->usUsagePage == 1 && phidInfo->usUsage == 8)
|
||||
{
|
||||
m_pRawInputDevices[m_nUsagePage1Usage8Devices].usUsagePage = phidInfo->usUsagePage;
|
||||
m_pRawInputDevices[m_nUsagePage1Usage8Devices].usUsage = phidInfo->usUsage;
|
||||
m_pRawInputDevices[m_nUsagePage1Usage8Devices].dwFlags = 0;
|
||||
m_pRawInputDevices[m_nUsagePage1Usage8Devices].hwndTarget = nullptr;
|
||||
m_nUsagePage1Usage8Devices++;
|
||||
}
|
||||
m_pRawInputDevices[m_nUsagePage1Usage8Devices].usUsagePage = phidInfo->usUsagePage;
|
||||
m_pRawInputDevices[m_nUsagePage1Usage8Devices].usUsage = phidInfo->usUsage;
|
||||
m_pRawInputDevices[m_nUsagePage1Usage8Devices].dwFlags = 0;
|
||||
m_pRawInputDevices[m_nUsagePage1Usage8Devices].hwndTarget = nullptr;
|
||||
m_nUsagePage1Usage8Devices++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -467,7 +467,7 @@ bool CKDTree::FindNearestVertexRecursively(KDTreeNode* pNode, const Vec3& raySrc
|
||||
uint32 nVertexIndex = pNode->GetVertexIndex(i);
|
||||
uint32 nObjIndex = pNode->GetObjIndex(i);
|
||||
|
||||
assert(nObjIndex < m_StatObjectList.size() && nObjIndex >= 0);
|
||||
assert(nObjIndex < m_StatObjectList.size());
|
||||
|
||||
const SStatObj* pStatObjInfo = &(m_StatObjectList[nObjIndex]);
|
||||
|
||||
|
||||
@@ -769,7 +769,9 @@ namespace
|
||||
|
||||
void PySetViewPaneLayout(unsigned int layoutId)
|
||||
{
|
||||
AZ_PUSH_DISABLE_WARNING(4296, "-Wunknown-warning-option")
|
||||
if ((layoutId >= ET_Layout0) && (layoutId <= ET_Layout8))
|
||||
AZ_POP_DISABLE_WARNING
|
||||
{
|
||||
CLayoutWnd* layout = GetIEditor()->GetViewManager()->GetLayout();
|
||||
if (layout)
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include <AzCore/RTTI/TypeInfoSimple.h>
|
||||
#include <AzCore/std/limits.h>
|
||||
#include <AzCore/std/string/string_view.h>
|
||||
#include <AzCore/Casting/numeric_cast.h>
|
||||
|
||||
namespace AZ::Debug
|
||||
{
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include <AzCore/Math/MathUtils.h>
|
||||
#include <AzCore/std/typetraits/is_const.h>
|
||||
#include <AzCore/std/typetraits/has_member_function.h>
|
||||
#include <AzCore/Casting/numeric_cast.h>
|
||||
|
||||
namespace AZ
|
||||
{
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include <AzCore/IO/SystemFile.h>
|
||||
#include <AzCore/IO/IOUtils.h>
|
||||
#include <AzCore/std/algorithm.h>
|
||||
#include <AzCore/Casting/numeric_cast.h>
|
||||
|
||||
namespace AZ::IO
|
||||
{
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
|
||||
#include <AzCore/std/containers/array.h>
|
||||
#include <AzCore/std/string/wildcard.h>
|
||||
#include <AzCore/Casting/numeric_cast.h>
|
||||
|
||||
// extern instantiations of Path templates to prevent implicit instantiations
|
||||
namespace AZ::IO
|
||||
|
||||
@@ -17,15 +17,23 @@
|
||||
|
||||
#include <AzCore/Debug/Profiler.h>
|
||||
|
||||
#define AZCORE_SYS_ALLOCATOR_HPPA // If you disable this make sure you start building the heapschema.cpp
|
||||
//#define AZCORE_SYS_ALLOCATOR_MALLOC
|
||||
#define AZCORE_SYSTEM_ALLOCATOR_HPHA 1
|
||||
#define AZCORE_SYSTEM_ALLOCATOR_MALLOC 2
|
||||
#define AZCORE_SYSTEM_ALLOCATOR_HEAP 3
|
||||
|
||||
#ifdef AZCORE_SYS_ALLOCATOR_HPPA
|
||||
# include <AzCore/Memory/HphaSchema.h>
|
||||
#elif defined(AZCORE_SYS_ALLOCATOR_MALLOC)
|
||||
#include <AzCore/Memory/MallocSchema.h>
|
||||
#if !defined(AZCORE_SYSTEM_ALLOCATOR)
|
||||
// define the default
|
||||
#define AZCORE_SYSTEM_ALLOCATOR AZCORE_SYSTEM_ALLOCATOR_HPHA
|
||||
#endif
|
||||
|
||||
#if AZCORE_SYSTEM_ALLOCATOR == AZCORE_SYSTEM_ALLOCATOR_HPHA
|
||||
#include <AzCore/Memory/HphaSchema.h>
|
||||
#elif AZCORE_SYSTEM_ALLOCATOR == AZCORE_SYSTEM_ALLOCATOR_MALLOC
|
||||
#include <AzCore/Memory/MallocSchema.h>
|
||||
#elif AZCORE_SYSTEM_ALLOCATOR == AZCORE_SYSTEM_ALLOCATOR_HEAP
|
||||
#include <AzCore/Memory/HeapSchema.h>
|
||||
#else
|
||||
# include <AzCore/Memory/HeapSchema.h>
|
||||
#error "Invalid allocator selected for SystemAllocator"
|
||||
#endif
|
||||
|
||||
|
||||
@@ -34,12 +42,12 @@ using namespace AZ;
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Globals - we use global storage for the first memory schema, since we can't use dynamic memory!
|
||||
static bool g_isSystemSchemaUsed = false;
|
||||
#ifdef AZCORE_SYS_ALLOCATOR_HPPA
|
||||
static AZStd::aligned_storage<sizeof(HphaSchema), AZStd::alignment_of<HphaSchema>::value>::type g_systemSchema;
|
||||
#elif defined(AZCORE_SYS_ALLOCATOR_MALLOC)
|
||||
static AZStd::aligned_storage<sizeof(MallocSchema), AZStd::alignment_of<MallocSchema>::value>::type g_systemSchema;
|
||||
#else
|
||||
static AZStd::aligned_storage<sizeof(HeapSchema), AZStd::alignment_of<HeapSchema>::value>::type g_systemSchema;
|
||||
#if AZCORE_SYSTEM_ALLOCATOR == AZCORE_SYSTEM_ALLOCATOR_HPHA
|
||||
static AZStd::aligned_storage<sizeof(HphaSchema), AZStd::alignment_of<HphaSchema>::value>::type g_systemSchema;
|
||||
#elif AZCORE_SYSTEM_ALLOCATOR == AZCORE_SYSTEM_ALLOCATOR_MALLOC
|
||||
static AZStd::aligned_storage<sizeof(MallocSchema), AZStd::alignment_of<MallocSchema>::value>::type g_systemSchema;
|
||||
#elif AZCORE_SYSTEM_ALLOCATOR == AZCORE_SYSTEM_ALLOCATOR_HEAP
|
||||
static AZStd::aligned_storage<sizeof(HeapSchema), AZStd::alignment_of<HeapSchema>::value>::type g_systemSchema;
|
||||
#endif
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
@@ -97,9 +105,9 @@ SystemAllocator::Create(const Descriptor& desc)
|
||||
else
|
||||
{
|
||||
m_isCustom = false;
|
||||
#ifdef AZCORE_SYS_ALLOCATOR_HPPA
|
||||
HphaSchema::Descriptor heapDesc;
|
||||
heapDesc.m_pageSize = desc.m_heap.m_pageSize;
|
||||
#if AZCORE_SYSTEM_ALLOCATOR == AZCORE_SYSTEM_ALLOCATOR_HPHA
|
||||
HphaSchema::Descriptor heapDesc;
|
||||
heapDesc.m_pageSize = desc.m_heap.m_pageSize;
|
||||
heapDesc.m_poolPageSize = desc.m_heap.m_poolPageSize;
|
||||
AZ_Assert(desc.m_heap.m_numFixedMemoryBlocks <= 1, "We support max1 memory block at the moment!");
|
||||
if (desc.m_heap.m_numFixedMemoryBlocks > 0)
|
||||
@@ -111,11 +119,10 @@ SystemAllocator::Create(const Descriptor& desc)
|
||||
heapDesc.m_isPoolAllocations = desc.m_heap.m_isPoolAllocations;
|
||||
// Fix SystemAllocator from growing in small chunks
|
||||
heapDesc.m_systemChunkSize = desc.m_heap.m_systemChunkSize;
|
||||
|
||||
#elif defined(AZCORE_SYS_ALLOCATOR_MALLOC)
|
||||
#elif AZCORE_SYSTEM_ALLOCATOR == AZCORE_SYSTEM_ALLOCATOR_MALLOC
|
||||
MallocSchema::Descriptor heapDesc;
|
||||
#else
|
||||
HeapSchema::Descriptor heapDesc;
|
||||
#elif AZCORE_SYSTEM_ALLOCATOR == AZCORE_SYSTEM_ALLOCATOR_HEAP
|
||||
HeapSchema::Descriptor heapDesc;
|
||||
memcpy(heapDesc.m_memoryBlocks, desc.m_heap.m_memoryBlocks, sizeof(heapDesc.m_memoryBlocks));
|
||||
memcpy(heapDesc.m_memoryBlocksByteSize, desc.m_heap.m_memoryBlocksByteSize, sizeof(heapDesc.m_memoryBlocksByteSize));
|
||||
heapDesc.m_numMemoryBlocks = desc.m_heap.m_numMemoryBlocks;
|
||||
@@ -124,11 +131,11 @@ SystemAllocator::Create(const Descriptor& desc)
|
||||
{
|
||||
AZ_Assert(!g_isSystemSchemaUsed, "AZ::SystemAllocator MUST be created first! It's the source of all allocations!");
|
||||
|
||||
#ifdef AZCORE_SYS_ALLOCATOR_HPPA
|
||||
#if AZCORE_SYSTEM_ALLOCATOR == AZCORE_SYSTEM_ALLOCATOR_HPHA
|
||||
m_allocator = new(&g_systemSchema)HphaSchema(heapDesc);
|
||||
#elif defined(AZCORE_SYS_ALLOCATOR_MALLOC)
|
||||
#elif AZCORE_SYSTEM_ALLOCATOR == AZCORE_SYSTEM_ALLOCATOR_MALLOC
|
||||
m_allocator = new(&g_systemSchema)MallocSchema(heapDesc);
|
||||
#else
|
||||
#elif AZCORE_SYSTEM_ALLOCATOR == AZCORE_SYSTEM_ALLOCATOR_HEAP
|
||||
m_allocator = new(&g_systemSchema)HeapSchema(heapDesc);
|
||||
#endif
|
||||
g_isSystemSchemaUsed = true;
|
||||
@@ -139,14 +146,13 @@ SystemAllocator::Create(const Descriptor& desc)
|
||||
// this class should be inheriting from SystemAllocator
|
||||
AZ_Assert(AllocatorInstance<SystemAllocator>::IsReady(), "System allocator must be created before any other allocator! They allocate from it.");
|
||||
|
||||
#ifdef AZCORE_SYS_ALLOCATOR_HPPA
|
||||
#if AZCORE_SYSTEM_ALLOCATOR == AZCORE_SYSTEM_ALLOCATOR_HPHA
|
||||
m_allocator = azcreate(HphaSchema, (heapDesc), SystemAllocator);
|
||||
#elif defined(AZCORE_SYS_ALLOCATOR_MALLOC)
|
||||
#elif AZCORE_SYSTEM_ALLOCATOR == AZCORE_SYSTEM_ALLOCATOR_MALLOC
|
||||
m_allocator = azcreate(MallocSchema, (heapDesc), SystemAllocator);
|
||||
#else
|
||||
#elif AZCORE_SYSTEM_ALLOCATOR == AZCORE_SYSTEM_ALLOCATOR_HEAP
|
||||
m_allocator = azcreate(HeapSchema, (heapDesc), SystemAllocator);
|
||||
#endif
|
||||
|
||||
if (m_allocator == NULL)
|
||||
{
|
||||
isReady = false;
|
||||
@@ -178,11 +184,11 @@ SystemAllocator::Destroy()
|
||||
{
|
||||
if ((void*)m_allocator == (void*)&g_systemSchema)
|
||||
{
|
||||
#ifdef AZCORE_SYS_ALLOCATOR_HPPA
|
||||
#if AZCORE_SYSTEM_ALLOCATOR == AZCORE_SYSTEM_ALLOCATOR_HPHA
|
||||
static_cast<HphaSchema*>(m_allocator)->~HphaSchema();
|
||||
#elif defined(AZCORE_SYS_ALLOCATOR_MALLOC)
|
||||
#elif AZCORE_SYSTEM_ALLOCATOR == AZCORE_SYSTEM_ALLOCATOR_MALLOC
|
||||
static_cast<MallocSchema*>(m_allocator)->~MallocSchema();
|
||||
#else
|
||||
#elif AZCORE_SYSTEM_ALLOCATOR == AZCORE_SYSTEM_ALLOCATOR_HEAP
|
||||
static_cast<HeapSchema*>(m_allocator)->~HeapSchema();
|
||||
#endif
|
||||
g_isSystemSchemaUsed = false;
|
||||
|
||||
@@ -36,10 +36,13 @@ namespace AZ
|
||||
|
||||
void NameData::release()
|
||||
{
|
||||
// this could be released after we decrement the counter, therefore we will
|
||||
// base the release on the hash which is stable
|
||||
Hash hash = m_hash;
|
||||
AZ_Assert(m_useCount > 0, "m_useCount is already 0!");
|
||||
if (m_useCount.fetch_sub(1) == 1)
|
||||
{
|
||||
AZ::NameDictionary::Instance().TryReleaseName(this);
|
||||
AZ::NameDictionary::Instance().TryReleaseName(hash);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,6 +10,11 @@
|
||||
|
||||
#include <AzCore/Name/Internal/NameData.h>
|
||||
|
||||
namespace UnitTest
|
||||
{
|
||||
class NameTest;
|
||||
}
|
||||
|
||||
namespace AZ
|
||||
{
|
||||
class NameDictionary;
|
||||
@@ -29,6 +34,7 @@ namespace AZ
|
||||
class Name
|
||||
{
|
||||
friend NameDictionary;
|
||||
friend UnitTest::NameTest;
|
||||
public:
|
||||
using Hash = Internal::NameData::Hash;
|
||||
|
||||
|
||||
@@ -166,7 +166,7 @@ namespace AZ
|
||||
}
|
||||
}
|
||||
|
||||
void NameDictionary::TryReleaseName(Internal::NameData* nameData)
|
||||
void NameDictionary::TryReleaseName(Name::Hash hash)
|
||||
{
|
||||
// Note that we don't remove NameData from the dictionary if it has been involved in a collision.
|
||||
// This avoids specific edge cases where a Name object could get an incorrect hash value. Consider
|
||||
@@ -179,15 +179,24 @@ namespace AZ
|
||||
// the dictionary *again*, this time with hash value 1000. Name objects pointing to the original
|
||||
// entry and Name objects pointing to the new entry will fail comparison operations.
|
||||
|
||||
// Early exit to avoid locking the mutex unnecessarily.
|
||||
if (nameData->m_hashCollision)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
AZStd::unique_lock<AZStd::shared_mutex> lock(m_sharedMutex);
|
||||
|
||||
// Check m_hashCollision again inside the m_sharedMutex because a new collision could have happened
|
||||
auto dictIt = m_dictionary.find(hash);
|
||||
if (dictIt == m_dictionary.end())
|
||||
{
|
||||
// This check is to safeguard around the following scenario
|
||||
// T1, gets into TryReleaseName
|
||||
// T2 gets into MakeName, acquires the lock, returns a new Name that increments the counter
|
||||
// T2 deletes the Name decrements the counter, gets into TryReleaseName
|
||||
// T1 gets the lock, goes to the compare_exchange if and has a counter of 0, deletes
|
||||
// Then T2 continues, gets the lock and crashes because nameData was deleted
|
||||
return;
|
||||
}
|
||||
|
||||
Internal::NameData* nameData = dictIt->second;
|
||||
|
||||
// Check m_hashCollision inside the m_sharedMutex because a new collision could have happened
|
||||
// on another thread before taking the lock.
|
||||
if (nameData->m_hashCollision)
|
||||
{
|
||||
|
||||
@@ -83,7 +83,7 @@ namespace AZ
|
||||
|
||||
// Attempts to release the name from the dictionary, but checks to make sure
|
||||
// a reference wasn't taken by another thread.
|
||||
void TryReleaseName(Internal::NameData* data);
|
||||
void TryReleaseName(Name::Hash hash);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
@@ -1850,7 +1850,7 @@ namespace AZ
|
||||
* {
|
||||
* // do any conversion of caching of the "data" here and forward this to behavior (often the reason for this is that you can't pass everything to behavior
|
||||
* // plus behavior can't really handle all constructs pointer to pointer, rvalues, etc. as they don't make sense for most script environments
|
||||
* int result = 0; // set the default value for your result if the behavior if there is no implmentation
|
||||
* int result = 0; // set the default value for your result if the behavior if there is no implementation
|
||||
* // The AZ_EBUS_BEHAVIOR_BINDER defines FN_EventName for each index. You can also cache it yourself (but it's slower), static int cacheIndex = GetFunctionIndex("OnEvent1"); and use that .
|
||||
* CallResult(result, FN_OnEvent1, data); // forward to the binding (there can be none, this is why we need to always have properly set result, when there is one)
|
||||
* return result; // return the result like you will in any normal EBus even with result
|
||||
|
||||
@@ -25,6 +25,7 @@ set(FILES
|
||||
Asset/AssetJsonSerializer.h
|
||||
Asset/AssetManager.cpp
|
||||
Asset/AssetManager.h
|
||||
Asset/AssetManager_private.h
|
||||
Asset/AssetManagerBus.h
|
||||
Asset/AssetManagerComponent.cpp
|
||||
Asset/AssetManagerComponent.h
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <AzCore/Casting/numeric_cast.h>
|
||||
#include <AzCore/std/createdestroy.h>
|
||||
#include <AzCore/std/iterator.h>
|
||||
|
||||
@@ -46,6 +45,10 @@ namespace AZStd
|
||||
return npos;
|
||||
}
|
||||
size_t foundIndex = searchIndex + charFindIndex;
|
||||
if (foundIndex + count > size)
|
||||
{
|
||||
return npos; // the rest of the string doesnt fit in the remainder of the data buffer
|
||||
}
|
||||
if (Traits::compare(&data[foundIndex], ptr, count) == 0)
|
||||
{
|
||||
return foundIndex;
|
||||
|
||||
@@ -53,6 +53,15 @@ ly_add_source_properties(
|
||||
VALUES ${LY_PAL_TOOLS_DEFINES}
|
||||
)
|
||||
|
||||
if(LY_BUILD_WITH_ADDRESS_SANITIZER)
|
||||
# Default to use Malloc schema so ASan works well
|
||||
ly_add_source_properties(
|
||||
SOURCES AzCore/Memory/SystemAllocator.cpp
|
||||
PROPERTY COMPILE_DEFINITIONS
|
||||
VALUES AZCORE_SYSTEM_ALLOCATOR=AZCORE_SYSTEM_ALLOCATOR_MALLOC
|
||||
)
|
||||
endif()
|
||||
|
||||
################################################################################
|
||||
# Tests
|
||||
################################################################################
|
||||
|
||||
@@ -109,6 +109,19 @@
|
||||
#define AZ_TRAIT_USE_ERRNO_T_TYPEDEF 1
|
||||
#define AZ_TRAIT_USE_POSIX_TEMP_FOLDER 0
|
||||
|
||||
// wchar_t/char formatting
|
||||
// Reason: https://docs.microsoft.com/en-us/cpp/c-runtime-library/format-specification-syntax-printf-and-wprintf-functions?view=msvc-160
|
||||
// The Z type character, and the behavior of the c, C, s, and S type characters when they're used with the printf and wprintf functions,
|
||||
// are Microsoft extensions. The ISO C standard uses c and s consistently for narrow characters and strings, and C and S for wide characters
|
||||
// and strings, in all formatting functions.
|
||||
#define AZ_TRAIT_FORMAT_STRING_PRINTF_CHAR "%c"
|
||||
#define AZ_TRAIT_FORMAT_STRING_PRINTF_WCHAR "%C"
|
||||
#define AZ_TRAIT_FORMAT_STRING_WPRINTF_CHAR "%c"
|
||||
#define AZ_TRAIT_FORMAT_STRING_WPRINTF_WCHAR "%C"
|
||||
#define AZ_TRAIT_FORMAT_STRING_PRINTF_STRING "%s"
|
||||
#define AZ_TRAIT_FORMAT_STRING_PRINTF_WSTRING "%S"
|
||||
#define AZ_TRAIT_FORMAT_STRING_WPRINTF_STRING "%s"
|
||||
#define AZ_TRAIT_FORMAT_STRING_WPRINTF_WSTRING "%S"
|
||||
// Legacy traits ...
|
||||
#define AZ_TRAIT_LEGACY_CRYCOMMON_USE_WINDOWS_STUBS 1
|
||||
#define AZ_TRAIT_LEGACY_CRYPAK_UNIX_LIKE_FILE_SYSTEM 1
|
||||
|
||||
+1
-1
@@ -49,7 +49,7 @@ namespace AZ::Platform
|
||||
AZ_Assert(m_events[0], "There is no synchronization event created for the main streamer thread to use to suspend.");
|
||||
|
||||
DWORD result = ::WaitForMultipleObjects(m_handleCount, m_events, false, INFINITE);
|
||||
if (result >= WAIT_OBJECT_0 && result < WAIT_OBJECT_0 + m_handleCount)
|
||||
if (result < WAIT_OBJECT_0 + m_handleCount)
|
||||
{
|
||||
DWORD index = result - WAIT_OBJECT_0;
|
||||
::ResetEvent(m_events[index]);
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
#
|
||||
# Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
# For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
#
|
||||
#
|
||||
|
||||
set(FILES
|
||||
RadTelemetry/ProfileTelemetry.h
|
||||
RadTelemetry/ProfileTelemetryBus.h
|
||||
)
|
||||
@@ -109,6 +109,20 @@
|
||||
#define AZ_TRAIT_USE_ERRNO_T_TYPEDEF 1
|
||||
#define AZ_TRAIT_USE_POSIX_TEMP_FOLDER 1
|
||||
|
||||
// wchar_t/char formatting
|
||||
// Reason: https://docs.microsoft.com/en-us/cpp/c-runtime-library/format-specification-syntax-printf-and-wprintf-functions?view=msvc-160
|
||||
// The Z type character, and the behavior of the c, C, s, and S type characters when they're used with the printf and wprintf functions,
|
||||
// are Microsoft extensions. The ISO C standard uses c and s consistently for narrow characters and strings, and C and S for wide characters
|
||||
// and strings, in all formatting functions.
|
||||
#define AZ_TRAIT_FORMAT_STRING_PRINTF_CHAR "%c"
|
||||
#define AZ_TRAIT_FORMAT_STRING_PRINTF_WCHAR "%C"
|
||||
#define AZ_TRAIT_FORMAT_STRING_WPRINTF_CHAR "%c"
|
||||
#define AZ_TRAIT_FORMAT_STRING_WPRINTF_WCHAR "%C"
|
||||
#define AZ_TRAIT_FORMAT_STRING_PRINTF_STRING "%s"
|
||||
#define AZ_TRAIT_FORMAT_STRING_PRINTF_WSTRING "%S"
|
||||
#define AZ_TRAIT_FORMAT_STRING_WPRINTF_STRING "%s"
|
||||
#define AZ_TRAIT_FORMAT_STRING_WPRINTF_WSTRING "%S"
|
||||
|
||||
// Legacy traits ...
|
||||
#define AZ_TRAIT_LEGACY_CRYCOMMON_USE_WINDOWS_STUBS 1
|
||||
#define AZ_TRAIT_LEGACY_CRYPAK_UNIX_LIKE_FILE_SYSTEM 1
|
||||
|
||||
@@ -109,6 +109,20 @@
|
||||
#define AZ_TRAIT_USE_ERRNO_T_TYPEDEF 0
|
||||
#define AZ_TRAIT_USE_POSIX_TEMP_FOLDER 1
|
||||
|
||||
// wchar_t/char formatting
|
||||
// Reason: https://docs.microsoft.com/en-us/cpp/c-runtime-library/format-specification-syntax-printf-and-wprintf-functions?view=msvc-160
|
||||
// The Z type character, and the behavior of the c, C, s, and S type characters when they're used with the printf and wprintf functions,
|
||||
// are Microsoft extensions. The ISO C standard uses c and s consistently for narrow characters and strings, and C and S for wide characters
|
||||
// and strings, in all formatting functions.
|
||||
#define AZ_TRAIT_FORMAT_STRING_PRINTF_CHAR "%c"
|
||||
#define AZ_TRAIT_FORMAT_STRING_PRINTF_WCHAR "%C"
|
||||
#define AZ_TRAIT_FORMAT_STRING_WPRINTF_CHAR "%c"
|
||||
#define AZ_TRAIT_FORMAT_STRING_WPRINTF_WCHAR "%C"
|
||||
#define AZ_TRAIT_FORMAT_STRING_PRINTF_STRING "%s"
|
||||
#define AZ_TRAIT_FORMAT_STRING_PRINTF_WSTRING "%S"
|
||||
#define AZ_TRAIT_FORMAT_STRING_WPRINTF_STRING "%s"
|
||||
#define AZ_TRAIT_FORMAT_STRING_WPRINTF_WSTRING "%S"
|
||||
|
||||
// Legacy traits ...
|
||||
#define AZ_TRAIT_LEGACY_CRYCOMMON_USE_WINDOWS_STUBS 1
|
||||
#define AZ_TRAIT_LEGACY_CRYPAK_UNIX_LIKE_FILE_SYSTEM 1
|
||||
|
||||
@@ -109,6 +109,20 @@
|
||||
#define AZ_TRAIT_USE_ERRNO_T_TYPEDEF 0
|
||||
#define AZ_TRAIT_USE_POSIX_TEMP_FOLDER 0
|
||||
|
||||
// wchar_t/char formatting
|
||||
// Reason: https://docs.microsoft.com/en-us/cpp/c-runtime-library/format-specification-syntax-printf-and-wprintf-functions?view=msvc-160
|
||||
// The Z type character, and the behavior of the c, C, s, and S type characters when they're used with the printf and wprintf functions,
|
||||
// are Microsoft extensions. The ISO C standard uses c and s consistently for narrow characters and strings, and C and S for wide characters
|
||||
// and strings, in all formatting functions.
|
||||
#define AZ_TRAIT_FORMAT_STRING_PRINTF_CHAR "%c"
|
||||
#define AZ_TRAIT_FORMAT_STRING_PRINTF_WCHAR "%C"
|
||||
#define AZ_TRAIT_FORMAT_STRING_WPRINTF_CHAR "%C"
|
||||
#define AZ_TRAIT_FORMAT_STRING_WPRINTF_WCHAR "%c"
|
||||
#define AZ_TRAIT_FORMAT_STRING_PRINTF_STRING "%s"
|
||||
#define AZ_TRAIT_FORMAT_STRING_PRINTF_WSTRING "%S"
|
||||
#define AZ_TRAIT_FORMAT_STRING_WPRINTF_STRING "%S"
|
||||
#define AZ_TRAIT_FORMAT_STRING_WPRINTF_WSTRING "%s"
|
||||
|
||||
// Legacy traits ...
|
||||
#define AZ_TRAIT_LEGACY_CRYCOMMON_USE_WINDOWS_STUBS 0
|
||||
#define AZ_TRAIT_LEGACY_CRYPAK_UNIX_LIKE_FILE_SYSTEM 0
|
||||
|
||||
@@ -110,6 +110,20 @@
|
||||
#define AZ_TRAIT_USE_ERRNO_T_TYPEDEF 0
|
||||
#define AZ_TRAIT_USE_POSIX_TEMP_FOLDER 0
|
||||
|
||||
// wchar_t/char formatting
|
||||
// Reason: https://docs.microsoft.com/en-us/cpp/c-runtime-library/format-specification-syntax-printf-and-wprintf-functions?view=msvc-160
|
||||
// The Z type character, and the behavior of the c, C, s, and S type characters when they're used with the printf and wprintf functions,
|
||||
// are Microsoft extensions. The ISO C standard uses c and s consistently for narrow characters and strings, and C and S for wide characters
|
||||
// and strings, in all formatting functions.
|
||||
#define AZ_TRAIT_FORMAT_STRING_PRINTF_CHAR "%c"
|
||||
#define AZ_TRAIT_FORMAT_STRING_PRINTF_WCHAR "%C"
|
||||
#define AZ_TRAIT_FORMAT_STRING_WPRINTF_CHAR "%c"
|
||||
#define AZ_TRAIT_FORMAT_STRING_WPRINTF_WCHAR "%C"
|
||||
#define AZ_TRAIT_FORMAT_STRING_PRINTF_STRING "%s"
|
||||
#define AZ_TRAIT_FORMAT_STRING_PRINTF_WSTRING "%S"
|
||||
#define AZ_TRAIT_FORMAT_STRING_WPRINTF_STRING "%s"
|
||||
#define AZ_TRAIT_FORMAT_STRING_WPRINTF_WSTRING "%S"
|
||||
|
||||
// Legacy traits ...
|
||||
#define AZ_TRAIT_LEGACY_CRYCOMMON_USE_WINDOWS_STUBS 1
|
||||
#define AZ_TRAIT_LEGACY_CRYPAK_UNIX_LIKE_FILE_SYSTEM 1
|
||||
|
||||
@@ -1458,17 +1458,17 @@ namespace UnitTest
|
||||
constexpr double v15 = 0;
|
||||
constexpr const char* v16 = "Hello";
|
||||
constexpr const wchar_t* v17 = L"Hello";
|
||||
constexpr void* v18 = 0;
|
||||
constexpr void* v18 = nullptr;
|
||||
|
||||
// This shouldn't give a compile error
|
||||
AZStd::string::format(
|
||||
"%i %c %uc %c %c %i %i %u %i %lu %li %llu %lli %f %f %s %ls %p",
|
||||
"%i %c %uc " AZ_TRAIT_FORMAT_STRING_PRINTF_CHAR AZ_TRAIT_FORMAT_STRING_PRINTF_WCHAR " %i %i %u %i %lu %li %llu %lli %f %f " AZ_TRAIT_FORMAT_STRING_PRINTF_STRING AZ_TRAIT_FORMAT_STRING_PRINTF_WSTRING " %p",
|
||||
v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18);
|
||||
|
||||
// This shouldn't give a compile error
|
||||
AZStd::wstring::format(
|
||||
L"%i %c %uc %c %lc %i %i %u %i %lu %li %llu %lli %f %f %s %ls %p",
|
||||
v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18);
|
||||
L"%i %c %uc " AZ_TRAIT_FORMAT_STRING_WPRINTF_CHAR AZ_TRAIT_FORMAT_STRING_WPRINTF_WCHAR " %i %i %u %i %lu %li %llu %lli %f %f " AZ_TRAIT_FORMAT_STRING_WPRINTF_STRING AZ_TRAIT_FORMAT_STRING_WPRINTF_WSTRING " %p",
|
||||
v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18);
|
||||
|
||||
class WrappedInt
|
||||
{
|
||||
|
||||
@@ -36,12 +36,23 @@ using namespace UnitTestInternal;
|
||||
/**
|
||||
* Validate a vector for certain number of elements.
|
||||
*/
|
||||
#define AZ_TEST_VALIDATE_VECTOR(_Vector, _NumElements) \
|
||||
EXPECT_TRUE(_Vector.validate()); \
|
||||
EXPECT_EQ(_NumElements, _Vector.size()); \
|
||||
EXPECT_TRUE((_NumElements > 0) ? !_Vector.empty() : _Vector.empty()); \
|
||||
EXPECT_TRUE((_NumElements > 0) ? _Vector.capacity() >= _NumElements : true); \
|
||||
EXPECT_TRUE((_NumElements > 0) ? _Vector.begin() != _Vector.end() : _Vector.begin() == _Vector.end()); \
|
||||
#define AZ_TEST_VALIDATE_VECTOR(_Vector, _NumElements) \
|
||||
EXPECT_NE(_NumElements, 0); \
|
||||
EXPECT_TRUE(_Vector.validate()); \
|
||||
EXPECT_EQ(_NumElements, _Vector.size()); \
|
||||
EXPECT_TRUE(!_Vector.empty()); \
|
||||
EXPECT_TRUE(_Vector.capacity() >= _NumElements); \
|
||||
EXPECT_TRUE(_Vector.begin() != _Vector.end()); \
|
||||
EXPECT_NE(nullptr, _Vector.data())
|
||||
|
||||
/**
|
||||
* Validate a vector for 0 number of elements. The above macro creates expressions that are always true for size == 0
|
||||
*/
|
||||
#define AZ_TEST_VALIDATE_VECTOR_0(_Vector) \
|
||||
EXPECT_TRUE(_Vector.validate()); \
|
||||
EXPECT_EQ(0, _Vector.size()); \
|
||||
EXPECT_TRUE(_Vector.empty()); \
|
||||
EXPECT_TRUE(_Vector.begin() == _Vector.end()); \
|
||||
EXPECT_NE(nullptr, _Vector.data())
|
||||
|
||||
namespace UnitTest
|
||||
@@ -312,7 +323,7 @@ namespace UnitTest
|
||||
|
||||
// erase
|
||||
int_vector1.erase(int_vector1.begin(), int_vector1.end());
|
||||
AZ_TEST_VALIDATE_VECTOR(int_vector1, 0); // Zero elements but valid capacity.
|
||||
AZ_TEST_VALIDATE_VECTOR_0(int_vector1); // Zero elements but valid capacity.
|
||||
|
||||
int_vector1.push_back(10);
|
||||
int_vector1.push_back(20);
|
||||
@@ -324,11 +335,11 @@ namespace UnitTest
|
||||
|
||||
// clear
|
||||
int_vector1.clear();
|
||||
AZ_TEST_VALIDATE_VECTOR(int_vector1, 0); // Zero elements but valid capacity.
|
||||
AZ_TEST_VALIDATE_VECTOR_0(int_vector1); // Zero elements but valid capacity.
|
||||
|
||||
// swap
|
||||
int_vector1.swap(int_vector);
|
||||
AZ_TEST_VALIDATE_VECTOR(int_vector, 0);
|
||||
AZ_TEST_VALIDATE_VECTOR_0(int_vector);
|
||||
AZ_TEST_VALIDATE_VECTOR(int_vector1, 33);
|
||||
AZ_TEST_ASSERT(int_vector1.front() == 55);
|
||||
|
||||
@@ -524,11 +535,11 @@ namespace UnitTest
|
||||
|
||||
// Default vector (integral type).
|
||||
fixed_vector<int, 50> int_vector_default;
|
||||
AZ_TEST_VALIDATE_VECTOR(int_vector_default, 0);
|
||||
AZ_TEST_VALIDATE_VECTOR_0(int_vector_default);
|
||||
|
||||
// Default vector (non-integral type).
|
||||
fixed_vector<MyClass, 10> myclass_vector_default;
|
||||
AZ_TEST_VALIDATE_VECTOR(myclass_vector_default, 0);
|
||||
AZ_TEST_VALIDATE_VECTOR_0(myclass_vector_default);
|
||||
|
||||
// Create a vector (using fill ctor, with memset optimization to set the values)
|
||||
typedef fixed_vector<char, 10> char_10_type;
|
||||
@@ -633,7 +644,7 @@ namespace UnitTest
|
||||
|
||||
// erase
|
||||
int_vector1.erase(int_vector1.begin(), int_vector1.end());
|
||||
AZ_TEST_VALIDATE_VECTOR(int_vector1, 0);
|
||||
AZ_TEST_VALIDATE_VECTOR_0(int_vector1);
|
||||
|
||||
int_vector1.push_back(10);
|
||||
int_vector1.push_back(20);
|
||||
@@ -645,11 +656,11 @@ namespace UnitTest
|
||||
|
||||
// clear
|
||||
int_vector1.clear();
|
||||
AZ_TEST_VALIDATE_VECTOR(int_vector1, 0);
|
||||
AZ_TEST_VALIDATE_VECTOR_0(int_vector1);
|
||||
|
||||
// swap
|
||||
int_vector1.swap(int_vector);
|
||||
AZ_TEST_VALIDATE_VECTOR(int_vector, 0);
|
||||
AZ_TEST_VALIDATE_VECTOR_0(int_vector);
|
||||
AZ_TEST_VALIDATE_VECTOR(int_vector1, 33);
|
||||
AZ_TEST_ASSERT(int_vector1.front() == 55);
|
||||
|
||||
@@ -963,7 +974,7 @@ namespace UnitTest
|
||||
AZ_TEST_VALIDATE_VECTOR(deep_vec_2, 12);
|
||||
|
||||
deep_vec_2.clear();
|
||||
AZ_TEST_VALIDATE_VECTOR(deep_vec_2, 0);
|
||||
AZ_TEST_VALIDATE_VECTOR_0(deep_vec_2);
|
||||
}
|
||||
#endif // AZ_UNIT_TEST_SKIP_STD_VECTOR_AND_ARRAY_TESTS
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
#include <AzCore/Math/Sfmt.h>
|
||||
#include <AzCore/UnitTest/TestTypes.h>
|
||||
#include <AzCore/Math/Vector4.h>
|
||||
|
||||
using namespace AZ;
|
||||
|
||||
@@ -27,8 +28,8 @@ namespace UnitTest
|
||||
void SetUp() override
|
||||
{
|
||||
AllocatorsFixture::SetUp();
|
||||
array1 = (AZ::u64*)azmalloc(sizeof(AZ::u64) * 2 * (BLOCK_SIZE / 4), AZStd::alignment_of<AZ::u64>::value);
|
||||
array2 = (AZ::u64*)azmalloc(sizeof(AZ::u64) * 2 * (10000 / 4), AZStd::alignment_of<AZ::u64>::value);
|
||||
array1 = (AZ::u64*)azmalloc(sizeof(AZ::u64) * 2 * (BLOCK_SIZE / 4), AZStd::alignment_of<AZ::Vector4>::value);
|
||||
array2 = (AZ::u64*)azmalloc(sizeof(AZ::u64) * 2 * (10000 / 4), AZStd::alignment_of<AZ::Vector4>::value);
|
||||
}
|
||||
|
||||
void TearDown() override
|
||||
|
||||
@@ -171,7 +171,17 @@ namespace UnitTest
|
||||
azsnprintf(buffer, RandomStringBufferSize, "%d", m_random.GetRandom());
|
||||
return buffer;
|
||||
}
|
||||
|
||||
|
||||
AZ::Internal::NameData* GetNameData(AZ::Name& name)
|
||||
{
|
||||
return name.m_data.get();
|
||||
}
|
||||
|
||||
void FreeMemoryFromNameData(AZ::Internal::NameData* nameData)
|
||||
{
|
||||
delete nameData;
|
||||
}
|
||||
|
||||
AZ::SimpleLcgRandom m_random;
|
||||
};
|
||||
|
||||
@@ -488,13 +498,20 @@ namespace UnitTest
|
||||
|
||||
TEST_F(NameTest, ReportLeakedNames)
|
||||
{
|
||||
AZ::Name leakedName{"hello"};
|
||||
AZ_TEST_START_TRACE_SUPPRESSION;
|
||||
AZ::NameDictionary::Destroy();
|
||||
AZ_TEST_STOP_TRACE_SUPPRESSION(1);
|
||||
AZ::Internal::NameData* leakedNameData = nullptr;
|
||||
{
|
||||
AZ::Name leakedName{ "hello" };
|
||||
AZ_TEST_START_TRACE_SUPPRESSION;
|
||||
AZ::NameDictionary::Destroy();
|
||||
AZ_TEST_STOP_TRACE_SUPPRESSION(1);
|
||||
|
||||
// Create the dictionary again to avoid error in TearDown()
|
||||
AZ::NameDictionary::Create();
|
||||
leakedNameData = GetNameData(leakedName);
|
||||
|
||||
// Create the dictionary again to avoid crash when the intrusive_ptr in Name tries to access NameDictionary to free it
|
||||
AZ::NameDictionary::Create();
|
||||
}
|
||||
|
||||
FreeMemoryFromNameData(leakedNameData); // free it to avoid memory system reporting the leak
|
||||
}
|
||||
|
||||
TEST_F(NameTest, NullTerminatedTest)
|
||||
@@ -586,7 +603,7 @@ namespace UnitTest
|
||||
AZ::NameDictionary::Create();
|
||||
|
||||
// 3 threads per name effectively makes two readers and one writer (the first to run will write in the dictionary)
|
||||
RunConcurrencyTest<ThreadCreatesOneName>(AZ_TRAIT_UNIT_TEST_NAME_COUNT, 3);
|
||||
RunConcurrencyTest<ThreadCreatesOneName>(AZStd::thread::hardware_concurrency(), 3);
|
||||
}
|
||||
|
||||
TEST_F(NameTest, ConcurrencyDataTest_EachThreadCreatesOneName_HighCollisions)
|
||||
@@ -595,7 +612,7 @@ namespace UnitTest
|
||||
AZ::NameDictionary::Create();
|
||||
|
||||
// 3 threads per name effectively makes two readers and one writer (the first to run will write in the dictionary)
|
||||
RunConcurrencyTest<ThreadCreatesOneName>(AZ_TRAIT_UNIT_TEST_NAME_COUNT, 3);
|
||||
RunConcurrencyTest<ThreadCreatesOneName>(AZStd::thread::hardware_concurrency() / 2, 3);
|
||||
}
|
||||
|
||||
TEST_F(NameTest, ConcurrencyDataTest_EachThreadRepeatedlyCreatesAndReleasesOneName_NoCollision)
|
||||
@@ -620,7 +637,7 @@ namespace UnitTest
|
||||
|
||||
TEST_F(NameTest, DISABLED_NameVsStringPerf_Creation)
|
||||
{
|
||||
constexpr int CreateCount = AZ_TRAIT_UNIT_TEST_NAME_COUNT;
|
||||
constexpr int CreateCount = 1000;
|
||||
|
||||
char buffer[RandomStringBufferSize];
|
||||
|
||||
@@ -629,7 +646,7 @@ namespace UnitTest
|
||||
AZStd::sys_time_t stringTime;
|
||||
|
||||
{
|
||||
const size_t dictionaryNoiseSize = AZ_TRAIT_UNIT_TEST_NAME_COUNT;
|
||||
const size_t dictionaryNoiseSize = 1000;
|
||||
|
||||
AZStd::vector<AZ::Name> existingNames;
|
||||
existingNames.reserve(dictionaryNoiseSize);
|
||||
|
||||
@@ -1081,16 +1081,6 @@ namespace AZ
|
||||
return ResultCode::Error;
|
||||
}
|
||||
|
||||
//bound check
|
||||
//note that seeking beyond end or before beginning is system dependent
|
||||
//therefore we will define that on all platforms it is not allowed
|
||||
if (newFilePosition < 0)
|
||||
{
|
||||
AZ_TracePrintf(RemoteFileIOChannel, "RemoteFileIO::Seek(fileHandle=%u, offset=%i, type=%s) seek to a position before the begining of a file!", fileHandle, offset, type == SeekType::SeekFromCurrent ? "SeekFromCurrent" : type == SeekType::SeekFromEnd ? "SeekFromEnd" : type == SeekType::SeekFromStart ? "SeekFromStart" : "Unknown");
|
||||
REMOTEFILE_LOG_APPEND(AZStd::string::format("RemoteFileIO::Seek(fileHandle=%u, offset=%i, type=%s) seek to a position before the begining of a file!", fileHandle, offset, type == SeekType::SeekFromCurrent ? "SeekFromCurrent" : type == SeekType::SeekFromEnd ? "SeekFromEnd" : type == SeekType::SeekFromStart ? "SeekFromStart" : "Unknown").c_str());
|
||||
newFilePosition = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
AZ::u64 fileSize = 0;
|
||||
Size(fileHandle, fileSize);
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include <AzCore/std/containers/variant.h>
|
||||
#include <AzCore/std/containers/vector.h>
|
||||
#include <AzCore/std/smart_ptr/shared_ptr.h>
|
||||
#include <AzCore/Casting/numeric_cast.h>
|
||||
|
||||
namespace Physics
|
||||
{
|
||||
|
||||
@@ -102,11 +102,25 @@ namespace AzFramework
|
||||
static const AZ::EBusAddressPolicy AddressPolicy = AZ::EBusAddressPolicy::Single;
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
virtual void OnTerrainDataCreateBegin() {};
|
||||
virtual void OnTerrainDataCreateEnd() {};
|
||||
enum TerrainDataChangedMask : uint8_t
|
||||
{
|
||||
None = 0b00000000,
|
||||
Settings = 0b00000001,
|
||||
HeightData = 0b00000010,
|
||||
ColorData = 0b00000100,
|
||||
SurfaceData = 0b00001000
|
||||
};
|
||||
|
||||
virtual void OnTerrainDataDestroyBegin() {};
|
||||
virtual void OnTerrainDataDestroyEnd() {};
|
||||
virtual void OnTerrainDataCreateBegin() {}
|
||||
virtual void OnTerrainDataCreateEnd() {}
|
||||
|
||||
virtual void OnTerrainDataDestroyBegin() {}
|
||||
virtual void OnTerrainDataDestroyEnd() {}
|
||||
|
||||
virtual void OnTerrainDataChanged(
|
||||
[[maybe_unused]] const AZ::Aabb& dirtyRegion, [[maybe_unused]] TerrainDataChangedMask dataChangedMask)
|
||||
{
|
||||
}
|
||||
};
|
||||
using TerrainDataNotificationBus = AZ::EBus<TerrainDataNotifications>;
|
||||
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
#define AZ_TRAIT_UNIT_TEST_ASSET_MANAGER_TEST_DEFAULT_TIMEOUT_SECS 5
|
||||
#define AZ_TRAIT_UNIT_TEST_ENTITY_ID_GEN_TEST_COUNT 10000
|
||||
#define AZ_TRAIT_UNIT_TEST_DILLER_TRIGGER_EVENT_COUNT 100000
|
||||
#define AZ_TRAIT_UNIT_TEST_NAME_COUNT 1000
|
||||
|
||||
#define AZ_TRAIT_TEST_APPEND_ROOT_FOLDER_TO_PATH true
|
||||
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
#define AZ_TRAIT_UNIT_TEST_ASSET_MANAGER_TEST_DEFAULT_TIMEOUT_SECS 5
|
||||
#define AZ_TRAIT_UNIT_TEST_ENTITY_ID_GEN_TEST_COUNT 10000
|
||||
#define AZ_TRAIT_UNIT_TEST_DILLER_TRIGGER_EVENT_COUNT 100000
|
||||
#define AZ_TRAIT_UNIT_TEST_NAME_COUNT 1000
|
||||
|
||||
#define AZ_TRAIT_DISABLE_ALL_SAVE_DATA_TESTS true
|
||||
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
#define AZ_TRAIT_UNIT_TEST_ASSET_MANAGER_TEST_DEFAULT_TIMEOUT_SECS 5
|
||||
#define AZ_TRAIT_UNIT_TEST_ENTITY_ID_GEN_TEST_COUNT 10000
|
||||
#define AZ_TRAIT_UNIT_TEST_DILLER_TRIGGER_EVENT_COUNT 100000
|
||||
#define AZ_TRAIT_UNIT_TEST_NAME_COUNT 1000
|
||||
|
||||
#define AZ_TRAIT_DISABLE_ASSET_JOB_PARALLEL_TESTS true
|
||||
#define AZ_TRAIT_DISABLE_ASSET_MANAGER_FLOOD_TEST true
|
||||
|
||||
@@ -13,4 +13,3 @@
|
||||
#define AZ_TRAIT_UNIT_TEST_ASSET_MANAGER_TEST_DEFAULT_TIMEOUT_SECS 5
|
||||
#define AZ_TRAIT_UNIT_TEST_ENTITY_ID_GEN_TEST_COUNT 10000
|
||||
#define AZ_TRAIT_UNIT_TEST_DILLER_TRIGGER_EVENT_COUNT 100000
|
||||
#define AZ_TRAIT_UNIT_TEST_NAME_COUNT 1000
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
#define AZ_TRAIT_UNIT_TEST_ASSET_MANAGER_TEST_DEFAULT_TIMEOUT_SECS 5
|
||||
#define AZ_TRAIT_UNIT_TEST_ENTITY_ID_GEN_TEST_COUNT 10000
|
||||
#define AZ_TRAIT_UNIT_TEST_DILLER_TRIGGER_EVENT_COUNT 100000
|
||||
#define AZ_TRAIT_UNIT_TEST_NAME_COUNT 1000
|
||||
|
||||
#define AZ_TRAIT_DISABLE_ASSET_JOB_PARALLEL_TESTS true
|
||||
#define AZ_TRAIT_DISABLE_ASSET_MANAGER_FLOOD_TEST true
|
||||
|
||||
+4
-4
@@ -204,12 +204,11 @@ namespace AzToolsFramework
|
||||
}
|
||||
}
|
||||
|
||||
for (const auto& categoryPair : componentDataTable)
|
||||
for (const auto& [categoryName, componentMap] : componentDataTable)
|
||||
{
|
||||
auto categoryItemItr = categoryItemMap.find(categoryPair.first + "/");
|
||||
auto categoryItemItr = categoryItemMap.find(categoryName + "/");
|
||||
auto parentItem = categoryItemItr != categoryItemMap.end() ? categoryItemItr->second : m_componentModel->invisibleRootItem();
|
||||
|
||||
const auto& componentMap = categoryPair.second;
|
||||
for (const auto& componentPair : componentMap)
|
||||
{
|
||||
auto componentClass = componentPair.second;
|
||||
@@ -217,7 +216,8 @@ namespace AzToolsFramework
|
||||
const QString& componentIconName = componentIconTable[componentClass];
|
||||
auto deprecatedInfo = deprecatedList.find(componentClass->m_typeId);
|
||||
bool componentIsDeprecated = deprecatedInfo != deprecatedList.end();
|
||||
if ((!applyRegExFilter || componentName.contains(m_searchRegExp)) && (!componentIsDeprecated || !deprecatedInfo->second.m_hideComponent))
|
||||
if ((!applyRegExFilter || categoryName.contains(m_searchRegExp) || componentName.contains(m_searchRegExp))
|
||||
&& (!componentIsDeprecated || !deprecatedInfo->second.m_hideComponent))
|
||||
{
|
||||
//count the number of components on selected entities that match this type
|
||||
auto componentCount = AZStd::count_if(allComponentsOnSelectedEntities.begin(), allComponentsOnSelectedEntities.end(), [componentClass](const AZ::Component* component) {
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AzCore/EBus/EBus.h>
|
||||
#include <AzCore/Math/Aabb.h>
|
||||
|
||||
namespace AZ
|
||||
{
|
||||
/**
|
||||
* the EBus is used to request information about potential vegetation surfaces
|
||||
*/
|
||||
class HeightmapUpdateNotification
|
||||
: public AZ::EBusTraits
|
||||
{
|
||||
public:
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// EBusTraits
|
||||
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Multiple;
|
||||
static const AZ::EBusAddressPolicy AddressPolicy = AZ::EBusAddressPolicy::Single;
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// Occurs when the terrain height map is modified.
|
||||
virtual void HeightmapModified(const AZ::Aabb& bounds) = 0;
|
||||
};
|
||||
|
||||
typedef AZ::EBus<HeightmapUpdateNotification> HeightmapUpdateNotificationBus;
|
||||
}
|
||||
@@ -745,7 +745,7 @@ private:
|
||||
|
||||
void Update()
|
||||
{
|
||||
if (m_index >= 0 && m_index < m_parentNode->getChildCount())
|
||||
if (m_index < m_parentNode->getChildCount())
|
||||
{
|
||||
m_currentChildNode = m_parentNode->getChild(static_cast<int>(m_index));
|
||||
}
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include <CryCommon/LegacyAllocator.h>
|
||||
|
||||
namespace AZ
|
||||
{
|
||||
LegacyAllocator::pointer_type LegacyAllocator::Allocate(size_type byteSize, size_type alignment, int flags, const char* name, const char* fileName, int lineNum, unsigned int suppressStackRecord)
|
||||
{
|
||||
if (alignment == 0)
|
||||
{
|
||||
// Some STL containers, like std::vector, seem to have a requirement where a specific minimum alignment will be chosen when the alignment is set to 0
|
||||
// Take a look at _Allocate_manually_vector_aligned in xmemory0
|
||||
alignment = sizeof(void*) * 2;
|
||||
}
|
||||
|
||||
pointer_type ptr = m_schema->Allocate(byteSize, alignment, flags, name, fileName, lineNum, suppressStackRecord);
|
||||
AZ_PROFILE_MEMORY_ALLOC_EX(MemoryReserved, fileName, lineNum, ptr, byteSize, name ? name : GetName());
|
||||
AZ_MEMORY_PROFILE(ProfileAllocation(ptr, byteSize, alignment, name, fileName, lineNum, suppressStackRecord));
|
||||
AZ_Assert(ptr || byteSize == 0, "OOM - Failed to allocate %zu bytes from LegacyAllocator", byteSize);
|
||||
return ptr;
|
||||
}
|
||||
|
||||
// DeAllocate with file/line, to track when allocs were freed from Cry
|
||||
void LegacyAllocator::DeAllocate(pointer_type ptr, [[maybe_unused]] const char* file, [[maybe_unused]] const int line, size_type byteSize, size_type alignment)
|
||||
{
|
||||
AZ_PROFILE_MEMORY_FREE_EX(MemoryReserved, file, line, ptr);
|
||||
AZ_MEMORY_PROFILE(ProfileDeallocation(ptr, byteSize, alignment, nullptr));
|
||||
m_schema->DeAllocate(ptr, byteSize, alignment);
|
||||
}
|
||||
|
||||
// Realloc with file/line, because Cry uses realloc(nullptr) and realloc(ptr, 0) to mimic malloc/free
|
||||
LegacyAllocator::pointer_type LegacyAllocator::ReAllocate(pointer_type ptr, size_type newSize, size_type newAlignment, [[maybe_unused]] const char* file, [[maybe_unused]] const int line)
|
||||
{
|
||||
if (newAlignment == 0)
|
||||
{
|
||||
// Some STL containers, like std::vector, seem to have a requirement where a specific minimum alignment will be chosen when the alignment is set to 0
|
||||
// Take a look at _Allocate_manually_vector_aligned in xmemory0
|
||||
newAlignment = sizeof(void*) * 2;
|
||||
}
|
||||
|
||||
AZ_MEMORY_PROFILE(ProfileReallocationBegin(ptr, newSize));
|
||||
AZ_PROFILE_MEMORY_FREE_EX(MemoryReserved, file, line, ptr);
|
||||
pointer_type newPtr = m_schema->ReAllocate(ptr, newSize, newAlignment);
|
||||
AZ_PROFILE_MEMORY_ALLOC_EX(MemoryReserved, file, line, newPtr, newSize, "LegacyAllocator Realloc");
|
||||
AZ_MEMORY_PROFILE(ProfileReallocationEnd(ptr, newPtr, newSize, newAlignment));
|
||||
AZ_Assert(newPtr || newSize == 0, "OOM - Failed to reallocate %zu bytes from LegacyAllocator", newSize);
|
||||
return newPtr;
|
||||
}
|
||||
|
||||
void LegacyAllocator::DeAllocate(pointer_type ptr, size_type byteSize, size_type alignment)
|
||||
{
|
||||
AZ_MEMORY_PROFILE(ProfileDeallocation(ptr, 0, 0, nullptr));
|
||||
Base::DeAllocate(ptr, byteSize, alignment);
|
||||
}
|
||||
|
||||
LegacyAllocator::pointer_type LegacyAllocator::ReAllocate(pointer_type ptr, size_type newSize, size_type newAlignment)
|
||||
{
|
||||
if (newAlignment == 0)
|
||||
{
|
||||
// Some STL containers, like std::vector, seem to have a requirement where a specific minimum alignment will be chosen when the alignment is set to 0
|
||||
// Take a look at _Allocate_manually_vector_aligned in xmemory0
|
||||
newAlignment = sizeof(void*) * 2;
|
||||
}
|
||||
|
||||
AZ_MEMORY_PROFILE(ProfileReallocationBegin(ptr, newSize));
|
||||
pointer_type newPtr = Base::ReAllocate(ptr, newSize, newAlignment);
|
||||
AZ_MEMORY_PROFILE(ProfileReallocationEnd(ptr, newPtr, newSize, newAlignment));
|
||||
AZ_Assert(newPtr || newSize == 0, "OOM - Failed to reallocate %zu bytes from LegacyAllocator", newSize);
|
||||
return newPtr;
|
||||
}
|
||||
}
|
||||
@@ -11,118 +11,36 @@
|
||||
#include <AzCore/Memory/AllocatorBase.h>
|
||||
#include <AzCore/Memory/HphaSchema.h>
|
||||
|
||||
#define AZCORE_SYS_ALLOCATOR_HPPA
|
||||
//#define AZCORE_SYS_ALLOCATOR_MALLOC
|
||||
|
||||
#ifdef AZCORE_SYS_ALLOCATOR_HPPA
|
||||
# include <AzCore/Memory/HphaSchema.h>
|
||||
#elif defined(AZCORE_SYS_ALLOCATOR_MALLOC)
|
||||
# include <AzCore/Memory/MallocSchema.h>
|
||||
#else
|
||||
# include <AzCore/Memory/HeapSchema.h>
|
||||
#endif
|
||||
|
||||
namespace AZ
|
||||
{
|
||||
|
||||
#ifdef AZCORE_SYS_ALLOCATOR_HPPA
|
||||
typedef AZ::HphaSchema LegacyAllocatorSchema;
|
||||
#elif defined(AZCORE_SYS_ALLOCATOR_MALLOC)
|
||||
typedef AZ::MallocSchema LegacyAllocatorSchema;
|
||||
#else
|
||||
typedef AZ::HeapSchema LegacyAllocatorSchema;
|
||||
#endif
|
||||
|
||||
struct LegacyAllocatorDescriptor
|
||||
: public LegacyAllocatorSchema::Descriptor
|
||||
{
|
||||
LegacyAllocatorDescriptor()
|
||||
{
|
||||
// pull 32MB from the OS at a time
|
||||
#ifdef AZCORE_SYS_ALLOCATOR_HPPA
|
||||
m_systemChunkSize = 32 * 1024 * 1024;
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
||||
class LegacyAllocator
|
||||
: public SimpleSchemaAllocator<AZ::HphaSchema, LegacyAllocatorDescriptor>
|
||||
: public SimpleSchemaAllocator<AZ::HphaSchema, AZ::HphaSchema::Descriptor>
|
||||
{
|
||||
public:
|
||||
AZ_TYPE_INFO(LegacyAllocator, "{17FC25A4-92D9-48C5-BB85-7F860FCA2C6F}");
|
||||
|
||||
using Descriptor = LegacyAllocatorDescriptor;
|
||||
using Base = SimpleSchemaAllocator<AZ::HphaSchema, LegacyAllocatorDescriptor>;
|
||||
using Descriptor = AZ::HphaSchema::Descriptor;
|
||||
using Base = SimpleSchemaAllocator<AZ::HphaSchema, Descriptor>;
|
||||
using pointer_type = typename Base::pointer_type;
|
||||
using size_type = typename Base::size_type;
|
||||
using difference_type = typename Base::difference_type;
|
||||
|
||||
LegacyAllocator()
|
||||
: Base("LegacyAllocator", "Allocator for Legacy CryEngine systems")
|
||||
{
|
||||
}
|
||||
|
||||
pointer_type Allocate(size_type byteSize, size_type alignment, int flags = 0, const char* name = 0, const char* fileName = 0, int lineNum = 0, unsigned int suppressStackRecord = 0) override
|
||||
{
|
||||
if (alignment == 0)
|
||||
{
|
||||
// Some STL containers, like std::vector, are assuming a specific minimum alignment. seems to have a requirement
|
||||
// Take a look at _Allocate_manually_vector_aligned in xmemory0
|
||||
alignment = sizeof(void*) * 2;
|
||||
}
|
||||
|
||||
pointer_type ptr = m_schema->Allocate(byteSize, alignment, flags, name, fileName, lineNum, suppressStackRecord);
|
||||
AZ_PROFILE_MEMORY_ALLOC_EX(MemoryReserved, fileName, lineNum, ptr, byteSize, name ? name : GetName());
|
||||
AZ_MEMORY_PROFILE(ProfileAllocation(ptr, byteSize, alignment, name, fileName, lineNum, suppressStackRecord));
|
||||
AZ_Assert(ptr || byteSize == 0, "OOM - Failed to allocate %zu bytes from LegacyAllocator", byteSize);
|
||||
return ptr;
|
||||
}
|
||||
pointer_type Allocate(size_type byteSize, size_type alignment, int flags = 0, const char* name = 0, const char* fileName = 0, int lineNum = 0, unsigned int suppressStackRecord = 0) override;
|
||||
|
||||
// DeAllocate with file/line, to track when allocs were freed from Cry
|
||||
void DeAllocate(pointer_type ptr, [[maybe_unused]] const char* file, [[maybe_unused]] const int line, size_type byteSize = 0, size_type alignment = 0)
|
||||
{
|
||||
AZ_PROFILE_MEMORY_FREE_EX(MemoryReserved, file, line, ptr);
|
||||
AZ_MEMORY_PROFILE(ProfileDeallocation(ptr, byteSize, alignment, nullptr));
|
||||
m_schema->DeAllocate(ptr, byteSize, alignment);
|
||||
}
|
||||
void DeAllocate(pointer_type ptr, const char* file, const int line, size_type byteSize = 0, size_type alignment = 0);
|
||||
|
||||
// Realloc with file/line, because Cry uses realloc(nullptr) and realloc(ptr, 0) to mimic malloc/free
|
||||
pointer_type ReAllocate(pointer_type ptr, size_type newSize, size_type newAlignment, [[maybe_unused]] const char* file, [[maybe_unused]] const int line)
|
||||
{
|
||||
if (newAlignment == 0)
|
||||
{
|
||||
// Some STL containers, like std::vector, are assuming a specific minimum alignment. seems to have a requirement
|
||||
// Take a look at _Allocate_manually_vector_aligned in xmemory0
|
||||
newAlignment = sizeof(void*) * 2;
|
||||
}
|
||||
pointer_type ReAllocate(pointer_type ptr, size_type newSize, size_type newAlignment, const char* file, const int line);
|
||||
|
||||
AZ_MEMORY_PROFILE(ProfileReallocationBegin(ptr, newSize));
|
||||
AZ_PROFILE_MEMORY_FREE_EX(MemoryReserved, file, line, ptr);
|
||||
pointer_type newPtr = m_schema->ReAllocate(ptr, newSize, newAlignment);
|
||||
AZ_PROFILE_MEMORY_ALLOC_EX(MemoryReserved, file, line, newPtr, newSize, "LegacyAllocator Realloc");
|
||||
AZ_MEMORY_PROFILE(ProfileReallocationEnd(ptr, newPtr, newSize, newAlignment));
|
||||
AZ_Assert(newPtr || newSize == 0, "OOM - Failed to reallocate %zu bytes from LegacyAllocator", newSize);
|
||||
return newPtr;
|
||||
}
|
||||
void DeAllocate(pointer_type ptr, size_type byteSize = 0, size_type alignment = 0) override;
|
||||
|
||||
void DeAllocate(pointer_type ptr, size_type byteSize = 0, size_type alignment = 0) override
|
||||
{
|
||||
AZ_MEMORY_PROFILE(ProfileDeallocation(ptr, 0, 0, nullptr));
|
||||
Base::DeAllocate(ptr, byteSize, alignment);
|
||||
}
|
||||
|
||||
pointer_type ReAllocate(pointer_type ptr, size_type newSize, size_type newAlignment) override
|
||||
{
|
||||
if (newAlignment == 0)
|
||||
{
|
||||
// Some STL containers, like std::vector, are assuming a specific minimum alignment. seems to have a requirement
|
||||
// Take a look at _Allocate_manually_vector_aligned in xmemory0
|
||||
newAlignment = sizeof(void*) * 2;
|
||||
}
|
||||
|
||||
AZ_MEMORY_PROFILE(ProfileReallocationBegin(ptr, newSize));
|
||||
pointer_type newPtr = Base::ReAllocate(ptr, newSize, newAlignment);
|
||||
AZ_MEMORY_PROFILE(ProfileReallocationEnd(ptr, newPtr, newSize, newAlignment));
|
||||
AZ_Assert(newPtr || newSize == 0, "OOM - Failed to reallocate %zu bytes from LegacyAllocator", newSize);
|
||||
return newPtr;
|
||||
}
|
||||
pointer_type ReAllocate(pointer_type ptr, size_type newSize, size_type newAlignment) override;
|
||||
};
|
||||
|
||||
using StdLegacyAllocator = AZStdAlloc<LegacyAllocator>;
|
||||
@@ -133,57 +51,4 @@ namespace AZ
|
||||
class AllocatorInstance<LegacyAllocator> : public Internal::AllocatorInstanceBase<LegacyAllocator>
|
||||
{
|
||||
};
|
||||
|
||||
#if defined(AZ_PLATFORM_PROVO) || defined(AZ_PLATFORM_JASPER)
|
||||
struct GlobalAllocatorDescriptor
|
||||
: public AZ::HphaSchema::Descriptor
|
||||
{
|
||||
GlobalAllocatorDescriptor()
|
||||
{
|
||||
// pull 1MB from the OS at a time
|
||||
m_systemChunkSize = 1024 * 1024;
|
||||
}
|
||||
};
|
||||
|
||||
class GlobalAllocator
|
||||
: public SimpleSchemaAllocator<AZ::HphaSchema, GlobalAllocatorDescriptor>
|
||||
{
|
||||
public:
|
||||
AZ_TYPE_INFO(GlobalAllocator, "{BC7861DA-AF7F-4FFD-A2F5-BAD89BDD77FD}");
|
||||
|
||||
using Descriptor = GlobalAllocatorDescriptor;
|
||||
using Base = SimpleSchemaAllocator<AZ::HphaSchema, GlobalAllocatorDescriptor>;
|
||||
|
||||
GlobalAllocator()
|
||||
: Base("GlobalAllocator", "Allocator for untracked new/delete/malloc/free")
|
||||
{
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
// IAllocatorAllocate
|
||||
//---------------------------------------------------------------------
|
||||
pointer_type Allocate(size_type byteSize, size_type alignment, int flags = 0, const char* name = 0, const char* fileName = 0, int lineNum = 0, unsigned int suppressStackRecord = 0) override
|
||||
{
|
||||
// Note: We cannot put the asserts in the AllocateBase class because various allocators depend on allocations failing from some heap classes.
|
||||
pointer_type ptr = Base::Allocate(byteSize, alignment, flags, name, fileName, lineNum, suppressStackRecord);
|
||||
AZ_Assert(ptr, "OOM - Failed to allocate %zu bytes from GlobalAllocator", byteSize);
|
||||
return ptr;
|
||||
}
|
||||
|
||||
pointer_type ReAllocate(pointer_type ptr, size_type newSize, size_type newAlignment) override
|
||||
{
|
||||
pointer_type newPtr = Base::ReAllocate(ptr, newSize, newAlignment);
|
||||
AZ_Assert(newPtr, "OOM - Failed to reallocate %zu bytes from GlobalAllocator", newSize);
|
||||
return newPtr;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// Specialize for the GlobalAllocator to provide one per module that does not use the
|
||||
// environment for its storage
|
||||
template <>
|
||||
class AllocatorInstance<GlobalAllocator> : public Internal::AllocatorInstanceBase<GlobalAllocator, AllocatorStorage::ModuleStoragePolicy<GlobalAllocator, false>>
|
||||
{
|
||||
};
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -53,7 +53,6 @@ set(FILES
|
||||
HMDBus.h
|
||||
VRCommon.h
|
||||
StereoRendererBus.h
|
||||
HeightmapUpdateNotificationBus.h
|
||||
INavigationSystem.h
|
||||
IMNM.h
|
||||
SFunctor.h
|
||||
@@ -90,6 +89,7 @@ set(FILES
|
||||
CryVersion.h
|
||||
FrameProfiler.h
|
||||
HeapAllocator.h
|
||||
LegacyAllocator.cpp
|
||||
LegacyAllocator.h
|
||||
MetaUtils.h
|
||||
MiniQueue.h
|
||||
|
||||
@@ -3133,6 +3133,9 @@ char* CXConsole::GetCheatVarAt(uint32 nOffset)
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
size_t CXConsole::GetSortedVars(AZStd::vector<AZStd::string_view>& pszArray, const char* szPrefix)
|
||||
{
|
||||
// This method used to insert instead of push_back, so we need to clear first
|
||||
pszArray.clear();
|
||||
|
||||
size_t iPrefixLen = szPrefix ? strlen(szPrefix) : 0;
|
||||
|
||||
// variables
|
||||
|
||||
@@ -197,11 +197,11 @@ namespace AssetProcessor
|
||||
|
||||
m_jobsInFlight.insert(rcJob);
|
||||
|
||||
for(size_t jobIndex = m_jobs.size() - 1; jobIndex >= 0; --jobIndex)
|
||||
for(int jobIndex = static_cast<int>(m_jobs.size()) - 1; jobIndex >= 0; --jobIndex)
|
||||
{
|
||||
if(m_jobs[jobIndex] == rcJob)
|
||||
{
|
||||
Q_EMIT dataChanged(index(aznumeric_caster(jobIndex), 0, QModelIndex()), index(aznumeric_caster(jobIndex), 0, QModelIndex()));
|
||||
Q_EMIT dataChanged(index(jobIndex, 0, QModelIndex()), index(jobIndex, 0, QModelIndex()));
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -240,7 +240,7 @@ namespace AssetProcessor
|
||||
foundInQueue = m_jobsInQueueLookup.erase(foundInQueue);
|
||||
}
|
||||
|
||||
for (size_t jobIndex = m_jobs.size() - 1; jobIndex >= 0; --jobIndex)
|
||||
for (int jobIndex = static_cast<int>(m_jobs.size()) - 1; jobIndex >= 0; --jobIndex)
|
||||
{
|
||||
if(m_jobs[jobIndex] == rcJob)
|
||||
{
|
||||
@@ -251,7 +251,7 @@ namespace AssetProcessor
|
||||
#if defined(DEBUG_RCJOB_MODEL)
|
||||
AZ_TracePrintf(AssetProcessor::DebugChannel, "JobTrace =>JobCompleted(%i %s,%s,%s)\n", rcJob, rcJob->GetJobEntry().m_databaseSourceName.toUtf8().constData(), rcJob->GetPlatformInfo().m_identifier.c_str(), rcJob->GetJobKey().toUtf8().constData());
|
||||
#endif
|
||||
beginRemoveRows(QModelIndex(), aznumeric_caster(jobIndex), aznumeric_caster(jobIndex));
|
||||
beginRemoveRows(QModelIndex(), jobIndex, jobIndex);
|
||||
m_jobs.erase(m_jobs.begin() + jobIndex);
|
||||
endRemoveRows();
|
||||
|
||||
|
||||
@@ -52,7 +52,6 @@ namespace AssetProcessor
|
||||
SizeType finalPosition = GenericStream::ComputeSeekPosition(bytes, mode);
|
||||
|
||||
AZ_Assert(finalPosition < INT_MAX, "Overflow of SizeType to int in ByteArrayStream.");
|
||||
AZ_Assert(finalPosition >= 0, "underflow in seek in ByteArrayStream");
|
||||
AZ_Assert(finalPosition <= m_activeArray->size(), "You cant seek beyond end of file");
|
||||
|
||||
// safety clamp!
|
||||
|
||||
@@ -72,11 +72,6 @@ namespace AssetUtilsInternal
|
||||
|
||||
bool FileCopyMoveWithTimeout(QString sourceFile, QString outputFile, bool isCopy, unsigned int waitTimeInSeconds)
|
||||
{
|
||||
if (waitTimeInSeconds < 0)
|
||||
{
|
||||
AZ_Warning("Asset Processor", waitTimeInSeconds >= 0, "Invalid timeout specified by the user");
|
||||
waitTimeInSeconds = 0;
|
||||
}
|
||||
bool failureOccurredOnce = false; // used for logging.
|
||||
bool operationSucceeded = false;
|
||||
QFile outFile(outputFile);
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
#include <AzCore/std/string/string.h>
|
||||
#include <GemCatalog/GemModel.h>
|
||||
#include <AzCore/Casting/numeric_cast.h>
|
||||
|
||||
namespace O3DE::ProjectManager
|
||||
{
|
||||
|
||||
@@ -173,10 +173,7 @@ namespace AreaChart
|
||||
|
||||
void AreaChart::ConfigureVerticalAxis(QString label, unsigned int minimumHeight)
|
||||
{
|
||||
if (minimumHeight >= 0)
|
||||
{
|
||||
SetMinimumValueRange(minimumHeight);
|
||||
}
|
||||
SetMinimumValueRange(minimumHeight);
|
||||
|
||||
if (m_verticalAxis == nullptr)
|
||||
{
|
||||
@@ -323,7 +320,7 @@ namespace AreaChart
|
||||
// Need to handle the areas right at the edge of the polygons
|
||||
for (int i = -1; i <= 1; ++i)
|
||||
{
|
||||
if ((counter+i) < 0 || (counter + i) >= m_hitAreas.size())
|
||||
if ((counter + i) >= m_hitAreas.size())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
*/
|
||||
|
||||
#include <TestImpactConsoleUtils.h>
|
||||
#include <AzCore/Casting/numeric_cast.h>
|
||||
|
||||
namespace TestImpact
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user