Format more engine code

This commit is contained in:
Wojtek Figat
2022-06-14 22:41:51 +02:00
parent 3925c6221c
commit 69b69f9ea9
5 changed files with 14 additions and 49 deletions

View File

@@ -17,15 +17,14 @@
/// </summary>
API_CLASS(Static) class FLAXENGINE_API ProfilerCPU
{
DECLARE_SCRIPTING_TYPE_NO_SPAWN(ProfilerCPU);
DECLARE_SCRIPTING_TYPE_NO_SPAWN(ProfilerCPU);
public:
/// <summary>
/// Represents single CPU profiling event data.
/// </summary>
API_STRUCT() struct Event
{
DECLARE_SCRIPTING_TYPE_MINIMAL(Event);
DECLARE_SCRIPTING_TYPE_MINIMAL(Event);
/// <summary>
/// The start time (in milliseconds).
@@ -61,7 +60,6 @@ public:
class EventBuffer : public NonCopyable
{
private:
Event* _data;
int32 _capacity;
int32 _capacityMask;
@@ -69,12 +67,10 @@ public:
int32 _count;
public:
EventBuffer();
~EventBuffer();
public:
/// <summary>
/// Gets the amount of the events in the buffer.
/// </summary>
@@ -90,7 +86,7 @@ public:
/// <returns>The event</returns>
Event& Get(int32 index) const
{
ASSERT(index >= 0 && index < _capacity);
ASSERT_LOW_LAYER(index >= 0 && index < _capacity);
return _data[index];
}
@@ -114,7 +110,6 @@ public:
void Extract(Array<Event, HeapAllocation>& data, bool withRemove);
public:
/// <summary>
/// Ring buffer iterator
/// </summary>
@@ -123,7 +118,6 @@ public:
friend EventBuffer;
private:
EventBuffer* _buffer;
int32 _index;
@@ -136,7 +130,6 @@ public:
Iterator(const Iterator& i) = default;
public:
FORCE_INLINE int32 Index() const
{
return _index;
@@ -144,32 +137,22 @@ public:
FORCE_INLINE Event& Event() const
{
ASSERT(_buffer && _index >= 0 && _index < _buffer->_capacity);
ASSERT_LOW_LAYER(_buffer && _index >= 0 && _index < _buffer->_capacity);
return _buffer->Get(_index);
}
public:
/// <summary>
/// Checks if iterator is in the end of the collection.
/// </summary>
bool IsEnd() const
{
ASSERT(_buffer);
ASSERT_LOW_LAYER(_buffer);
return _index == _buffer->_head;
}
/// <summary>
/// Checks if iterator is not in the end of the collection.
/// </summary>
bool IsNotEnd() const
{
ASSERT(_buffer);
ASSERT_LOW_LAYER(_buffer);
return _index != _buffer->_head;
}
public:
FORCE_INLINE bool operator==(const Iterator& v) const
{
return _buffer == v._buffer && _index == v._index;
@@ -181,7 +164,6 @@ public:
}
public:
Iterator& operator++()
{
ASSERT(_buffer);
@@ -214,7 +196,6 @@ public:
};
public:
FORCE_INLINE Iterator Begin()
{
return Iterator(this, (_head - _count) & _capacityMask);
@@ -238,12 +219,10 @@ public:
class Thread
{
private:
String _name;
int32 _depth = 0;
public:
Thread(const Char* name)
{
_name = name;
@@ -255,14 +234,12 @@ public:
}
public:
/// <summary>
/// The current thread.
/// </summary>
static THREADLOCAL Thread* Current;
public:
/// <summary>
/// Gets the name.
/// </summary>
@@ -277,7 +254,6 @@ public:
EventBuffer Buffer;
public:
/// <summary>
/// Begins the event running on a this thread. Call EndEvent with index parameter equal to the returned value by BeginEvent function.
/// </summary>
@@ -297,7 +273,6 @@ public:
};
public:
/// <summary>
/// The registered threads.
/// </summary>
@@ -309,7 +284,6 @@ public:
static bool Enabled;
public:
/// <summary>
/// Determines whether the current (calling) thread is being profiled by the service (it may has no active profile block but is registered).
/// </summary>

View File

@@ -19,15 +19,14 @@ class GPUTimerQuery;
/// </summary>
API_CLASS(Static) class FLAXENGINE_API ProfilerGPU
{
DECLARE_SCRIPTING_TYPE_NO_SPAWN(ProfilerGPU);
DECLARE_SCRIPTING_TYPE_NO_SPAWN(ProfilerGPU);
public:
/// <summary>
/// Represents single CPU profiling event data.
/// </summary>
API_STRUCT() struct Event
{
DECLARE_SCRIPTING_TYPE_MINIMAL(Event);
DECLARE_SCRIPTING_TYPE_MINIMAL(Event);
/// <summary>
/// The name of the event.
@@ -61,12 +60,10 @@ public:
class EventBuffer : public NonCopyable
{
private:
bool _isResolved = true;
Array<Event> _data;
public:
/// <summary>
/// The index of the frame buffer was used for recording events (for the last time).
/// </summary>
@@ -117,7 +114,6 @@ public:
};
private:
static int32 _depth;
static Array<GPUTimerQuery*> _timerQueriesPool;
@@ -126,7 +122,6 @@ private:
static GPUTimerQuery* GetTimerQuery();
public:
/// <summary>
/// True if GPU profiling is enabled, otherwise false to disable events collecting and GPU timer queries usage. Can be changed during rendering.
/// </summary>
@@ -143,7 +138,6 @@ public:
static EventBuffer Buffers[PROFILER_GPU_EVENTS_FRAMES];
public:
/// <summary>
/// Begins the event. Call EndEvent with index parameter equal to the returned value by BeginEvent function.
/// </summary>
@@ -197,7 +191,7 @@ struct ScopeProfileBlockGPU
{
Index = ProfilerGPU::BeginEvent(name);
}
FORCE_INLINE ~ScopeProfileBlockGPU()
{
ProfilerGPU::EndEvent(Index);

View File

@@ -15,7 +15,6 @@ Array<ProfilerGPU::Event> ProfilingTools::EventsGPU;
class ProfilingToolsService : public EngineService
{
public:
ProfilingToolsService()
: EngineService(TEXT("Profiling Tools"))
{

View File

@@ -14,15 +14,14 @@
/// </summary>
API_CLASS(Static) class ProfilingTools
{
DECLARE_SCRIPTING_TYPE_NO_SPAWN(ProfilingTools);
DECLARE_SCRIPTING_TYPE_NO_SPAWN(ProfilingTools);
public:
/// <summary>
/// The GPU memory stats.
/// </summary>
API_STRUCT() struct MemoryStatsGPU
{
DECLARE_SCRIPTING_TYPE_MINIMAL(MemoryStatsGPU);
DECLARE_SCRIPTING_TYPE_MINIMAL(MemoryStatsGPU);
/// <summary>
/// The total amount of memory in bytes (as reported by the driver).
@@ -40,7 +39,7 @@ public:
/// </summary>
API_STRUCT() struct MainStats
{
DECLARE_SCRIPTING_TYPE_MINIMAL(MainStats);
DECLARE_SCRIPTING_TYPE_MINIMAL(MainStats);
/// <summary>
/// The process memory stats.
@@ -93,7 +92,7 @@ public:
/// </summary>
API_STRUCT() struct ThreadStats
{
DECLARE_SCRIPTING_TYPE_MINIMAL(ThreadStats);
DECLARE_SCRIPTING_TYPE_MINIMAL(ThreadStats);
/// <summary>
/// The thread name.
@@ -107,7 +106,6 @@ public:
};
public:
/// <summary>
/// The current collected main stats by the profiler from the local session. Updated every frame.
/// </summary>

View File

@@ -11,7 +11,7 @@
/// </summary>
API_STRUCT() struct RenderStatsData
{
DECLARE_SCRIPTING_TYPE_MINIMAL(RenderStatsData);
DECLARE_SCRIPTING_TYPE_MINIMAL(RenderStatsData);
/// <summary>
/// The draw calls count.