Merge branch 'main' into sceneapi_script_autotest

This commit is contained in:
jackalbe
2021-04-13 17:54:57 -05:00
1725 changed files with 35703 additions and 520825 deletions
@@ -418,16 +418,19 @@ namespace AZ
void AssetContainer::ListWaitingAssets() const
{
#if defined(AZ_ENABLE_TRACING)
AZStd::lock_guard<AZStd::recursive_mutex> lock(m_readyMutex);
AZ_TracePrintf("AssetContainer", "Waiting on assets:\n");
for (auto& thisAsset : m_waitingAssets)
{
AZ_TracePrintf("AssetContainer", " %s\n",thisAsset.ToString<AZStd::string>().c_str());
}
#endif
}
void AssetContainer::ListWaitingPreloads(const AssetId& assetId) const
void AssetContainer::ListWaitingPreloads([[maybe_unused]] const AssetId& assetId) const
{
#if defined(AZ_ENABLE_TRACING)
AZStd::lock_guard<AZStd::recursive_mutex> preloadGuard(m_preloadMutex);
auto preloadEntry = m_preloadList.find(assetId);
if (preloadEntry != m_preloadList.end())
@@ -442,6 +445,7 @@ namespace AZ
{
AZ_TracePrintf("AssetContainer", "%s isn't waiting on any preloads:\n", assetId.ToString<AZStd::string>().c_str());
}
#endif
}
void AssetContainer::AddWaitingAssets(const AZStd::vector<AssetId>& assetList)
@@ -90,8 +90,8 @@ namespace AZ::Data
// Get the results
auto streamer = AZ::Interface<AZ::IO::IStreamer>::Get();
AZ::u64 bytesRead = 0;
bool result = streamer->GetReadRequestResult(fileHandle, m_buffer, bytesRead,
AZ::IO::IStreamerTypes::ClaimMemory::Yes);
streamer->GetReadRequestResult(fileHandle, m_buffer, bytesRead,
AZ::IO::IStreamerTypes::ClaimMemory::Yes);
auto status = streamer->GetRequestStatus(fileHandle);
m_loadedSize = aznumeric_cast<size_t>(bytesRead);
@@ -1750,7 +1750,6 @@ namespace AZ
{
AssetData* data = asset.Get();
{
const AZ::Data::AssetId& assetId = asset.GetId();
AZStd::scoped_lock<AZStd::recursive_mutex> assetLock(m_assetMutex);
if (data)
@@ -362,11 +362,20 @@ namespace AZ
ComponentApplication::ComponentApplication()
: ComponentApplication(0, nullptr)
{
if (Interface<ComponentApplicationRequests>::Get() == nullptr)
{
Interface<ComponentApplicationRequests>::Register(this);
}
}
ComponentApplication::ComponentApplication(int argC, char** argV)
: m_eventLogger{}
{
if (Interface<ComponentApplicationRequests>::Get() == nullptr)
{
Interface<ComponentApplicationRequests>::Register(this);
}
if (argV)
{
m_argC = argC;
@@ -462,6 +471,11 @@ namespace AZ
//=========================================================================
ComponentApplication::~ComponentApplication()
{
if (Interface<ComponentApplicationRequests>::Get() == this)
{
Interface<ComponentApplicationRequests>::Unregister(this);
}
if (m_isStarted)
{
Destroy();
@@ -495,8 +509,7 @@ namespace AZ
DestroyAllocator();
}
Entity* ComponentApplication::Create(const Descriptor& descriptor,
const StartupParameters& startupParameters)
Entity* ComponentApplication::Create(const Descriptor& descriptor, const StartupParameters& startupParameters)
{
AZ_Assert(!m_isStarted, "Component application already started!");
@@ -943,6 +956,16 @@ namespace AZ
}
}
void ComponentApplication::RegisterEntityAddedEventHandler(EntityAddedEvent::Handler& handler)
{
handler.Connect(m_entityAddedEvent);
}
void ComponentApplication::RegisterEntityRemovedEventHandler(EntityRemovedEvent::Handler& handler)
{
handler.Connect(m_entityRemovedEvent);
}
//=========================================================================
// AddEntity
// [5/30/2012]
@@ -954,7 +977,7 @@ namespace AZ
{
return false;
}
m_entityAddedEvent.Signal(entity);
return m_entities.insert(AZStd::make_pair(entity->GetId(), entity)).second;
}
@@ -969,7 +992,7 @@ namespace AZ
{
return false;
}
m_entityRemovedEvent.Signal(entity);
return (m_entities.erase(entity->GetId()) == 1);
}
@@ -982,6 +1005,7 @@ namespace AZ
Entity* entity = FindEntity(id);
if (entity)
{
m_entityRemovedEvent.Signal(entity);
delete entity;
return true;
}
@@ -193,8 +193,7 @@ namespace AZ
* You will need to setup all system components manually.
* \returns pointer to the system entity.
*/
virtual Entity* Create(const Descriptor& descriptor,
const StartupParameters& startupParameters = StartupParameters());
virtual Entity* Create(const Descriptor& descriptor, const StartupParameters& startupParameters = StartupParameters());
virtual void Destroy();
virtual void DestroyAllocator(); // Called at the end of Destroy(). Applications can override to do tear down work right before allocator is destroyed.
@@ -202,6 +201,8 @@ namespace AZ
// ComponentApplicationRequests
void RegisterComponentDescriptor(const ComponentDescriptor* descriptor) override final;
void UnregisterComponentDescriptor(const ComponentDescriptor* descriptor) override final;
void RegisterEntityAddedEventHandler(EntityAddedEvent::Handler& handler) override final;
void RegisterEntityRemovedEventHandler(EntityRemovedEvent::Handler& handler) override final;
bool AddEntity(Entity* entity) override;
bool RemoveEntity(Entity* entity) override;
bool DeleteEntity(const EntityId& id) override;
@@ -380,6 +381,8 @@ namespace AZ
float m_deltaTime{ 0.0f };
AZStd::unique_ptr<ModuleManager> m_moduleManager;
AZStd::unique_ptr<SettingsRegistryInterface> m_settingsRegistry;
EntityAddedEvent m_entityAddedEvent;
EntityRemovedEvent m_entityRemovedEvent;
AZ::IConsole* m_console{};
Descriptor m_descriptor;
bool m_isStarted{ false };
@@ -13,6 +13,7 @@
#pragma once
#include <AzCore/EBus/EBus.h>
#include <AzCore/EBus/Event.h>
#include <AzCore/Component/EntityId.h>
#include <AzCore/std/parallel/mutex.h>
#include <AzCore/std/string/osstring.h>
@@ -69,160 +70,138 @@ namespace AZ
inline bool ApplicationTypeQuery::IsGame() const { return (m_maskValue & Masks::Game) == Masks::Game; }
inline bool ApplicationTypeQuery::IsValid() const { return m_maskValue != Masks::Invalid; }
/**
* Event bus that components use to make requests of the main application.
* Only one application can exist at a time, which is why this bus
* supports only one listener.
*/
using EntityAddedEvent = AZ::Event<AZ::Entity*>;
using EntityRemovedEvent = AZ::Event<AZ::Entity*>;
//! Interface that components can use to make requests of the main application.
class ComponentApplicationRequests
: public AZ::EBusTraits
{
public:
AZ_RTTI(ComponentApplicationRequests, "{E8BE41B7-615F-4FE8-B611-8A9E441290A8}");
/**
* Destroys the event bus that components use to make requests of the main application.
*/
virtual ~ComponentApplicationRequests() {}
//! Destroys the event bus that components use to make requests of the main application.
virtual ~ComponentApplicationRequests() = default;
//////////////////////////////////////////////////////////////////////////
// EBusTraits overrides - application is a singleton
/**
* Overrides the default AZ::EBusTraits handler policy to allow one
* listener only, because only one application can exist at a time.
*/
static const AZ::EBusHandlerPolicy HandlerPolicy = EBusHandlerPolicy::Single; // We sort components on m_initOrder.
/**
* Overrides the default AZ::EBusTraits mutex type to the AZStd implementation of
* a recursive mutex with exclusive ownership semantics. A mutex prevents multiple
* threads from accessing shared data simultaneously.
*/
typedef AZStd::recursive_mutex MutexType;
//////////////////////////////////////////////////////////////////////////
/**
* Registers a component descriptor with the application.
* @param descriptor A component descriptor.
*/
//! Registers a component descriptor with the application.
//! @param descriptor A component descriptor.
virtual void RegisterComponentDescriptor(const ComponentDescriptor* descriptor) = 0;
/**
* Unregisters a component descriptor with the application.
* @param descriptor A component descriptor.
*/
//! Unregisters a component descriptor with the application.
//! @param descriptor A component descriptor.
virtual void UnregisterComponentDescriptor(const ComponentDescriptor* descriptor) = 0;
/**
* Gets a pointer to the application.
* @return A pointer to the application.
*/
virtual ComponentApplication* GetApplication() = 0;
/**
* Adds an entity to the application's registry.
* Calling Init() on an entity automatically performs this operation.
* @param entity A pointer to the entity to add to the application's registry.
* @return True if the operation succeeded. False if the operation failed.
*/
virtual bool AddEntity(Entity* entity) = 0;
/**
* Removes the specified entity from the application's registry.
* Deleting an entity automatically performs this operation.
* @param entity A pointer to the entity that will be removed from the application's registry.
* @return True if the operation succeeded. False if the operation failed.
*/
virtual bool RemoveEntity(Entity* entity) = 0;
/**
* Unregisters and deletes the specified entity.
* @param entity A reference to the entity that will be unregistered and deleted.
* @return True if the operation succeeded. False if the operation failed.
*/
virtual bool DeleteEntity(const EntityId& id) = 0;
/**
* Returns the entity with the matching ID, if the entity is registered with the application.
* @param entity A reference to the entity that you are searching for.
* @return A pointer to the entity with the specified entity ID.
*/
virtual Entity* FindEntity(const EntityId& id) = 0;
/**
* Returns the name of the entity that has the specified entity ID.
* Entity names are not unique.
* This method exists to facilitate better debugging messages.
* @param entity A reference to the entity whose name you are seeking.
* @return The name of the entity with the specified entity ID.
* If no entity is found for the specified ID, it returns an empty string.
*/
virtual AZStd::string GetEntityName(const EntityId& id) { (void)id; return AZStd::string(); };
//! Gets a pointer to the application.
//! @return A pointer to the application.
virtual ComponentApplication* GetApplication() = 0;
/**
* The type that AZ::ComponentApplicationRequests::EnumerateEntities uses to
* pass entity callbacks to the application for enumeration.
*/
//! Registers an event handler that will be signalled whenever an entity is added.
//! @param handler the event handler to signal.
virtual void RegisterEntityAddedEventHandler(EntityAddedEvent::Handler& handler) = 0;
//! Registers an event handler that will be signalled whenever an entity is removed.
//! @param handler the event handler to signal.
virtual void RegisterEntityRemovedEventHandler(EntityRemovedEvent::Handler& handler) = 0;
//! Adds an entity to the application's registry.
//! Calling Init() on an entity automatically performs this operation.
//! @param entity A pointer to the entity to add to the application's registry.
//! @return True if the operation succeeded. False if the operation failed.
virtual bool AddEntity(Entity* entity) = 0;
//! Removes the specified entity from the application's registry.
//! Deleting an entity automatically performs this operation.
//! @param entity A pointer to the entity that will be removed from the application's registry.
//! @return True if the operation succeeded. False if the operation failed.
virtual bool RemoveEntity(Entity* entity) = 0;
//! Unregisters and deletes the specified entity.
//! @param entity A reference to the entity that will be unregistered and deleted.
//! @return True if the operation succeeded. False if the operation failed.
virtual bool DeleteEntity(const EntityId& id) = 0;
//! Returns the entity with the matching ID, if the entity is registered with the application.
//! @param entity A reference to the entity that you are searching for.
//! @return A pointer to the entity with the specified entity ID.
virtual Entity* FindEntity(const EntityId& id) = 0;
//! Returns the name of the entity that has the specified entity ID.
//! Entity names are not unique.
//! This method exists to facilitate better debugging messages.
//! @param entity A reference to the entity whose name you are seeking.
//! @return The name of the entity with the specified entity ID.
//! If no entity is found for the specified ID, it returns an empty string.
virtual AZStd::string GetEntityName(const EntityId& id) { (void)id; return AZStd::string(); };
//! The type that AZ::ComponentApplicationRequests::EnumerateEntities uses to
//! pass entity callbacks to the application for enumeration.
using EntityCallback = AZStd::function<void(Entity*)>;
/**
* Enumerates all registered entities and invokes the specified callback for each entity.
* @param callback A reference to the callback that is invoked for each entity.
*/
virtual void EnumerateEntities(const EntityCallback& callback) = 0;
/**
* Returns the serialize context that was registered with the app.
* @return The serialize context, if there is one. SerializeContext is a class that contains reflection data
* for serialization and construction of objects.
*/
//! Enumerates all registered entities and invokes the specified callback for each entity.
//! @param callback A reference to the callback that is invoked for each entity.
virtual void EnumerateEntities(const EntityCallback& callback) = 0;
//! Returns the serialize context that was registered with the app.
//! @return The serialize context, if there is one. SerializeContext is a class that contains reflection data
//! for serialization and construction of objects.
virtual class SerializeContext* GetSerializeContext() = 0;
/**
* Returns the behavior context that was registered with the app.
* @return The behavior context, if there is one. BehaviorContext is a class that reflects classes, methods,
* and EBuses for runtime interaction.
*/
//! Returns the behavior context that was registered with the app.
//! @return The behavior context, if there is one. BehaviorContext is a class that reflects classes, methods,
//! and EBuses for runtime interaction.
virtual class BehaviorContext* GetBehaviorContext() = 0;
/**
* Returns the Json Registration context that was registered with the app.
* @return The Json Registration context, if there is one. JsonRegistrationContext is a class that contains
* the serializers used by the best-effort json serialization.
*/
//! Returns the Json Registration context that was registered with the app.
//! @return The Json Registration context, if there is one. JsonRegistrationContext is a class that contains
//! the serializers used by the best-effort json serialization.
virtual class JsonRegistrationContext* GetJsonRegistrationContext() = 0;
/**
* Gets the name of the working root folder that was registered with the app.
* @return A pointer to the name of the app's root folder, if a root folder was registered.
*/
virtual const char* GetAppRoot() const = 0;
/**
* Gets the path of the working engine folder that the app is a part of.
* @return A pointer to the engine path.
*/
virtual const char* GetEngineRoot() const = 0;
/**
* Gets the path to the directory that contains the application's executable.
* @return A pointer to the name of the path that contains the application's executable.
*/
virtual const char* GetExecutableFolder() const = 0;
/**
* Returns a pointer to the driller manager, if driller is enabled.
* The driller manager manages all active driller sessions and driller factories.
* @return A pointer to the driller manager. If driller is not enabled,
* this function returns null.
*/
virtual Debug::DrillerManager* GetDrillerManager() = 0;
//! Gets the name of the working root folder that was registered with the app.
//! @return a pointer to the name of the app's root folder, if a root folder was registered.
virtual const char* GetAppRoot() const = 0;
/**
* ResolveModulePath is called whenever LoadDynamicModule wants to resolve a module in order to actually load it.
* You can override this if you need to load modules from a different path or hijack module loading in some other way.
* If you do, ensure that you use platform-specific conventions to do so, as this is called by multiple platforms.
* The default implantation prepends the path to the executable to the module path, but you can override this behavior
* (Call the base class if you want this behavior to persist in overrides)
*/
virtual void ResolveModulePath(AZ::OSString& /*modulePath*/) { }
//! Gets the path of the working engine folder that the app is a part of.
//! @return a pointer to the engine path.
virtual const char* GetEngineRoot() const = 0;
/**
* Returns AZ parsed command line structure.
* Command Line structure can be queried for switches (-<switch> /<switch>) or positional parameter (<value>)
*/
//! Gets the path to the directory that contains the application's executable.
//! @return a pointer to the name of the path that contains the application's executable.
virtual const char* GetExecutableFolder() const = 0;
//! Returns a pointer to the driller manager, if driller is enabled.
//! The driller manager manages all active driller sessions and driller factories.
//! @return A pointer to the driller manager. If driller is not enabled, this function returns null.
virtual Debug::DrillerManager* GetDrillerManager() = 0;
//! ResolveModulePath is called whenever LoadDynamicModule wants to resolve a module in order to actually load it.
//! You can override this if you need to load modules from a different path or hijack module loading in some other way.
//! If you do, ensure that you use platform-specific conventions to do so, as this is called by multiple platforms.
//! The default implantation prepends the path to the executable to the module path, but you can override this behavior
//! (Call the base class if you want this behavior to persist in overrides)
virtual void ResolveModulePath([[maybe_unused]] AZ::OSString& modulePath) { }
//! Returns AZ parsed command line structure.
//! Command Line structure can be queried for switches (-<switch> /<switch>) or positional parameter (<value>)
virtual AZ::CommandLine* GetAzCommandLine() { return{}; }
//! Returns all the flags that are true for the current application.
virtual void QueryApplicationType(ApplicationTypeQuery& appType) const = 0;
};
/**
* Used by components to make requests of the component application.
*/
typedef AZ::EBus<ComponentApplicationRequests> ComponentApplicationBus;
class ComponentApplicationRequestsEBusTraits
: public AZ::EBusTraits
{
public:
//! EBusTraits overrides - application is a singleton
//! Overrides the default AZ::EBusTraits handler policy to allow one
//! listener only, because only one application can exist at a time.
static const AZ::EBusHandlerPolicy HandlerPolicy = EBusHandlerPolicy::Single; // We sort components on m_initOrder.
//! Overrides the default AZ::EBusTraits mutex type to the AZStd implementation of
//! a recursive mutex with exclusive ownership semantics. A mutex prevents multiple
//! threads from accessing shared data simultaneously.
using MutexType = AZStd::recursive_mutex;
};
//! Used by components to make requests of the component application.
using ComponentApplicationBus = AZ::EBus<ComponentApplicationRequests, ComponentApplicationRequestsEBusTraits>;
}
@@ -18,7 +18,7 @@
#include <AzCore/Component/ComponentApplicationBus.h>
#include <AzCore/Component/TransformBus.h>
#include <AzCore/Component/NamedEntityId.h>
#include <AzCore/Interface/Interface.h>
#include <AzCore/Casting/lossy_cast.h>
#include <AzCore/Serialization/Json/RegistrationContext.h>
@@ -159,10 +159,11 @@ namespace AZ
AZ_Assert(m_state == State::Constructed, "Component should be in Constructed state to be Initialized!");
SetState(State::Initializing);
bool result = true;
EBUS_EVENT_RESULT(result, ComponentApplicationBus, AddEntity, this);
(void)result;
AZ_Assert(result, "Failed to add entity '%s' [0x%llx]! Did you already register an entity with this ID?", m_name.c_str(), m_id);
if (AZ::Interface<ComponentApplicationRequests>::Get() != nullptr)
{
[[maybe_unused]] const bool result = AZ::Interface<ComponentApplicationRequests>::Get()->AddEntity(this);
AZ_Assert(result, "Failed to add entity '%s' [0x%llx]! Did you already register an entity with this ID?", m_name.c_str(), m_id);
}
for (ComponentArrayType::iterator it = m_components.begin(); it != m_components.end();)
{
@@ -40,10 +40,26 @@ namespace AZ
(*idMapper)->SetIsEntityReference(false);
}
JSR::ResultCode idLoadResult =
ContinueLoadingFromJsonObjectField(&entityInstance->m_id,
azrtti_typeid<decltype(entityInstance->m_id)>(),
inputValue, "Id", context);
JSR::ResultCode idLoadResult = ContinueLoadingFromJsonObjectField(
&entityInstance->m_id, azrtti_typeid<decltype(entityInstance->m_id)>(), inputValue, "Id", context);
// If the entity has an invalid ID, there's no point in deserializing, the entity will be unusable.
// It's also dangerous to generate new IDs here:
// - They need to be globally unique
// - We don't know *why* it's invalid (maybe just a typo on the name "Id" for example), so we don't know the ramifications
// of changing it. There might be many other entities that have references to this one that would become invalid as well
// if we try to silently fix it up.
// - Unless we save the ID immediately, it will change every time we serialize the data in, which can happen multiple times
// during the serialization pipeline. So it either needs to be saved back immediately, or we need a deterministic way
// to generate a globally unique ID for the entity.
if (!entityInstance->GetId().IsValid())
{
// Since we're going to halt processing anyways, we just return the error here immediately.
return context.Report(
JSR::ResultCode(JSR::Tasks::ReadField, JSR::Outcomes::Invalid),
"Invalid or missing entity ID - please add an 'Id' field to this entity with a globally unique id. \n"
"Failed to load entity information.");
}
if (hasValidIdMapper)
{
@@ -93,9 +109,10 @@ namespace AZ
inputValue, "IsRuntimeActive", context);
}
return context.Report(result,
result.GetProcessing() == JSR::Processing::Halted ? "Succesfully loaded entity information." :
"Failed to load entity information.");
return context.Report(
result,
result.GetProcessing() != JSR::Processing::Halted ? "Succesfully loaded entity information."
: "Failed to load entity information.");
}
JsonSerializationResult::Result JsonEntitySerializer::Store(rapidjson::Value& outputValue,
@@ -199,7 +216,7 @@ namespace AZ
}
return context.Report(result,
result.GetProcessing() == JSR::Processing::Halted ? "Successfully stored Entity information." :
result.GetProcessing() != JSR::Processing::Halted ? "Successfully stored Entity information." :
"Failed to store Entity information.");
}
@@ -11,7 +11,6 @@
*/
#include <AzCore/EBus/EventSchedulerSystemComponent.h>
#include <AzCore/EBus/ScheduledEvent.h>
#include <AzCore/Interface/Interface.h>
#include <AzCore/Console/ILogger.h>
#include <AzCore/Serialization/SerializeContext.h>
@@ -111,8 +110,10 @@ namespace AZ
TimeMs currentMilliseconds = GetElapsedTimeMs();
if (timedEvent->m_handle == nullptr)
{
timedEvent->m_handle = AllocateHandle(TimeMs(currentMilliseconds + durationMs), durationMs, timedEvent);
timedEvent->m_handle = AllocateHandle();
}
const bool ownsScheduledEvent = false;
*(timedEvent->m_handle) = ScheduledEventHandle(TimeMs(currentMilliseconds + durationMs), durationMs, timedEvent, ownsScheduledEvent);
timedEvent->m_timeInserted = currentMilliseconds;
m_queue.push(timedEvent->m_handle);
return timedEvent->m_handle;
@@ -126,7 +127,9 @@ namespace AZ
}
TimeMs currentMilliseconds = GetElapsedTimeMs();
ScheduledEvent* timedEvent = AllocateManagedEvent(TimeMs(currentMilliseconds + durationMs), durationMs, callback, eventName);
ScheduledEvent* timedEvent = AllocateManagedEvent(callback, eventName);
const bool ownsScheduledEvent = true;
*(timedEvent->m_handle) = ScheduledEventHandle(TimeMs(currentMilliseconds + durationMs), durationMs, timedEvent, ownsScheduledEvent);
timedEvent->m_timeInserted = currentMilliseconds;
m_queue.push(timedEvent->m_handle);
}
@@ -150,10 +153,12 @@ namespace AZ
{
AZLOG_INFO("EventSchedulerSystemComponent::HandleCount = %u", aznumeric_cast<uint32_t>(GetHandleCount()));
AZLOG_INFO("EventSchedulerSystemComponent::FreeHandleCount = %u", aznumeric_cast<uint32_t>(GetFreeHandleCount()));
AZLOG_INFO("EventSchedulerSystemComponent::OwnedEventCount = %u", aznumeric_cast<uint32_t>(m_ownedEvents.size()));
AZLOG_INFO("EventSchedulerSystemComponent::FreeEventCount = %u", aznumeric_cast<uint32_t>(m_freeEvents.size()));
AZLOG_INFO("EventSchedulerSystemComponent::QueueSize = %u", aznumeric_cast<uint32_t>(GetQueueSize()));
}
ScheduledEventHandle* EventSchedulerSystemComponent::AllocateHandle(TimeMs executeTimeMs, TimeMs durationTimeMs, ScheduledEvent* scheduledEvent)
ScheduledEventHandle* EventSchedulerSystemComponent::AllocateHandle()
{
ScheduledEventHandle* result = nullptr;
if (!m_freeHandles.empty())
@@ -166,31 +171,34 @@ namespace AZ
m_handles.resize(m_handles.size() + 1);
result = &(m_handles.back());
}
*result = ScheduledEventHandle(executeTimeMs, durationTimeMs, scheduledEvent, false);
return result;
}
ScheduledEvent* EventSchedulerSystemComponent::AllocateManagedEvent(TimeMs executeTimeMs, TimeMs durationTimeMs, const AZStd::function<void()>& callback, const Name& eventName)
ScheduledEvent* EventSchedulerSystemComponent::AllocateManagedEvent(const AZStd::function<void()>& callback, const Name& eventName)
{
ScheduledEvent* result = new ScheduledEvent(callback, eventName);
ScheduledEventHandle* handle = nullptr;
if (!m_freeHandles.empty())
ScheduledEvent* scheduledEvent = nullptr;
if (!m_freeEvents.empty())
{
handle = m_freeHandles.back();
m_freeHandles.pop_back();
scheduledEvent = m_freeEvents.back();
m_freeEvents.pop_back();
}
else
{
m_handles.resize(m_handles.size() + 1);
handle = &(m_handles.back());
m_ownedEvents.resize(m_ownedEvents.size() + 1);
scheduledEvent = &(m_ownedEvents.back());
}
*handle = ScheduledEventHandle(executeTimeMs, durationTimeMs, result, true);
result->m_handle = handle;
return result;
scheduledEvent->m_eventName = eventName;
scheduledEvent->m_callback = callback;
scheduledEvent->m_handle = AllocateHandle();
return scheduledEvent;
}
void EventSchedulerSystemComponent::FreeHandle(ScheduledEventHandle* handle)
{
if (handle->GetOwnsScheduledEvent())
{
m_freeEvents.push_back(handle->GetScheduledEvent());
}
m_freeHandles.push_back(handle);
}
}
@@ -16,6 +16,7 @@
#include <AzCore/Console/IConsole.h>
#include <AzCore/Component/Component.h>
#include <AzCore/EBus/ScheduledEventHandle.h>
#include <AzCore/EBus/ScheduledEvent.h>
#include <AzCore/Component/TickBus.h>
#include <AzCore/std/containers/vector.h>
#include <AzCore/std/containers/queue.h>
@@ -89,9 +90,11 @@ namespace AZ
//! @}
private:
ScheduledEventHandle* AllocateHandle(TimeMs executeTimeMs, TimeMs durationTimeMs, ScheduledEvent* scheduledEvent);
// Allocates a single use event to capture the passed in callback. Event is cleaned up on completion.
ScheduledEvent* AllocateManagedEvent(TimeMs executeTimeMs, TimeMs durationTimeMs, const AZStd::function<void()>& callback, const Name& eventName);
ScheduledEventHandle* AllocateHandle();
//! Allocates a single use event to capture the passed in callback. Event is cleaned up on completion.
ScheduledEvent* AllocateManagedEvent(const AZStd::function<void()>& callback, const Name& eventName);
void FreeHandle(ScheduledEventHandle* handle);
// Bind the DumpStats member function to the console as 'EventSchedulerSystemComponent.DumpStats'
@@ -100,6 +103,8 @@ namespace AZ
// Priority queues of scheduled events sorted by execution time
AZStd::priority_queue<ScheduledEventHandle*, AZStd::vector<ScheduledEventHandle*>, CompareScheduledEventPtrs> m_queue;
AZStd::priority_queue<ScheduledEventHandle*, AZStd::vector<ScheduledEventHandle*>, PrioritizeScheduledEventPtrs> m_pendingQueue;
AZStd::deque<ScheduledEvent> m_ownedEvents;
AZStd::vector<ScheduledEvent*> m_freeEvents;
AZStd::deque<ScheduledEventHandle> m_handles;
AZStd::vector<ScheduledEventHandle*> m_freeHandles;
};
@@ -359,7 +359,7 @@ namespace AZ
//insert the new handler
handler.m_index = aznumeric_cast<int32_t>(AZStd::distance(m_handlers.begin(), insertLocation));
auto insertedItr = m_handlers.insert(insertLocation, &handler);
m_handlers.insert(insertLocation, &handler);
return handler.m_index;
}
@@ -55,7 +55,6 @@ namespace AZ
void ScheduledEvent::Requeue(TimeMs durationMs)
{
m_durationMs = durationMs;
ClearHandle();
IEventScheduler* eventScheduler = Interface<IEventScheduler>::Get();
if (eventScheduler)
{
@@ -120,10 +119,6 @@ namespace AZ
void ScheduledEvent::ClearHandle()
{
if (m_handle)
{
m_handle->Clear();
m_handle = nullptr;
}
m_handle = nullptr;
}
}
@@ -29,6 +29,9 @@ namespace AZ
class ScheduledEvent
{
public:
//! Default constructor only for AZStd::deque compatibility.
ScheduledEvent() = default;
//! Constructor of ScheduledEvent class.
//! @param callback a call back function to be executed when the event triggers
//! @param eventName name of the scheduled event for easier debugging
@@ -82,8 +85,6 @@ namespace AZ
//! Clears any currently set handle pointer.
void ClearHandle();
AZ_DISABLE_COPY_MOVE(ScheduledEvent);
Name m_eventName; //< Scheduled event name
AZStd::function<void()> m_callback; //< A callback function to run when the scheduled event triggers
ScheduledEventHandle* m_handle = nullptr; //< Handle pointer to protect running a deleted event callback function
@@ -16,11 +16,11 @@
namespace AZ
{
ScheduledEventHandle::ScheduledEventHandle(TimeMs executeTimeMs, TimeMs durationTimeMs, ScheduledEvent* scheduledEvent, bool isAutoDelete)
ScheduledEventHandle::ScheduledEventHandle(TimeMs executeTimeMs, TimeMs durationTimeMs, ScheduledEvent* scheduledEvent, bool ownsScheduledEvent)
: m_executeTimeMs(executeTimeMs)
, m_durationMs(durationTimeMs)
, m_event(scheduledEvent)
, m_autoDelete(isAutoDelete)
, m_ownsScheduledEvent(ownsScheduledEvent)
{
;
}
@@ -49,11 +49,6 @@ namespace AZ
else // Not configured to auto-requeue, so remove the handle
{
m_event->ClearHandle();
if (m_autoDelete)
{
delete m_event;
}
m_event = nullptr;
}
}
}
@@ -65,11 +60,6 @@ namespace AZ
return false; // Event has been deleted, so the handle class must be deleted after this function.
}
void ScheduledEventHandle::Clear()
{
m_event = nullptr;
}
TimeMs ScheduledEventHandle::GetExecuteTimeMs() const
{
return m_executeTimeMs;
@@ -79,4 +69,14 @@ namespace AZ
{
return m_durationMs;
}
bool ScheduledEventHandle::GetOwnsScheduledEvent() const
{
return m_ownsScheduledEvent;
}
ScheduledEvent* ScheduledEventHandle::GetScheduledEvent() const
{
return m_event;
}
}
@@ -31,8 +31,8 @@ namespace AZ
//! @param executeTimeMs an absolute time in ms at which point the scheduled event should trigger
//! @param durationTimeMs the interval time in ms used for prioritization as well as re-queueing
//! @param scheduledEvent a scheduled event to run
//! @param autoDelete if the event handle will be automatically deleted after execution completes
ScheduledEventHandle(TimeMs executeTimeMs, TimeMs durationTimeMs, ScheduledEvent* scheduledEvent, bool isAutoDelete);
//! @param ownsScheduledEvent true if the event handle owns its own scheduled event instance
ScheduledEventHandle(TimeMs executeTimeMs, TimeMs durationTimeMs, ScheduledEvent* scheduledEvent, bool ownsScheduledEvent = false);
//! operator of comparing a scheduled event by execute time.
//! @param a_Rhs a scheduled event handle to compare
@@ -42,9 +42,6 @@ namespace AZ
//! @return true for re-queuing a scheduled event or false for deleting this class.
bool Notify();
//! Set nullptr for a scheduled event pointer.
void Clear();
//! Get the execution time in ms for this scheduled event.
//! @return the execution time in ms for this scheduled event
TimeMs GetExecuteTimeMs() const;
@@ -54,12 +51,20 @@ namespace AZ
//! @return the duration time in ms for this scheduled event
TimeMs GetDurationTimeMs() const;
//! Gets whether or not the event handle owns its own scheduled event.
//! @return true if the event handle owns
bool GetOwnsScheduledEvent() const;
//! Gets the scheduled event instance bound to this event handle.
//! @return the scheduled event instance bound to this event handle
ScheduledEvent* GetScheduledEvent() const;
private:
TimeMs m_executeTimeMs = TimeMs{ 0 }; //< execution time of the scheduled event
TimeMs m_durationMs = TimeMs{ 0 }; //< interval time of the scheduled event
ScheduledEvent* m_event = nullptr; //< pointer to the scheduled event
bool m_autoDelete = false; //< if the handle manages the memory of its own event
bool m_ownsScheduledEvent = false; //< if the handle manages the memory of its own event
};
}
+34 -6
View File
@@ -214,6 +214,20 @@ namespace AZ::IO::Internal
// logic
return IsAbsolute(pathView.begin(), pathView.end(), preferredSeparator);
}
// Compares path segments using either Posix or Windows path rules based on the path separator in use
// Posix paths perform a case-sensitive comparison, while Windows paths perform a case-insensitive comparison
static int ComparePathSegment(AZStd::string_view left, AZStd::string_view right, char pathSeparator)
{
const size_t maxCharsToCompare = (AZStd::min)(left.size(), right.size());
int charCompareResult = pathSeparator == PosixPathSeparator
? strncmp(left.data(), right.data(), maxCharsToCompare)
: azstrnicmp(left.data(), right.data(), maxCharsToCompare);
return charCompareResult == 0
? aznumeric_cast<ptrdiff_t>(left.size()) - aznumeric_cast<ptrdiff_t>(right.size())
: charCompareResult;
}
}
//! PathParser implementation
@@ -351,7 +365,6 @@ namespace AZ::IO::parser
constexpr void Decrement() noexcept
{
auto pathStart = m_path_view.begin();
auto pathEnd = m_path_view.end();
auto currentPathEntry = getCurrentTokenStartPos();
if (currentPathEntry == pathStart)
@@ -613,7 +626,7 @@ namespace AZ::IO::parser
{
return pathParser->InRootName() ? **pathParser : "";
};
int res = GetRootName(lhsPathParser).compare(GetRootName(rhsPathParser));
int res = Internal::ComparePathSegment(GetRootName(lhsPathParser), GetRootName(rhsPathParser), lhsPathParser->m_preferred_separator);
ConsumeRootName(lhsPathParser);
ConsumeRootName(rhsPathParser);
return res;
@@ -642,7 +655,8 @@ namespace AZ::IO::parser
while (lhsPathParser && rhsPathParser)
{
if (int res = (*lhsPathParser).compare(*rhsPathParser); res != 0)
if (int res = Internal::ComparePathSegment(*lhsPathParser, *rhsPathParser, lhsPathParser.m_preferred_separator);
res != 0)
{
return res;
}
@@ -1033,11 +1047,25 @@ namespace AZ::IO
parser::PathParser patternParserEnd(pathPatternView.relative_path_view(), parser::ParserState::PS_AtEnd, pathPatternView.m_preferred_separator);
// move the parser from the end to a valid filename by decrementing
for(--pathParserEnd, --patternParserEnd; pathParserEnd && patternParserEnd; --pathParserEnd, --patternParserEnd)
// Windows Paths are case-insensitive, while Posix paths are case-sensitive
if (m_preferred_separator == PosixPathSeparator)
{
if (!AZStd::wildcard_match_case(*patternParserEnd, *pathParserEnd))
for (--pathParserEnd, --patternParserEnd; pathParserEnd && patternParserEnd; --pathParserEnd, --patternParserEnd)
{
return false;
if (!AZStd::wildcard_match_case(*patternParserEnd, *pathParserEnd))
{
return false;
}
}
}
else
{
for (--pathParserEnd, --patternParserEnd; pathParserEnd && patternParserEnd; --pathParserEnd, --patternParserEnd)
{
if (!AZStd::wildcard_match(*patternParserEnd, *pathParserEnd))
{
return false;
}
}
}
@@ -300,7 +300,6 @@ namespace AZ
context.Class<Uuid>("Uuid")->
Attribute(AZ::Script::Attributes::Scope, AZ::Script::Attributes::ScopeFlags::Common)->
Attribute(AZ::Script::Attributes::Module, "math")->
Attribute(AZ::Script::Attributes::ExcludeFrom, AZ::Script::Attributes::ExcludeFlags::Preview)->
Attribute(AZ::Script::Attributes::Storage, AZ::Script::Attributes::StorageType::Value)->
Attribute(AZ::Script::Attributes::ConstructorOverride, &Internal::ScriptUuidConstructor)->
Attribute(AZ::Script::Attributes::GenericConstructorOverride, &Internal::UuidDefaultConstructor)->
@@ -18,11 +18,8 @@ namespace AZ
{
Quaternion CreateRandomQuaternion(SimpleLcgRandom& rng)
{
float u1 = rng.GetRandomFloat();
float u2 = rng.GetRandomFloat();
float u3 = rng.GetRandomFloat();
float c1 = Sqrt(1.0f - u1);
float c2 = Sqrt(u1);
float x, y, z, w;
SinCos(Constants::TwoPi * u2, x, y);
SinCos(Constants::TwoPi * u3, z, w);
@@ -74,7 +74,6 @@ namespace AZ
{
behaviorContext->Class<Obb>()->
Attribute(Script::Attributes::ExcludeFrom, Script::Attributes::ExcludeFlags::All)->
Attribute(Script::Attributes::ExcludeFrom, Script::Attributes::ExcludeFlags::Preview)->
Attribute(Script::Attributes::Storage, Script::Attributes::StorageType::Value)->
Attribute(Script::Attributes::GenericConstructorOverride, &Internal::ObbDefaultConstructor)->
Property("position", &Obb::GetPosition, &Obb::SetPosition)->
+2 -3
View File
@@ -104,9 +104,9 @@ namespace AZ
// As one return value (hit point) is based on the other (hit time), for simplicity, the Lua implementation
// just returns all three values: does the ray hit? When does it hit? Where does it hit?
if (!dc.IsClass<Vector3>(0) || !dc.IsClass<Vector3>(0))
if (!dc.IsClass<Vector3>(0) || !dc.IsClass<Vector3>(1))
{
AZ_Error("Script", false, "ScriptPlane CastRay requires two ScriptVector3s as arguments.");
AZ_Error("Script", false, "ScriptPlane IntersectSegment requires two ScriptVector3s as arguments.");
return;
}
@@ -147,7 +147,6 @@ namespace AZ
{
behaviorContext->Class<Plane>()->
Attribute(AZ::Script::Attributes::ExcludeFrom, AZ::Script::Attributes::ExcludeFlags::All)->
Attribute(AZ::Script::Attributes::ExcludeFrom, AZ::Script::Attributes::ExcludeFlags::Preview)->
Attribute(AZ::Script::Attributes::Storage, AZ::Script::Attributes::StorageType::Value)->
Attribute(AZ::Script::Attributes::GenericConstructorOverride, &Internal::PlaneDefaultConstructor)->
Method("ToString", &Internal::PlaneToString)->
@@ -53,7 +53,6 @@ namespace AZ
if (auto behaviorContext = azrtti_cast<BehaviorContext*>(context))
{
behaviorContext->Class<PolygonPrism>()
->Attribute(AZ::Script::Attributes::ExcludeFrom, AZ::Script::Attributes::ExcludeFlags::Preview)
->Attribute(Script::Attributes::Storage, Script::Attributes::StorageType::RuntimeOwn)
->Property("height", BehaviorValueGetter(&PolygonPrism::m_height), nullptr)
->Property("vertexContainer", BehaviorValueGetter(&PolygonPrism::m_vertexContainer), nullptr)
@@ -111,13 +111,11 @@ namespace AZ
Property("segmentFraction", BehaviorValueProperty(&SplineAddress::m_segmentFraction));
behaviorContext->Class<PositionSplineQueryResult>()->
Attribute(AZ::Script::Attributes::ExcludeFrom, AZ::Script::Attributes::ExcludeFlags::Preview)->
Attribute(Script::Attributes::Storage, Script::Attributes::StorageType::Value)->
Property("splineAddress", [](PositionSplineQueryResult* thisPtr) { return thisPtr->m_splineAddress; }, nullptr)->
Property("distanceSq", [](PositionSplineQueryResult* thisPtr) { return thisPtr->m_distanceSq; }, nullptr);
behaviorContext->Class<RaySplineQueryResult>()->
Attribute(AZ::Script::Attributes::ExcludeFrom, AZ::Script::Attributes::ExcludeFlags::Preview)->
Attribute(Script::Attributes::Storage, Script::Attributes::StorageType::Value)->
Property("splineAddress", [](RaySplineQueryResult* thisPtr) { return thisPtr->m_splineAddress; }, nullptr)->
Property("distanceSq", [](RaySplineQueryResult* thisPtr) { return thisPtr->m_distanceSq; }, nullptr)->
+2 -2
View File
@@ -720,9 +720,9 @@ namespace AZ
StoragePolicyBase<Allocator>::Destroy(Base::GetModuleAllocatorInstance());
}
AZ_FORCE_INLINE static bool IsReady()
static bool IsReady()
{
return true;
return Base::GetModuleAllocatorInstance().IsReady();
}
};
}
@@ -515,7 +515,6 @@ namespace AZ
->Attribute(AZ::Script::Attributes::EnableAsScriptEventParamType, &IsScriptEventType)
->Method("AssignAt", &AssignAt, { { {}, { "Index", "The index at which to assign the element to, resizes the container if necessary", nullptr, BehaviorParameter::Traits::TR_INDEX } } })
->Attribute(AZ::Script::Attributes::Operator, AZ::Script::Attributes::OperatorType::IndexWrite)
->Attribute(AZ::Script::Attributes::ExcludeFrom, AZ::Script::Attributes::ExcludeFlags::Preview)
->Method("Erase_VM", &ErasePost_VM, { { { "Container", "The container from which to delete", nullptr, {} }, { "Key", "The key to delete", nullptr, {} } } })
->Attribute(AZ::Script::Attributes::TreatAsMemberFunction, AZ::AttributeIsValid::IfPresent)
->Attribute(AZ::ScriptCanvasAttributes::ExplicitOverloadCrc, ExplicitOverloadInfo("Erase", "Containers"))
@@ -526,35 +525,29 @@ namespace AZ
->Attribute(AZ::Script::Attributes::ExcludeFrom, AZ::Script::Attributes::ExcludeFlags::All)
->template Method<void(ContainerType::*)(typename ContainerType::const_reference)>("push_back", &ContainerType::push_back)
->Attribute(AZ::Script::Attributes::Deprecated, true)
->Attribute(AZ::Script::Attributes::ExcludeFrom, AZ::Script::Attributes::ExcludeFlags::Preview)
->Method("PushBack_VM", &PushBack_VM, { { { "Container", "The container into which to add an element to", nullptr, {} }, { "Value", "The value to be added", nullptr, {} } } })
->Attribute(AZ::Script::Attributes::TreatAsMemberFunction, AZ::AttributeIsValid::IfPresent)
->Attribute(AZ::ScriptCanvasAttributes::ExplicitOverloadCrc, ExplicitOverloadInfo("Add Element at End", "Containers"))
->Attribute(AZ::ScriptCanvasAttributes::OverloadArgumentGroup, AZ::OverloadArgumentGroupInfo({ "ContainerGroup", "" }, { "ContainerGroup" }))
->Method("pop_back", &ContainerType::pop_back)
->Attribute(AZ::Script::Attributes::ExcludeFrom, AZ::Script::Attributes::ExcludeFlags::Preview)
->Attribute(AZ::Script::Attributes::Deprecated, true)
->template Method<typename ContainerType::reference(ContainerType::*)(typename ContainerType::size_type)>
("at", &ContainerType::at, {{ { "Index", "The index to read from", nullptr, BehaviorParameter::Traits::TR_INDEX } }})->Attribute(AZ::Script::Attributes::Operator, AZ::Script::Attributes::OperatorType::IndexRead)
->Attribute(AZ::Script::Attributes::ExcludeFrom, AZ::Script::Attributes::ExcludeFlags::Preview)
->Attribute(AZ::Script::Attributes::Deprecated, true)
->template Method<typename ContainerType::reference(ContainerType::*)(typename ContainerType::size_type)>(k_accessElementNameUnchecked, &ContainerType::at, { { { "Index", "The index to read from", nullptr } } })
->Attribute(AZ::ScriptCanvasAttributes::ExplicitOverloadCrc, ExplicitOverloadInfo("Get Element", "Containers"))
->Attribute(AZ::ScriptCanvasAttributes::CheckedOperation, CheckedOperationInfo("Has Key", {}, "Out", "Key Not Found"))
->Method("size", [](ContainerType& thisPtr) { return aznumeric_cast<int>(thisPtr.size()); })
->Attribute(AZ::Script::Attributes::Operator, AZ::Script::Attributes::OperatorType::Length)
->Attribute(AZ::Script::Attributes::ExcludeFrom, AZ::Script::Attributes::ExcludeFlags::Preview)
->Method("GetSize", [](ContainerType& thisPtr) { return aznumeric_cast<int>(thisPtr.size()); }, { { { "Container", "The container to get the size of", nullptr, {} } } })
->Attribute(AZ::ScriptCanvasAttributes::ExplicitOverloadCrc, ExplicitOverloadInfo("Get Size", "Containers"))
->Attribute(AZ::Script::Attributes::TreatAsMemberFunction, AZ::AttributeIsValid::IfPresent)
->Attribute(AZ::Script::Attributes::ExcludeFrom, AZ::Script::Attributes::ExcludeFlags::Preview)
->Method("clear", &ContainerType::clear)
->template Method<typename ContainerType::reference(ContainerType::*)(typename ContainerType::size_type)>(k_accessElementName, &ContainerType::at, { { { "Index", "The index to read from", nullptr, BehaviorParameter::Traits::TR_INDEX } } })
->Method("Capacity", &ContainerType::capacity)
->Method("Clear", [](ContainerType& thisContainer)->ContainerType& { thisContainer.clear(); return thisContainer; }, { { { "Container", "The container to clear", nullptr, {} } } })
->Attribute(AZ::Script::Attributes::TreatAsMemberFunction, AZ::AttributeIsValid::IfPresent)
->Attribute(AZ::ScriptCanvasAttributes::ExplicitOverloadCrc, ExplicitOverloadInfo("Clear All Elements", "Containers"))
->Attribute(AZ::Script::Attributes::ExcludeFrom, AZ::Script::Attributes::ExcludeFlags::Preview)
->Attribute(AZ::ScriptCanvasAttributes::OverloadArgumentGroup, AZ::OverloadArgumentGroupInfo({ "ContainerGroup" }, { "ContainerGroup" }))
->Method("Empty", &ContainerType::empty, { { { "Container", "The container to check if it is empty", nullptr, {} } } })
->Attribute(AZ::ScriptCanvasAttributes::ExplicitOverloadCrc, ExplicitOverloadInfo("Is Empty", "Containers"))
@@ -798,10 +791,8 @@ namespace AZ
->Attribute(AZ::Script::Attributes::Storage, AZ::Script::Attributes::StorageType::Value)
->template Constructor<const T1&, const T2&>()
->Property("first", [](ContainerType& thisPtr) { return thisPtr.first; }, [](ContainerType& thisPtr, const T1& value) { thisPtr.first = value; })
->Attribute(AZ::Script::Attributes::ExcludeFrom, AZ::Script::Attributes::ExcludeFlags::Preview)
->Attribute(AZ::ScriptCanvasAttributes::TupleGetFunctionIndex, 0)
->Property("second", [](ContainerType& thisPtr) { return thisPtr.second; }, [](ContainerType& thisPtr, const T2& value) { thisPtr.second = value; })
->Attribute(AZ::Script::Attributes::ExcludeFrom, AZ::Script::Attributes::ExcludeFlags::Preview)
->Attribute(AZ::ScriptCanvasAttributes::TupleGetFunctionIndex, 1)
->Method("ConstructTuple", [](const T1& first, const T2& second) { return AZStd::make_pair(first, second); })
;
@@ -1013,7 +1004,6 @@ namespace AZ
->Method("Clear", [](ContainerType& thisContainer)->ContainerType& { thisContainer.clear(); return thisContainer; })
->Attribute(AZ::Script::Attributes::TreatAsMemberFunction, AZ::AttributeIsValid::IfPresent)
->Attribute(AZ::ScriptCanvasAttributes::ExplicitOverloadCrc, ExplicitOverloadInfo("Clear All Elements", "Containers"))
->Attribute(AZ::Script::Attributes::ExcludeFrom, AZ::Script::Attributes::ExcludeFlags::Preview)
->Attribute(AZ::ScriptCanvasAttributes::OverloadArgumentGroup, AZ::OverloadArgumentGroupInfo({ "ContainerGroup" }, { "ContainerGroup" }))
->Method(k_iteratorConstructorName, &Iterate_VM)
;
@@ -43,6 +43,9 @@ namespace AZ
{
const static AZ::Crc32 RuntimeEBusAttribute = AZ_CRC("RuntimeEBus", 0x466b899b); ///< Signals that this reflected ebus should only be available at runtime, helps tools filter out data driven ebuses
constexpr const char* k_PropertyNameGetterSuffix = "::Getter";
constexpr const char* k_PropertyNameSetterSuffix = "::Setter";
/// Typedef for class unwrapping callback (i.e. used for things like smart_ptr<T> to unwrap for T)
using BehaviorClassUnwrapperFunction = void(*)(void* /*classPtr*/, void*& /*unwrappedClass*/, AZ::Uuid& /*unwrappedClassTypeId*/, void* /*userData*/);
@@ -2525,7 +2528,7 @@ namespace AZ
getterPropertyName += "::";
}
getterPropertyName += m_name;
getterPropertyName += "::Getter";
getterPropertyName += k_PropertyNameGetterSuffix;
m_getter = aznew GetterType(getter, context, getterPropertyName);
if (AZStd::is_class<typename GetterType::ClassType>::value)
@@ -2603,7 +2606,7 @@ namespace AZ
setterPropertyName += "::";
}
setterPropertyName += m_name;
setterPropertyName += "::Setter";
setterPropertyName += k_PropertyNameSetterSuffix;
m_setter = aznew SetterType(setter, context, setterPropertyName);
if (AZStd::is_class<typename SetterType::ClassType>::value)
{
@@ -243,6 +243,28 @@ namespace AZ
return variance;
}
void RemovePropertyGetterNameArtifacts(AZStd::string& name)
{
if (name.ends_with(k_PropertyNameGetterSuffix))
{
AZ::StringFunc::Replace(name, k_PropertyNameGetterSuffix, "");
}
}
void RemovePropertySetterNameArtifacts(AZStd::string& name)
{
if (name.ends_with(k_PropertyNameSetterSuffix))
{
AZ::StringFunc::Replace(name, k_PropertyNameSetterSuffix, "");
}
}
void RemovePropertyNameArtifacts(AZStd::string& name)
{
RemovePropertyGetterNameArtifacts(name);
RemovePropertySetterNameArtifacts(name);
}
AZStd::string ReplaceCppArtifacts(AZStd::string_view sourceName)
{
using namespace AZ::StringFunc;
@@ -68,6 +68,12 @@ namespace AZ
AZStd::vector<AZStd::pair<const BehaviorMethod*, const BehaviorClass*>> OverloadsToVector(const BehaviorMethod&, const BehaviorClass*);
void RemovePropertyGetterNameArtifacts(AZStd::string& name);
void RemovePropertySetterNameArtifacts(AZStd::string& name);
void RemovePropertyNameArtifacts(AZStd::string& name);
AZStd::string ReplaceCppArtifacts(AZStd::string_view sourceName);
void StripQualifiers(AZStd::string& name);
@@ -51,11 +51,11 @@ namespace AZ
const static AZ::Crc32 ExcludeFrom = AZ_CRC("ExcludeFrom", 0xa98972fe);
enum ExcludeFlags : AZ::u64
{
List = 1 << 0,
Documentation = 1 << 1,
Preview = 1 << 2,
ListOnly = 1 << 3,
All = (List | Documentation | Preview)
List = 1 << 0, //< The reflected item will be excluded from any list (e.g. node palette)
Documentation = 1 << 1, //< The reflected item will be excluded from the Lua class reference
Unused = 1 << 2, //< This flag is unused (deprecated)
ListOnly = 1 << 3, //< Some elements should be excluded from lists, but available for documentation
All = (List | Documentation) //< Used to exclude reflections from lists and documentation
};
//! Used to specify the usage of a Behavior Context element (e.g. Class or EBus) designed for automation scripts
@@ -929,7 +929,6 @@ void ScriptSystemComponent::Reflect(ReflectContext* reflection)
Debug::TraceReflect(behaviorContext);
behaviorContext->Class<PlatformID>("Platform")
->Attribute(AZ::Script::Attributes::ExcludeFrom, AZ::Script::Attributes::ExcludeFlags::Preview)
->Enum<static_cast<int>(PlatformID::PLATFORM_WINDOWS_64)>("Windows64")
->Enum<static_cast<int>(PlatformID::PLATFORM_LINUX_64)>("Linux")
->Enum<static_cast<int>(PlatformID::PLATFORM_ANDROID_64)>("Android64")
@@ -1452,6 +1452,13 @@ namespace AZ
void* parentPtr = nodeStack.back().m_ptr;
DataElementNode* parentDataElement = nodeStack.back().m_dataElement;
AZ_Assert(parentDataElement, "parentDataElement is null, cannot enumerate data from data element (%s:%s)",
m_element.m_name ? m_element.m_name : "", m_element.m_id.ToString<AZStd::string>().data());
if (!parentDataElement)
{
return false;
}
bool success = true;
if (!m_classData)
@@ -1472,7 +1479,6 @@ namespace AZ
if (classElementFound)
{
void* dataAddress = nullptr;
void* reserveAddress = nullptr;
IDataContainer* dataContainer = parentDataElement->m_classData->m_container;
if (dataContainer) // container elements
{
@@ -1500,7 +1506,7 @@ namespace AZ
dataAddress = reinterpret_cast<char*>(parentPtr) + classElement.m_offset;
}
reserveAddress = dataAddress;
void* reserveAddress = dataAddress;
// create a new instance if needed
if (classElement.m_flags & SerializeContext::ClassElement::FLG_POINTER)
@@ -1471,8 +1471,7 @@ namespace AZ
{
return [serializeContext](AZStd::any::Action action, AZStd::any* dest, const AZStd::any* source)
{
auto classData = serializeContext->FindClassData(dest->type());
AZ_Assert(classData, "Type %s stored in any must be registered with the serialize context", AZ::AzTypeInfo<ValueType>::Name());
AZ_Assert(serializeContext->FindClassData(dest->type()), "Type %s stored in any must be registered with the serialize context", AZ::AzTypeInfo<ValueType>::Name());
switch (action)
{
@@ -502,10 +502,9 @@ namespace AZ
altClassElement.m_offset = 0;
VariantSerializationInternal::SetupClassElementFromType<AltType>(altClassElement);
const AZ::Uuid& altTypeId = altClassElement.m_typeId;
const char* altName = AzTypeInfo<AltType>::Name();
const SerializeContext::ClassData* altClassData = context.FindClassData(altTypeId);
AZ_Error("Serialize", altClassData, "Unable to find ClassData for variant alternative with name %s and typeid of %s", altName, altTypeId.ToString<AZStd::string>().data());
AZ_Error("Serialize", altClassData, "Unable to find ClassData for variant alternative with name %s and typeid of %s", AzTypeInfo<AltType>::Name(), altTypeId.ToString<AZStd::string>().data());
return altClassData ? callContext.m_context->EnumerateInstanceConst(&callContext, &elementAlt, altTypeId, altClassData, &altClassElement) : false;
};
@@ -30,18 +30,6 @@
namespace AZ::Internal
{
AZ::IO::FixedMaxPath GetExecutableDirectory()
{
AZStd::fixed_string<AZ::IO::MaxPathLength> value;
// Binary folder
AZ::Utils::ExecutablePathResult pathResult = Utils::GetExecutableDirectory(value.data(), value.capacity());
// Update the size value of the executable directory fixed string to correctly be the length of the null-terminated string stored within it
value.resize_no_construct(AZStd::char_traits<char>::length(value.data()));
return value;
}
AZ::SettingsRegistryInterface::FixedValueString GetEngineMonikerForProject(
SettingsRegistryInterface& settingsRegistry, const AZ::IO::FixedMaxPath& projectPath)
{
@@ -146,7 +134,7 @@ namespace AZ::Internal
{
AZStd::fixed_string<AZ::IO::MaxPathLength> executableDir;
if (Utils::GetExecutableDirectory(executableDir.data(), executableDir.capacity()) == Utils::ExecutablePathResult::Success)
if (AZ::Utils::GetExecutableDirectory(executableDir.data(), executableDir.capacity()) == Utils::ExecutablePathResult::Success)
{
// Update the size value of the executable directory fixed string to correctly be the length of the null-terminated string
// stored within it
@@ -494,7 +482,7 @@ namespace AZ::SettingsRegistryMergeUtils
void MergeSettingsToRegistry_AddRuntimeFilePaths(SettingsRegistryInterface& registry)
{
// Binary folder
AZ::IO::FixedMaxPath path = Internal::GetExecutableDirectory();
AZ::IO::FixedMaxPath path = AZ::Utils::GetExecutableDirectory();
registry.Set(FilePathKey_BinaryFolder, path.LexicallyNormal().Native());
// Engine root folder - corresponds to the @engroot@ and @devroot@ aliases
@@ -601,7 +589,7 @@ namespace AZ::SettingsRegistryMergeUtils
void MergeSettingsToRegistry_TargetBuildDependencyRegistry(SettingsRegistryInterface& registry, const AZStd::string_view platform,
const SettingsRegistryInterface::Specializations& specializations, AZStd::vector<char>* scratchBuffer)
{
AZ::IO::FixedMaxPath mergePath = Internal::GetExecutableDirectory();
AZ::IO::FixedMaxPath mergePath = AZ::Utils::GetExecutableDirectory();
if (!mergePath.empty())
{
registry.MergeSettingsFolder((mergePath / SettingsRegistryInterface::RegistryFolder).Native(),
@@ -17,10 +17,12 @@ namespace UnitTest
MockComponentApplication::MockComponentApplication()
{
AZ::ComponentApplicationBus::Handler::BusConnect();
AZ::Interface<AZ::ComponentApplicationRequests>::Register(this);
}
MockComponentApplication::~MockComponentApplication()
{
AZ::Interface<AZ::ComponentApplicationRequests>::Unregister(this);
AZ::ComponentApplicationBus::Handler::BusDisconnect();
}
} // namespace UnitTest
@@ -13,6 +13,7 @@
#pragma once
#include <AzCore/Component/ComponentApplicationBus.h>
#include <AzCore/Interface/Interface.h>
#include <gmock/gmock.h>
namespace UnitTest
@@ -30,6 +31,8 @@ namespace UnitTest
MOCK_METHOD0(Destroy, void ());
MOCK_METHOD1(RegisterComponentDescriptor, void (const AZ::ComponentDescriptor*));
MOCK_METHOD1(UnregisterComponentDescriptor, void (const AZ::ComponentDescriptor*));
MOCK_METHOD1(RegisterEntityAddedEventHandler, void(AZ::EntityAddedEvent::Handler&));
MOCK_METHOD1(RegisterEntityRemovedEventHandler, void(AZ::EntityRemovedEvent::Handler&));
MOCK_METHOD1(RemoveEntity, bool (AZ::Entity*));
MOCK_METHOD1(DeleteEntity, bool (const AZ::EntityId&));
MOCK_METHOD1(GetEntityName, AZStd::string (const AZ::EntityId&));
@@ -636,7 +636,6 @@ namespace AZStd
{
AZSTD_CONTAINER_ASSERT(!full(), "Cannot emplace on a full fixed_vector");
AZSTD_CONTAINER_ASSERT(insertPos >= cbegin() && insertPos <= cend(), "insert position must be in range of container");
pointer dataStart = data();
pointer dataEnd = data() + size();
pointer insertPosPtr = data() + AZStd::distance(cbegin(), insertPos);
@@ -896,7 +895,7 @@ namespace AZStd
if (numInitializedToFill < numElements)
{
// Copy the elements after insert position.
iterator newLast = AZStd::uninitialized_move(insertPosPtr, dataEnd, insertPosPtr + numElements);
AZStd::uninitialized_move(insertPosPtr, dataEnd, insertPosPtr + numElements);
// get last iterator to use move assignment operator
Iterator lastToAssign = AZStd::next(first, numInitializedToFill);
@@ -28,8 +28,7 @@ namespace AZ::Platform
}
else
{
DWORD error = ::GetLastError();
AZ_Assert(event, "Failed to create a required event for IO Scheduler (Error: %u).", error);
AZ_Assert(event, "Failed to create a required event for IO Scheduler (Error: %u).", ::GetLastError());
}
}
}
@@ -43,8 +42,7 @@ namespace AZ::Platform
{
if (!::CloseHandle(event))
{
DWORD error = ::GetLastError();
AZ_Assert(false, "Failed to close an event handle for IO Scheduler (Error: %u)", error);
AZ_Assert(false, "Failed to close an event handle for IO Scheduler (Error: %u)", ::GetLastError());
}
}
}
@@ -99,7 +99,7 @@ namespace AZStd
// detect a sitaution where the mutex or the cond var are invalid, or the duration
AZ_Assert(lastError == AZ_ERROR_TIMEOUT, "Error from SleepConditionVariableCS: 0x%08x\n", lastError);
// asserts are continuable so we still check.
if (GetLastError() == AZ_ERROR_TIMEOUT)
if (lastError == AZ_ERROR_TIMEOUT)
{
return cv_status::timeout;
}
@@ -70,5 +70,4 @@ set(FILES
AzCore/Utils/Utils_iOS.mm
../Common/Apple/AzCore/Utils/Utils_Apple.cpp
../Common/UnixLike/AzCore/Utils/Utils_UnixLike.cpp
../Common/Unimplemented/AzCore/Utils/Utils_Unimplemented.cpp
)
@@ -1769,7 +1769,6 @@ namespace UnitTest
{
return "HelloWorld";
};
constexpr const TypeParam* compileTimeString1 = MakeCompileTimeString1();
constexpr basic_string_view<TypeParam> modifierView("HelloWorld");
// A constexpr lambda is used to evaluate non constexpr string_view instances' member functions which
// have been marked as constexpr at compile time
@@ -2334,7 +2333,6 @@ namespace UnitTest
const char* filter1{ "*" };
const char* filter2{ "*?" };
const char* filter3{ "?*" };
const char* testValue{ "" };
EXPECT_TRUE(wildcard_match(filter1, "Hello"));
EXPECT_TRUE(wildcard_match(filter1, "?"));
EXPECT_TRUE(wildcard_match(filter1, "*"));
+3 -12
View File
@@ -53,35 +53,27 @@ namespace UnitTest
{
// Trvially validate that we can create and destroy an asset manager instance, and that it's only ready while it's created.
// Before creation, IsReady() should be false and trying to get an Instance() should cause an assert.
// Before creation, IsReady() should be false.
EXPECT_FALSE(AssetManager::IsReady());
AZ_TEST_START_TRACE_SUPPRESSION;
auto& badInstance = AssetManager::Instance();
AZ_TEST_STOP_TRACE_SUPPRESSION(1);
AssetManager::Descriptor desc;
AssetManager::Create(desc);
// After creation, the system should be ready and queryable via Instance().
EXPECT_TRUE(AssetManager::IsReady());
auto& goodInstance = AssetManager::Instance();
AssetManager::Instance();
AssetManager::Destroy();
// After destruction, these should fail again
EXPECT_FALSE(AssetManager::IsReady());
AZ_TEST_START_TRACE_SUPPRESSION;
auto& badInstance2 = AssetManager::Instance();
AZ_TEST_STOP_TRACE_SUPPRESSION(1);
}
#endif // !AZ_TRAIT_DISABLE_FAILED_ASSET_MANAGER_CREATE_DESTROY_TEST
TEST_F(AssetManagerSystemTest, AssetManager_SetInstance_TriviallyWorks)
{
// There shouldn't be an instance yet.
AZ_TEST_START_TRACE_SUPPRESSION;
auto& badInstance = AssetManager::Instance();
AZ_TEST_STOP_TRACE_SUPPRESSION(1);
EXPECT_FALSE(AssetManager::IsReady());
// Create an instance and set it.
AssetManager::Descriptor desc;
@@ -669,7 +661,6 @@ namespace UnitTest
EmptyAssetWithInstanceCount* origData = assetWithData.Get();
AssetId origId = assetWithData.GetId();
AssetType origType = assetWithData.GetType();
AssetLoadBehavior origBehavior = assetWithData.GetAutoLoadBehavior();
Asset<EmptyAssetWithInstanceCount> assetWithData2(AZStd::move(assetWithData));
@@ -9,10 +9,12 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#pragma once
#include <AzCore/UnitTest/TestTypes.h>
#pragma once
#include <AzCore/UnitTest/TestTypes.h>
#include <AzCore/RTTI/BehaviorContext.h>
#include <AzCore/Interface/Interface.h>
namespace UnitTest
{
@@ -29,10 +31,12 @@ namespace UnitTest
m_behaviorContext = aznew AZ::BehaviorContext();
AZ::ComponentApplicationBus::Handler::BusConnect();
AZ::Interface<AZ::ComponentApplicationRequests>::Register(this);
}
void TearDown() override
{
AZ::Interface<AZ::ComponentApplicationRequests>::Unregister(this);
AZ::ComponentApplicationBus::Handler::BusDisconnect();
// Just destroy everything before we complete the tear down.
@@ -45,7 +49,8 @@ namespace UnitTest
// ComponentApplicationBus
AZ::ComponentApplication* GetApplication() override { return nullptr; }
void RegisterComponentDescriptor(const AZ::ComponentDescriptor*) override {}
void RegisterEntityAddedEventHandler(AZ::EntityAddedEvent::Handler&) override {}
void RegisterEntityRemovedEventHandler(AZ::EntityRemovedEvent::Handler&) override {}
void UnregisterComponentDescriptor(const AZ::ComponentDescriptor*) override {}
bool AddEntity(AZ::Entity*) override { return true; }
bool RemoveEntity(AZ::Entity*) override { return true; }
@@ -185,7 +185,7 @@ namespace AZ::Debug
realLogger.Start(logFilePath.c_str());
LargeBlock& block = logger->RecordEventBegin<LargeBlock>(largeBlockId);
logger->RecordEventBegin<LargeBlock>(largeBlockId);
logger->RecordEventEnd();
logger->RecordStringEvent(MessageId, message);
@@ -97,8 +97,6 @@ namespace UnitTest
SAFE_EXPECT_EQ(AZ::ClampedIntegralLimits<ValueType, ClampType>::Max(), (std::numeric_limits<ValueType>::max)());
// Expect the natural numerical limits of ValueType to be equal to the natural numerical limits of ClampType
ValueType vMin = AZ::ClampedIntegralLimits<ValueType, ClampType>::Min();
ClampType cMin = std::numeric_limits<ClampType>::lowest();
SAFE_EXPECT_EQ(AZ::ClampedIntegralLimits<ValueType, ClampType>::Min(), std::numeric_limits<ClampType>::lowest());
SAFE_EXPECT_EQ(AZ::ClampedIntegralLimits<ValueType, ClampType>::Max(), (std::numeric_limits<ClampType>::max)());
@@ -149,7 +149,6 @@ namespace UnitTest
::testing::Values(
AZStd::tuple<AZStd::string_view, AZStd::string_view>("test/foo", "test/foo"),
AZStd::tuple<AZStd::string_view, AZStd::string_view>("test/foo", "test\\foo"),
AZStd::tuple<AZStd::string_view, AZStd::string_view>("test/foo", "test\\foo"),
AZStd::tuple<AZStd::string_view, AZStd::string_view>("test////foo", "test///foo"),
AZStd::tuple<AZStd::string_view, AZStd::string_view>("test/bar/baz//foo", "test/bar/baz\\\\\\foo")
));
@@ -159,17 +158,35 @@ namespace UnitTest
constexpr AZ::IO::FixedMaxPath path1{ "foo/bar" };
constexpr AZ::IO::FixedMaxPath path2{ "foo/bap" };
constexpr AZ::IO::PathView pathView{ "foo/bar" };
static_assert(path1 == pathView);
static_assert(path1 != path2);
static_assert(path2 < path1);
static_assert(pathView <= path1);
static_assert(path1 > path2);
static_assert(pathView >= path2);
EXPECT_EQ(path1, pathView);
EXPECT_NE(path1, path2);
EXPECT_LT(path2, path1);
EXPECT_LE(pathView, path1);
EXPECT_GT(path1, path2);
EXPECT_GE(pathView, path2);
static_assert(pathView <= pathView);
static_assert(pathView >= pathView);
EXPECT_LE(pathView, pathView);
EXPECT_GE(pathView, pathView);
}
using WindowsPathCompareParamFixture = PathParamFixture;
TEST_P(WindowsPathCompareParamFixture, OperatorEqual_ComparesPathCaseInsensitively)
{
AZ::IO::Path path1{ AZStd::get<0>(GetParam()), AZ::IO::WindowsPathSeparator };
AZ::IO::Path path2{ AZStd::get<1>(GetParam()), AZ::IO::WindowsPathSeparator };
EXPECT_EQ(path1, path2);
}
INSTANTIATE_TEST_CASE_P(
CompareWindowsPaths,
WindowsPathCompareParamFixture,
::testing::Values(
AZStd::tuple<AZStd::string_view, AZStd::string_view>("C:/test/foo", R"(c:\test/foo)"),
AZStd::tuple<AZStd::string_view, AZStd::string_view>(R"(D:\test/bar/baz//foo)", "d:/test/bar/baz\\\\\\foo"),
AZStd::tuple<AZStd::string_view, AZStd::string_view>(R"(foO/Bar)", "foo/bar")
));
class PathSingleParamFixture
: public ScopedAllocatorSetupFixture
, public ::testing::WithParamInterface<AZStd::tuple<AZStd::string_view>>
@@ -66,7 +66,7 @@ namespace Benchmark
{
for (auto _ : state)
{
for (auto& testData : m_testDataArray)
for ([[maybe_unused]] auto& testData : m_testDataArray)
{
AZ::Matrix3x3 result = AZ::Matrix3x3::CreateIdentity();
benchmark::DoNotOptimize(result);
@@ -78,7 +78,7 @@ namespace Benchmark
{
for (auto _ : state)
{
for (auto& testData : m_testDataArray)
for ([[maybe_unused]] auto& testData : m_testDataArray)
{
AZ::Matrix3x3 result = AZ::Matrix3x3::CreateZero();
benchmark::DoNotOptimize(result);
@@ -134,7 +134,7 @@ namespace Benchmark
{
for (auto _ : state)
{
for (auto& testData : m_testDataArray)
for ([[maybe_unused]] auto& testData : m_testDataArray)
{
AZ::Matrix3x3 result = AZ::Matrix3x3::CreateFromRowMajorFloat9(s_mat3x3testArray);
benchmark::DoNotOptimize(result);
@@ -146,7 +146,7 @@ namespace Benchmark
{
for (auto _ : state)
{
for (auto& testData : m_testDataArray)
for ([[maybe_unused]] auto& testData : m_testDataArray)
{
AZ::Matrix3x3 result = AZ::Matrix3x3::CreateFromColumnMajorFloat9(s_mat3x3testArray);
benchmark::DoNotOptimize(result);
@@ -84,7 +84,7 @@ namespace Benchmark
{
for (auto _ : state)
{
for (auto& testData : m_testDataArray)
for ([[maybe_unused]] auto& testData : m_testDataArray)
{
AZ::Matrix3x4 result = AZ::Matrix3x4::CreateIdentity();
benchmark::DoNotOptimize(result);
@@ -96,7 +96,7 @@ namespace Benchmark
{
for (auto _ : state)
{
for (auto& testData : m_testDataArray)
for ([[maybe_unused]] auto& testData : m_testDataArray)
{
AZ::Matrix3x4 result = AZ::Matrix3x4::CreateZero();
benchmark::DoNotOptimize(result);
@@ -62,7 +62,7 @@ namespace Benchmark
{
for (auto _ : state)
{
for (auto& testData : m_testDataArray)
for ([[maybe_unused]] auto& testData : m_testDataArray)
{
AZ::Matrix4x4 result = AZ::Matrix4x4::CreateIdentity();
benchmark::DoNotOptimize(result);
@@ -74,7 +74,7 @@ namespace Benchmark
{
for (auto _ : state)
{
for (auto& testData : m_testDataArray)
for ([[maybe_unused]] auto& testData : m_testDataArray)
{
AZ::Matrix4x4 result = AZ::Matrix4x4::CreateZero();
benchmark::DoNotOptimize(result);
@@ -122,7 +122,7 @@ namespace Benchmark
{
for (auto _ : state)
{
for (auto& testData : m_testDataArray)
for ([[maybe_unused]] auto& testData : m_testDataArray)
{
AZ::Matrix4x4 result = AZ::Matrix4x4::CreateFromValue(1.0f);
benchmark::DoNotOptimize(result);
@@ -134,7 +134,7 @@ namespace Benchmark
{
for (auto _ : state)
{
for (auto& testData : m_testDataArray)
for ([[maybe_unused]] auto& testData : m_testDataArray)
{
AZ::Matrix4x4 result = AZ::Matrix4x4::CreateFromRowMajorFloat16(s_mat4x4testArray);
benchmark::DoNotOptimize(result);
@@ -146,7 +146,7 @@ namespace Benchmark
{
for (auto _ : state)
{
for (auto& testData : m_testDataArray)
for ([[maybe_unused]] auto& testData : m_testDataArray)
{
AZ::Matrix4x4 result = AZ::Matrix4x4::CreateFromColumnMajorFloat16(s_mat4x4testArray);
benchmark::DoNotOptimize(result);
@@ -158,7 +158,7 @@ namespace Benchmark
{
for (auto _ : state)
{
for (auto& testData : m_testDataArray)
for ([[maybe_unused]] auto& testData : m_testDataArray)
{
AZ::Matrix4x4 result = AZ::Matrix4x4::CreateProjection(s_mat4x4testArray[0], s_mat4x4testArray[1], s_mat4x4testArray[2], s_mat4x4testArray[3]);
benchmark::DoNotOptimize(result);
@@ -170,7 +170,7 @@ namespace Benchmark
{
for (auto _ : state)
{
for (auto& testData : m_testDataArray)
for ([[maybe_unused]] auto& testData : m_testDataArray)
{
AZ::Matrix4x4 result = AZ::Matrix4x4::CreateProjectionFov(s_mat4x4testArray[0], s_mat4x4testArray[1], s_mat4x4testArray[2], s_mat4x4testArray[3]);
benchmark::DoNotOptimize(result);
@@ -550,7 +550,7 @@ namespace Benchmark
for (auto _ : state)
{
for (auto& testData : m_testDataArray)
for ([[maybe_unused]] auto& testData : m_testDataArray)
{
AZ::Matrix4x4 result = mat.GetInverseTransform();
benchmark::DoNotOptimize(result);
@@ -90,7 +90,7 @@ namespace Benchmark
{
for (auto _ : state)
{
for (auto& quatData : m_quatDataArray)
for ([[maybe_unused]] auto& quatData : m_quatDataArray)
{
AZ::Quaternion result = AZ::Quaternion::CreateIdentity();
benchmark::DoNotOptimize(result);
@@ -102,7 +102,7 @@ namespace Benchmark
{
for (auto _ : state)
{
for (auto& quatData : m_quatDataArray)
for ([[maybe_unused]] auto& quatData : m_quatDataArray)
{
AZ::Quaternion result = AZ::Quaternion::CreateZero();
benchmark::DoNotOptimize(result);
@@ -153,7 +153,7 @@ namespace Benchmark
for (auto _ : state)
{
for (auto& quatData : m_quatDataArray)
for ([[maybe_unused]] auto& quatData : m_quatDataArray)
{
AZ::Quaternion result = AZ::Quaternion::CreateShortestArc(vec1, vec2); //result should transform vec1 into vec2
benchmark::DoNotOptimize(result);
@@ -168,7 +168,7 @@ namespace Benchmark
for (auto _ : state)
{
for (auto& quatData : m_quatDataArray)
for ([[maybe_unused]] auto& quatData : m_quatDataArray)
{
AZ::Quaternion result = AZ::Quaternion::CreateShortestArc(vec1, vec2); //result should transform vec1 into vec2
benchmark::DoNotOptimize(result);
@@ -308,7 +308,7 @@ namespace Benchmark
for (auto _ : state)
{
for (auto& quatData : m_quatDataArray)
for ([[maybe_unused]] auto& quatData : m_quatDataArray)
{
AZ::Quaternion quat;
quat.Set(vec, 8.0f);
@@ -322,7 +322,7 @@ namespace Benchmark
const float quatArray[4] = { 5.0f, 6.0f, 7.0f, 8.0f };
for (auto _ : state)
{
for (auto& quatData : m_quatDataArray)
for ([[maybe_unused]] auto& quatData : m_quatDataArray)
{
AZ::Quaternion quat;
quat.Set(quatArray);
@@ -76,7 +76,7 @@ namespace Benchmark
{
for (auto _ : state)
{
for (auto& testData : m_testDataArray)
for ([[maybe_unused]] auto& testData : m_testDataArray)
{
AZ::Transform result = AZ::Transform::CreateIdentity();
benchmark::DoNotOptimize(result);
@@ -755,7 +755,6 @@ namespace AZ::IO
path.InitFromAbsolutePath(m_dummyFilepath + "/Broken/Path.txt");
request->CreateRead(nullptr, buffer, readSize, path, 0, readSize);
bool resultSet = false;
EXPECT_CALL(*mock, QueueRequest(request)).
WillOnce([this](AZ::IO::FileRequest* request)
{
@@ -1230,6 +1230,8 @@ namespace UnitTest
ComponentApplication* GetApplication() override { return nullptr; }
void RegisterComponentDescriptor(const ComponentDescriptor*) override { }
void UnregisterComponentDescriptor(const ComponentDescriptor*) override { }
void RegisterEntityAddedEventHandler(EntityAddedEvent::Handler&) override { }
void RegisterEntityRemovedEventHandler(EntityRemovedEvent::Handler&) override { }
bool AddEntity(Entity*) override { return false; }
bool RemoveEntity(Entity*) override { return false; }
bool DeleteEntity(const EntityId&) override { return false; }
@@ -62,7 +62,6 @@ namespace SettingsRegistryScriptUtilsTests
TEST_F(SettingsRegistryBehaviorContextFixture, GlobalSettingsRegistry_CanBeQueried_Succeeds)
{
constexpr const char* IsValidMethodName = "IsValid";
constexpr const char* GlobalSettingsRegistryPropertyName = "g_SettingsRegistry";
auto propIt = m_behaviorContext->m_properties.find(GlobalSettingsRegistryPropertyName);
ASSERT_NE(m_behaviorContext->m_properties.end(), propIt);