Skip to content

Commit 08cec4c

Browse files
Updated clang format (#1201)
- Updated clang-format to standardize code across the repo. - Applied clang-format to the entire current code base.
1 parent a2cf1c7 commit 08cec4c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+626
-625
lines changed

.clang-format

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,29 @@
1-
# https://releases.llvm.org/8.0.0/tools/clang/docs/ClangFormatStyleOptions.html
2-
---
31
BasedOnStyle: LLVM
4-
---
2+
53
Language: Cpp
64

7-
AccessModifierOffset: -4
8-
AlignAfterOpenBracket: DontAlign
9-
AlignOperands: false
10-
AlwaysBreakTemplateDeclarations: true
5+
AlignOperands: true
116
BreakBeforeBraces: Allman
7+
BreakConstructorInitializersBeforeComma: true
128
BreakConstructorInitializers: BeforeComma
139
ColumnLimit: 0
1410
FixNamespaceComments: false
1511
IndentCaseLabels: true
1612
IndentWidth: 4
17-
NamespaceIndentation: All
18-
PointerAlignment: Left
1913
SortIncludes: false
2014
SpaceAfterTemplateKeyword: false
21-
---
15+
SpaceBeforeParens: ControlStatements
16+
SpaceBeforeRangeBasedForLoopColon: true
17+
SpacesBeforeTrailingComments: 1
18+
NamespaceIndentation: All
19+
AccessModifierOffset: -4
20+
PointerAlignment: Left
21+
AlwaysBreakTemplateDeclarations: true
22+
AlignAfterOpenBracket: DontAlign
23+
ConstructorInitializerIndentWidth: 4
24+
ContinuationIndentWidth: 4
25+
ConstructorInitializerAllOnOneLineOrOnePerLine: false
26+
AllowShortLambdasOnASingleLine: All
27+
AllowShortCaseLabelsOnASingleLine: true
28+
AllowShortIfStatementsOnASingleLine: WithoutElse
29+
BreakBeforeTernaryOperators: true

Core/AppRuntime/Include/Babylon/Dispatchable.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ namespace Babylon
2929
{
3030
public:
3131
DispatchableImpl(DispatchableImpl<CallableT, ReturnT(ArgsT...)>&& other) = default;
32-
32+
3333
DispatchableImpl(CallableT&& callable)
3434
: m_callable{std::forward<CallableT>(callable)}
3535
{

Core/AppRuntime/Source/AppRuntime_JSI.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ namespace Babylon
3838
v8runtime::V8RuntimeArgs args{};
3939
args.inspectorPort = 5643;
4040
args.foreground_task_runner = std::make_shared<TaskRunnerAdapter>(*m_workQueue);
41-
41+
4242
const auto runtime{v8runtime::makeV8Runtime(std::move(args))};
4343
const auto env{Napi::Attach<facebook::jsi::Runtime&>(*runtime)};
4444
Dispatch([&runtime](Napi::Env env) {

Core/AppRuntime/Source/WorkQueue.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,11 @@ namespace Babylon
2323
// copyable callable if necessary.
2424
if constexpr (std::is_copy_constructible<CallableT>::value)
2525
{
26-
m_dispatcher.queue([this, callable = std::move(callable)]()
27-
{ Invoke(callable); });
26+
m_dispatcher.queue([this, callable = std::move(callable)]() { Invoke(callable); });
2827
}
2928
else
3029
{
31-
m_dispatcher.queue([this, callablePtr = std::make_shared<CallableT>(std::move(callable))]()
32-
{ Invoke(*callablePtr); });
30+
m_dispatcher.queue([this, callablePtr = std::make_shared<CallableT>(std::move(callable))]() { Invoke(*callablePtr); });
3331
}
3432
}
3533

Core/Graphics/InternalInclude/Babylon/Graphics/FrameBuffer.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ namespace Babylon::Graphics
4646
void Dispose();
4747

4848
private:
49-
5049
DeviceContext& m_context;
5150
bgfx::FrameBufferHandle m_handle;
5251
const uint16_t m_width;

Core/Graphics/InternalInclude/Babylon/Graphics/SafeTimespanGuarantor.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ namespace Babylon::Graphics
3030

3131
using SafetyGuarantee = gsl::final_action<std::function<void()>>;
3232
SafetyGuarantee GetSafetyGuarantee();
33-
33+
3434
void Open();
3535
void RequestClose();
3636
void Lock();

Core/Graphics/InternalInclude/Babylon/Graphics/continuation_scheduler.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ namespace Babylon
4545
{
4646
m_dispatcher.tick(cancellation);
4747
}
48-
48+
4949
private:
5050
arcana::manual_dispatcher<WorkSize> m_dispatcher{};
5151
continuation_scheduler<WorkSize> m_scheduler{};

Core/Graphics/Source/Device.cpp

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33

44
namespace Babylon::Graphics
55
{
6-
class Device::Impl : public DeviceImpl { };
6+
class Device::Impl : public DeviceImpl
7+
{
8+
};
79

810
Device::Device()
911
: m_impl{std::make_unique<Impl>()}
@@ -82,16 +84,13 @@ namespace Babylon::Graphics
8284
{
8385
auto& guarantor = m_impl->GetSafeTimespanGuarantor(updateName);
8486
return {
85-
[&guarantor]
86-
{
87+
[&guarantor] {
8788
guarantor.Open();
8889
},
89-
[&guarantor](std::function<void()> callback)
90-
{
90+
[&guarantor](std::function<void()> callback) {
9191
guarantor.CloseScheduler()(std::move(callback));
9292
guarantor.RequestClose();
93-
}
94-
};
93+
}};
9594
}
9695

9796
void Device::StartRenderingCurrentFrame()

Core/Graphics/Source/DeviceImpl.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ namespace Babylon::Graphics
8888
init.resolution.reset |= BGFX_RESET_MSAA_X16;
8989
break;
9090
default:
91-
m_bgfxCallback.trace(__FILE__, __LINE__, "WARNING: Setting an incorrect value for SetMSAA (%d). Correct values are 0, 1 (disable MSAA) or 2, 4, 8, 16.", int(value));
91+
m_bgfxCallback.trace(__FILE__, __LINE__, "WARNING: Setting an incorrect value for SetMSAA (%d). Correct values are 0, 1 (disable MSAA) or 2, 4, 8, 16.", int(value));
9292
break;
9393
}
9494
}
@@ -233,7 +233,7 @@ namespace Babylon::Graphics
233233
value.Lock();
234234
}
235235
}
236-
236+
237237
arcana::trace_region finishRenderingRegion{"DeviceImpl::FinishRenderingCurrentFrame"};
238238

239239
assert(m_renderThreadAffinity.check());

Core/Graphics/Source/FrameBuffer.cpp

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,14 @@ namespace Babylon::Graphics
6363
void FrameBuffer::Bind(bgfx::Encoder& encoder)
6464
{
6565
m_viewId = m_context.AcquireNewViewId(encoder);
66-
66+
6767
//Reset view state for next frame.
6868
m_viewPort = {0, 0, 1, 1};
6969
m_flags = BGFX_CLEAR_NONE;
7070
m_rgba = 0x000000ff;
7171
m_depth = 1.0f;
7272
m_stencil = 0;
73-
73+
7474
SetDefaultClearMode(m_viewId, m_handle, BGFX_CLEAR_NONE, 0x000000ff, 1.0f, 0);
7575
setViewPort(m_viewId, m_viewPort, Width(), Height());
7676
m_hasViewIdBeenUsed = false;
@@ -161,10 +161,9 @@ namespace Babylon::Graphics
161161

162162
bool ViewPort::Equals(const ViewPort& other) const
163163
{
164-
return
165-
std::abs(X - other.X) < std::numeric_limits<float>::epsilon() &&
166-
std::abs(Y - other.Y) < std::numeric_limits<float>::epsilon() &&
167-
std::abs(Width - other.Width) < std::numeric_limits<float>::epsilon() &&
168-
std::abs(Height - other.Height) < std::numeric_limits<float>::epsilon();
164+
return std::abs(X - other.X) < std::numeric_limits<float>::epsilon() &&
165+
std::abs(Y - other.Y) < std::numeric_limits<float>::epsilon() &&
166+
std::abs(Width - other.Width) < std::numeric_limits<float>::epsilon() &&
167+
std::abs(Height - other.Height) < std::numeric_limits<float>::epsilon();
169168
}
170169
}

0 commit comments

Comments
 (0)