Merge branch 'master' into scale-icon-change
This commit is contained in:
@@ -69,9 +69,24 @@ protected:
|
||||
|
||||
return Result::Ok;
|
||||
}
|
||||
void OnFail() override
|
||||
{
|
||||
if (Asset)
|
||||
{
|
||||
Asset->_loadingTask = nullptr;
|
||||
Asset = nullptr;
|
||||
}
|
||||
|
||||
// Base
|
||||
ContentLoadTask::OnFail();
|
||||
}
|
||||
void OnEnd() override
|
||||
{
|
||||
Asset = nullptr;
|
||||
if (Asset)
|
||||
{
|
||||
Asset->_loadingTask = nullptr;
|
||||
Asset = nullptr;
|
||||
}
|
||||
|
||||
// Base
|
||||
ContentLoadTask::OnEnd();
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
struct AssetInfo;
|
||||
class Content;
|
||||
class Asset;
|
||||
class LoadAssetTask;
|
||||
class ContentLoadTask;
|
||||
class LoadAssetTask;
|
||||
template<typename T>
|
||||
class AssetReference;
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include "Engine/Core/Log.h"
|
||||
#include "Engine/Core/Collections/Array.h"
|
||||
#include "Engine/Core/Collections/Sorting.h"
|
||||
#include <ThirdParty/tracy/Tracy.h>
|
||||
#include <ThirdParty/tracy/tracy/Tracy.hpp>
|
||||
|
||||
static bool CompareEngineServices(EngineService* const& a, EngineService* const& b)
|
||||
{
|
||||
|
||||
@@ -395,7 +395,7 @@ uint64 RenderTools::CalculateTextureMemoryUsage(PixelFormat format, int32 width,
|
||||
float RenderTools::ComputeBoundsScreenRadiusSquared(const Float3& origin, float radius, const Float3& viewOrigin, const Matrix& projectionMatrix)
|
||||
{
|
||||
const float screenMultiple = 0.5f * Math::Max(projectionMatrix.Values[0][0], projectionMatrix.Values[1][1]);
|
||||
const float distSqr = Float3::DistanceSquared(origin, viewOrigin);
|
||||
const float distSqr = Float3::DistanceSquared(origin, viewOrigin) * projectionMatrix.Values[2][3];
|
||||
return Math::Square(screenMultiple * radius) / Math::Max(1.0f, distSqr);
|
||||
}
|
||||
|
||||
|
||||
@@ -73,9 +73,7 @@ void RenderView::PrepareCache(const RenderContext& renderContext, float width, f
|
||||
|
||||
WorldPosition = Origin + Position;
|
||||
|
||||
// Ortho views have issues with screen size LOD culling
|
||||
const float modelLODDistanceFactor = (renderContext.LodProxyView ? renderContext.LodProxyView->IsOrthographicProjection() : IsOrthographicProjection()) ? 100.0f : ModelLODDistanceFactor;
|
||||
ModelLODDistanceFactorSqrt = modelLODDistanceFactor * modelLODDistanceFactor;
|
||||
ModelLODDistanceFactorSqrt = ModelLODDistanceFactor * ModelLODDistanceFactor;
|
||||
|
||||
// Setup main view render info
|
||||
if (!mainView)
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#include "Engine/Scripting/ManagedCLR/MCore.h"
|
||||
#if TRACY_ENABLE
|
||||
#include "Engine/Core/Math/Math.h"
|
||||
#include <ThirdParty/tracy/Tracy.h>
|
||||
#include <ThirdParty/tracy/tracy/Tracy.hpp>
|
||||
#endif
|
||||
|
||||
Delegate<Thread*> ThreadBase::ThreadStarting;
|
||||
|
||||
@@ -2047,12 +2047,12 @@ bool LinuxPlatform::Init()
|
||||
// Get user locale string
|
||||
setlocale(LC_ALL, "");
|
||||
const char* locale = setlocale(LC_CTYPE, NULL);
|
||||
if (strcmp(locale, "C") == 0)
|
||||
locale = "";
|
||||
UserLocale = String(locale);
|
||||
if (UserLocale.FindLast('.') != -1)
|
||||
UserLocale = UserLocale.Left(UserLocale.Find('.'));
|
||||
UserLocale.Replace('_', '-');
|
||||
if (UserLocale == TEXT("C"))
|
||||
UserLocale = TEXT("en");
|
||||
|
||||
// Get computer name string
|
||||
gethostname(buffer, UNIX_APP_BUFF_SIZE);
|
||||
|
||||
@@ -24,7 +24,7 @@ ProfilerCPU::EventBuffer::~EventBuffer()
|
||||
DeleteArray(_data, _capacity);
|
||||
}
|
||||
|
||||
void ProfilerCPU::EventBuffer::Extract(Array<Event>& data, bool withRemove)
|
||||
void ProfilerCPU::EventBuffer::Extract(Array<Event>& data, bool withRemoval)
|
||||
{
|
||||
data.Clear();
|
||||
|
||||
@@ -36,6 +36,13 @@ void ProfilerCPU::EventBuffer::Extract(Array<Event>& data, bool withRemove)
|
||||
if (count == 0)
|
||||
return;
|
||||
|
||||
// Fix iterators when buffer is full (begin == end)
|
||||
if (count == capacity)
|
||||
{
|
||||
_count--;
|
||||
count--;
|
||||
}
|
||||
|
||||
// Find the first item (skip non-root events)
|
||||
Iterator firstEvent = Begin();
|
||||
for (auto i = firstEvent; i.IsNotEnd(); ++i)
|
||||
@@ -55,7 +62,7 @@ void ProfilerCPU::EventBuffer::Extract(Array<Event>& data, bool withRemove)
|
||||
Iterator lastEndedRoot = End();
|
||||
for (auto i = Last(); i != firstEvent; --i)
|
||||
{
|
||||
if (i.Event().Depth == 0 && i.Event().End != 0)
|
||||
if (i.Event().Depth == 0 && i.Event().End > 0)
|
||||
{
|
||||
lastEndedRoot = i;
|
||||
break;
|
||||
@@ -71,31 +78,27 @@ void ProfilerCPU::EventBuffer::Extract(Array<Event>& data, bool withRemove)
|
||||
const double lastRootEventEndTime = lastEndedRoot.Event().End;
|
||||
for (auto i = --End(); i != lastEndedRoot; --i)
|
||||
{
|
||||
if (i.Event().End != 0 && i.Event().End <= lastRootEventEndTime)
|
||||
if (i.Event().End > 0 && i.Event().End <= lastRootEventEndTime)
|
||||
{
|
||||
lastEvent = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (withRemove)
|
||||
if (withRemoval)
|
||||
{
|
||||
// Remove all the events between [Begin(), lastEvent]
|
||||
_count -= (lastEvent.Index() - Begin().Index()) & _capacityMask;
|
||||
}
|
||||
|
||||
// Extract all the events between [firstEvent, lastEvent]
|
||||
|
||||
const int32 head = (lastEvent.Index() + 1) & _capacityMask;
|
||||
count = (lastEvent.Index() - firstEvent.Index() + 1) & _capacityMask;
|
||||
|
||||
data.Resize(count, false);
|
||||
|
||||
int32 tail = (head - count) & _capacityMask;
|
||||
int32 spaceLeft = capacity - tail;
|
||||
int32 spaceLeftCount = Math::Min(spaceLeft, count);
|
||||
int32 overflow = count - spaceLeft;
|
||||
|
||||
const int32 tail = (head - count) & _capacityMask;
|
||||
const int32 spaceLeft = capacity - tail;
|
||||
const int32 spaceLeftCount = Math::Min(spaceLeft, count);
|
||||
const int32 overflow = count - spaceLeft;
|
||||
Platform::MemoryCopy(data.Get(), &_data[tail], spaceLeftCount * sizeof(Event));
|
||||
if (overflow > 0)
|
||||
Platform::MemoryCopy(data.Get() + spaceLeftCount, &_data[0], overflow * sizeof(Event));
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#include "Engine/Core/Math/Math.h"
|
||||
#include "Engine/Core/Collections/Array.h"
|
||||
#include "Engine/Scripting/ScriptingType.h"
|
||||
#include <ThirdParty/tracy/Tracy.h>
|
||||
#include <ThirdParty/tracy/tracy/Tracy.hpp>
|
||||
|
||||
#if COMPILE_WITH_PROFILER
|
||||
|
||||
@@ -106,8 +106,8 @@ public:
|
||||
/// Extracts the buffer data (only ended events starting from the root level with depth=0).
|
||||
/// </summary>
|
||||
/// <param name="data">The output data.</param>
|
||||
/// <param name="withRemove">True if also remove extracted events to prevent double-gather, false if don't modify the buffer data.</param>
|
||||
void Extract(Array<Event, HeapAllocation>& data, bool withRemove);
|
||||
/// <param name="withRemoval">True if also remove extracted events to prevent double-gather, false if don't modify the buffer data.</param>
|
||||
void Extract(Array<Event, HeapAllocation>& data, bool withRemoval);
|
||||
|
||||
public:
|
||||
/// <summary>
|
||||
|
||||
@@ -57,13 +57,13 @@ void ProfilingToolsService::Update()
|
||||
ProfilingTools::EventsCPU.EnsureCapacity(threads.Count());
|
||||
for (int32 i = 0; i < threads.Count(); i++)
|
||||
{
|
||||
auto t = threads[i];
|
||||
if (t == nullptr)
|
||||
ProfilerCPU::Thread* thread = threads[i];
|
||||
if (thread == nullptr)
|
||||
continue;
|
||||
ProfilingTools::ThreadStats* pt = nullptr;
|
||||
for (auto& e : ProfilingTools::EventsCPU)
|
||||
{
|
||||
if (e.Name == t->GetName())
|
||||
if (e.Name == thread->GetName())
|
||||
{
|
||||
pt = &e;
|
||||
break;
|
||||
@@ -72,10 +72,10 @@ void ProfilingToolsService::Update()
|
||||
if (!pt)
|
||||
{
|
||||
pt = &ProfilingTools::EventsCPU.AddOne();
|
||||
pt->Name = t->GetName();
|
||||
pt->Name = thread->GetName();
|
||||
}
|
||||
|
||||
t->Buffer.Extract(pt->Events, true);
|
||||
thread->Buffer.Extract(pt->Events, true);
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
||||
@@ -127,7 +127,7 @@ void PluginManagerService::InvokeDeinitialize(Plugin* plugin)
|
||||
return;
|
||||
StringAnsiView typeName = plugin->GetType().GetName();
|
||||
PROFILE_CPU();
|
||||
ZoneName(typeName.Get(), typeName.Length())
|
||||
ZoneName(typeName.Get(), typeName.Length());
|
||||
|
||||
LOG(Info, "Unloading plugin {}", plugin->ToString());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user