From 69b69f9ea9a111f84d1c2ead67b4e1624c1d494b Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Tue, 14 Jun 2022 22:41:51 +0200 Subject: [PATCH] Format more engine code --- Source/Engine/Profiler/ProfilerCPU.h | 38 ++++------------------- Source/Engine/Profiler/ProfilerGPU.h | 12 ++----- Source/Engine/Profiler/ProfilingTools.cpp | 1 - Source/Engine/Profiler/ProfilingTools.h | 10 +++--- Source/Engine/Profiler/RenderStats.h | 2 +- 5 files changed, 14 insertions(+), 49 deletions(-) diff --git a/Source/Engine/Profiler/ProfilerCPU.h b/Source/Engine/Profiler/ProfilerCPU.h index e4d40a444..b4a4bfdc4 100644 --- a/Source/Engine/Profiler/ProfilerCPU.h +++ b/Source/Engine/Profiler/ProfilerCPU.h @@ -17,15 +17,14 @@ /// API_CLASS(Static) class FLAXENGINE_API ProfilerCPU { -DECLARE_SCRIPTING_TYPE_NO_SPAWN(ProfilerCPU); + DECLARE_SCRIPTING_TYPE_NO_SPAWN(ProfilerCPU); public: - /// /// Represents single CPU profiling event data. /// API_STRUCT() struct Event { - DECLARE_SCRIPTING_TYPE_MINIMAL(Event); + DECLARE_SCRIPTING_TYPE_MINIMAL(Event); /// /// 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: - /// /// Gets the amount of the events in the buffer. /// @@ -90,7 +86,7 @@ public: /// The event 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& data, bool withRemove); public: - /// /// Ring buffer iterator /// @@ -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: - - /// - /// Checks if iterator is in the end of the collection. - /// bool IsEnd() const { - ASSERT(_buffer); + ASSERT_LOW_LAYER(_buffer); return _index == _buffer->_head; } - /// - /// Checks if iterator is not in the end of the collection. - /// 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: - /// /// The current thread. /// static THREADLOCAL Thread* Current; public: - /// /// Gets the name. /// @@ -277,7 +254,6 @@ public: EventBuffer Buffer; public: - /// /// Begins the event running on a this thread. Call EndEvent with index parameter equal to the returned value by BeginEvent function. /// @@ -297,7 +273,6 @@ public: }; public: - /// /// The registered threads. /// @@ -309,7 +284,6 @@ public: static bool Enabled; public: - /// /// Determines whether the current (calling) thread is being profiled by the service (it may has no active profile block but is registered). /// diff --git a/Source/Engine/Profiler/ProfilerGPU.h b/Source/Engine/Profiler/ProfilerGPU.h index 556068590..caba96b6e 100644 --- a/Source/Engine/Profiler/ProfilerGPU.h +++ b/Source/Engine/Profiler/ProfilerGPU.h @@ -19,15 +19,14 @@ class GPUTimerQuery; /// API_CLASS(Static) class FLAXENGINE_API ProfilerGPU { -DECLARE_SCRIPTING_TYPE_NO_SPAWN(ProfilerGPU); + DECLARE_SCRIPTING_TYPE_NO_SPAWN(ProfilerGPU); public: - /// /// Represents single CPU profiling event data. /// API_STRUCT() struct Event { - DECLARE_SCRIPTING_TYPE_MINIMAL(Event); + DECLARE_SCRIPTING_TYPE_MINIMAL(Event); /// /// The name of the event. @@ -61,12 +60,10 @@ public: class EventBuffer : public NonCopyable { private: - bool _isResolved = true; Array _data; public: - /// /// The index of the frame buffer was used for recording events (for the last time). /// @@ -117,7 +114,6 @@ public: }; private: - static int32 _depth; static Array _timerQueriesPool; @@ -126,7 +122,6 @@ private: static GPUTimerQuery* GetTimerQuery(); public: - /// /// True if GPU profiling is enabled, otherwise false to disable events collecting and GPU timer queries usage. Can be changed during rendering. /// @@ -143,7 +138,6 @@ public: static EventBuffer Buffers[PROFILER_GPU_EVENTS_FRAMES]; public: - /// /// Begins the event. Call EndEvent with index parameter equal to the returned value by BeginEvent function. /// @@ -197,7 +191,7 @@ struct ScopeProfileBlockGPU { Index = ProfilerGPU::BeginEvent(name); } - + FORCE_INLINE ~ScopeProfileBlockGPU() { ProfilerGPU::EndEvent(Index); diff --git a/Source/Engine/Profiler/ProfilingTools.cpp b/Source/Engine/Profiler/ProfilingTools.cpp index 628e2affe..ee412c6a9 100644 --- a/Source/Engine/Profiler/ProfilingTools.cpp +++ b/Source/Engine/Profiler/ProfilingTools.cpp @@ -15,7 +15,6 @@ Array ProfilingTools::EventsGPU; class ProfilingToolsService : public EngineService { public: - ProfilingToolsService() : EngineService(TEXT("Profiling Tools")) { diff --git a/Source/Engine/Profiler/ProfilingTools.h b/Source/Engine/Profiler/ProfilingTools.h index 8ba2f1c89..28115fcda 100644 --- a/Source/Engine/Profiler/ProfilingTools.h +++ b/Source/Engine/Profiler/ProfilingTools.h @@ -14,15 +14,14 @@ /// API_CLASS(Static) class ProfilingTools { -DECLARE_SCRIPTING_TYPE_NO_SPAWN(ProfilingTools); + DECLARE_SCRIPTING_TYPE_NO_SPAWN(ProfilingTools); public: - /// /// The GPU memory stats. /// API_STRUCT() struct MemoryStatsGPU { - DECLARE_SCRIPTING_TYPE_MINIMAL(MemoryStatsGPU); + DECLARE_SCRIPTING_TYPE_MINIMAL(MemoryStatsGPU); /// /// The total amount of memory in bytes (as reported by the driver). @@ -40,7 +39,7 @@ public: /// API_STRUCT() struct MainStats { - DECLARE_SCRIPTING_TYPE_MINIMAL(MainStats); + DECLARE_SCRIPTING_TYPE_MINIMAL(MainStats); /// /// The process memory stats. @@ -93,7 +92,7 @@ public: /// API_STRUCT() struct ThreadStats { - DECLARE_SCRIPTING_TYPE_MINIMAL(ThreadStats); + DECLARE_SCRIPTING_TYPE_MINIMAL(ThreadStats); /// /// The thread name. @@ -107,7 +106,6 @@ public: }; public: - /// /// The current collected main stats by the profiler from the local session. Updated every frame. /// diff --git a/Source/Engine/Profiler/RenderStats.h b/Source/Engine/Profiler/RenderStats.h index 708b6f3fb..a3dd6e7f7 100644 --- a/Source/Engine/Profiler/RenderStats.h +++ b/Source/Engine/Profiler/RenderStats.h @@ -11,7 +11,7 @@ /// API_STRUCT() struct RenderStatsData { -DECLARE_SCRIPTING_TYPE_MINIMAL(RenderStatsData); + DECLARE_SCRIPTING_TYPE_MINIMAL(RenderStatsData); /// /// The draw calls count.