Add support for Tracy on Android
This commit is contained in:
@@ -32,6 +32,7 @@ public class Profiler : EngineModule
|
||||
switch (options.Platform.Target)
|
||||
{
|
||||
case TargetPlatform.Windows:
|
||||
case TargetPlatform.Android:
|
||||
options.PublicDependencies.Add("tracy");
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -16,6 +16,11 @@ bool ProfilerGPU::Enabled = true;
|
||||
int32 ProfilerGPU::CurrentBuffer = 0;
|
||||
ProfilerGPU::EventBuffer ProfilerGPU::Buffers[PROFILER_GPU_EVENTS_FRAMES];
|
||||
|
||||
bool ProfilerGPU::EventBuffer::HasData() const
|
||||
{
|
||||
return _isResolved && _data.HasItems();
|
||||
}
|
||||
|
||||
void ProfilerGPU::EventBuffer::EndAll()
|
||||
{
|
||||
for (int32 i = 0; i < _data.Count(); i++)
|
||||
@@ -41,7 +46,7 @@ void ProfilerGPU::EventBuffer::TryResolve()
|
||||
{
|
||||
auto& e = _data[i];
|
||||
e.Time = e.Timer->GetResult();
|
||||
FreeTimerQuery(e.Timer);
|
||||
_timerQueriesFree.Add(e.Timer);
|
||||
e.Timer = nullptr;
|
||||
}
|
||||
|
||||
@@ -55,6 +60,13 @@ int32 ProfilerGPU::EventBuffer::Add(const Event& e)
|
||||
return index;
|
||||
}
|
||||
|
||||
void ProfilerGPU::EventBuffer::Extract(Array<Event>& data) const
|
||||
{
|
||||
// Don't use unresolved data
|
||||
ASSERT(_isResolved);
|
||||
data = _data;
|
||||
}
|
||||
|
||||
void ProfilerGPU::EventBuffer::Clear()
|
||||
{
|
||||
_data.Clear();
|
||||
|
||||
@@ -75,10 +75,7 @@ public:
|
||||
/// <summary>
|
||||
/// Determines whether this buffer has ready data (resolved and not empty).
|
||||
/// </summary>
|
||||
FORCE_INLINE bool HasData() const
|
||||
{
|
||||
return _isResolved && _data.HasItems();
|
||||
}
|
||||
bool HasData() const;
|
||||
|
||||
/// <summary>
|
||||
/// Ends all used timer queries.
|
||||
@@ -111,12 +108,7 @@ public:
|
||||
/// Extracts the buffer data.
|
||||
/// </summary>
|
||||
/// <param name="data">The output data.</param>
|
||||
void Extract(Array<Event>& data) const
|
||||
{
|
||||
// Don't use unresolved data
|
||||
ASSERT(_isResolved);
|
||||
data = _data;
|
||||
}
|
||||
void Extract(Array<Event>& data) const;
|
||||
|
||||
/// <summary>
|
||||
/// Clears this buffer.
|
||||
@@ -133,11 +125,6 @@ private:
|
||||
|
||||
static GPUTimerQuery* GetTimerQuery();
|
||||
|
||||
FORCE_INLINE static void FreeTimerQuery(GPUTimerQuery* q)
|
||||
{
|
||||
_timerQueriesFree.Add(q);
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
@@ -204,24 +191,14 @@ public:
|
||||
/// </summary>
|
||||
struct ScopeProfileBlockGPU
|
||||
{
|
||||
/// <summary>
|
||||
/// The event token index.
|
||||
/// </summary>
|
||||
int32 Index;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ScopeProfileBlockGPU"/> struct.
|
||||
/// </summary>
|
||||
/// <param name="name">The event name.</param>
|
||||
ScopeProfileBlockGPU(const Char* name)
|
||||
FORCE_INLINE ScopeProfileBlockGPU(const Char* name)
|
||||
{
|
||||
Index = ProfilerGPU::BeginEvent(name);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Finalizes an instance of the <see cref="ScopeProfileBlockGPU"/> class.
|
||||
/// </summary>
|
||||
~ScopeProfileBlockGPU()
|
||||
|
||||
FORCE_INLINE ~ScopeProfileBlockGPU()
|
||||
{
|
||||
ProfilerGPU::EndEvent(Index);
|
||||
}
|
||||
@@ -234,8 +211,7 @@ struct TIsPODType<ProfilerGPU::Event>
|
||||
};
|
||||
|
||||
// Shortcut macro for profiling rendering on GPU
|
||||
#define PROFILE_GPU(name) \
|
||||
ScopeProfileBlockGPU ProfileBlockGPU(TEXT(name))
|
||||
#define PROFILE_GPU(name) ScopeProfileBlockGPU ProfileBlockGPU(TEXT(name))
|
||||
|
||||
#else
|
||||
|
||||
|
||||
@@ -346,7 +346,8 @@ bool Scripting::LoadBinaryModules(const String& path, const String& projectFolde
|
||||
const auto startTime = DateTime::NowUTC();
|
||||
#if PLATFORM_ANDROID
|
||||
// On Android all native binaries are side-by-side with the app
|
||||
nativePath = StringUtils::GetDirectoryName(Platform::GetExecutableFilePath()) / StringUtils::GetFileName(nativePath);
|
||||
nativePath = StringUtils::GetDirectoryName(Platform::GetExecutableFilePath());
|
||||
nativePath /= StringUtils::GetFileName(nativePath);
|
||||
#endif
|
||||
auto library = Platform::LoadLibrary(nativePath.Get());
|
||||
if (!library)
|
||||
|
||||
Reference in New Issue
Block a user