Skip to content

Commit be3a92c

Browse files
committed
(gpu) change code convention
1 parent 390ae90 commit be3a92c

File tree

209 files changed

+17010
-12206
lines changed

Some content is hidden

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

209 files changed

+17010
-12206
lines changed

.clang-format

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,22 @@ BitFieldColonSpacing: After
2323
BreakBeforeConceptDeclarations: 'true'
2424
BreakBinaryOperations: RespectPrecedence
2525
EmptyLineBeforeAccessModifier: LogicalBlock
26+
EnumTrailingComma: Insert
27+
FixNamespaceComments: 'true'
2628
IndentExternBlock: Indent
2729
IndentGotoLabels: 'false'
2830
IndentRequiresClause: 'true'
2931
InsertBraces: 'false'
3032
InsertTrailingCommas: Wrapped
3133
LambdaBodyIndentation: Signature
3234
PPIndentWidth: 4
35+
PenaltyBreakAssignment: 1000
36+
PenaltyReturnTypeOnItsOwnLine: 1000
37+
PenaltyBreakBeforeFirstCallParameter: 1000
38+
PenaltyBreakOpenParenthesis: 1000
39+
PenaltyBreakBeforeMemberAccess: 10
40+
PenaltyIndentedWhitespace: 1
41+
ContinuationIndentWidth: 2
3342
ReferenceAlignment: Left
3443
# RemoveBracesLLVM: 'true'
3544
RequiresClausePosition: OwnLine
@@ -40,9 +49,18 @@ SpaceBeforeCaseColon: 'false'
4049
AlwaysBreakAfterDefinitionReturnType: None
4150
SpaceBeforeSquareBrackets: 'false'
4251
SpaceInEmptyBlock: 'false'
43-
AttributeMacros: [STORMKIT_FORCE_INLINE, STORMKIT_API, STORMKIT_PRIVATE, STORMKIT_PUBLIC]
52+
AttributeMacros: [STORMKIT_FORCE_INLINE, STORMKIT_API, STORMKIT_PRIVATE, STORMKIT_PUBLIC, STORMKIT_CONST, STORMKIT_PURE, STORMKIT_INTRINSIC]
4453
IfMacros: [CASE_DO, CASE_DO_RETURN, CASE, CASE_ARGS_DO]
4554
BreakAfterAttributes: Always
55+
Macros:
56+
- STORMKIT_FORCE_INLINE=[[maybe_unused]]
57+
- STORMKIT_API=[[maybe_unused]]
58+
- STORMKIT_PRIVATE=[[maybe_unused]]
59+
- STORMKIT_PUBLIC=[[maybe_unused]]
60+
- STORMKIT_CONST=[[maybe_unused]]
61+
- STORMKIT_PURE=[[maybe_unused]]
62+
- STORMKIT_INTRINSIC=[[maybe_unused]]
63+
4664
QualifierAlignment: Custom
4765
QualifierOrder: [static, inline, volatile, restrict, constexpr, const, type]
4866

@@ -64,7 +82,6 @@ ColumnLimit: '100'
6482
CompactNamespaces: 'true'
6583
ConstructorInitializerAllOnOneLineOrOnePerLine: 'false'
6684
ConstructorInitializerIndentWidth: '4'
67-
ContinuationIndentWidth: '4'
6885
IncludeBlocks: Preserve
6986
IndentCaseLabels: 'true'
7087
IndentWidth: '4'
@@ -76,7 +93,6 @@ MaxEmptyLinesToKeep: '1'
7693
NamespaceIndentation: All
7794
ObjCSpaceAfterProperty: true
7895
ObjCSpaceBeforeProtocolList: false
79-
PenaltyBreakAssignment: '0'
8096
PointerAlignment: Left
8197
SortIncludes: 'true'
8298
SortUsingDeclarations: 'true'
@@ -91,7 +107,6 @@ SpacesInAngles: 'false'
91107
Standard: c++20
92108
TabWidth: '4'
93109
UseTab: Never
94-
PenaltyBreakBeforeFirstCallParameter: '120'
95110
---
96111
Language: ObjC
97112
AlignAfterOpenBracket: Align
@@ -137,8 +152,12 @@ MaxEmptyLinesToKeep: '1'
137152
NamespaceIndentation: All
138153
ObjCSpaceAfterProperty: true
139154
ObjCSpaceBeforeProtocolList: false
140-
PenaltyBreakAssignment: '0'
141155
PointerAlignment: Right
156+
PenaltyBreakAssignment: 1000
157+
PenaltyReturnTypeOnItsOwnLine: 1000
158+
PenaltyBreakBeforeFirstCallParameter: 1000
159+
PenaltyBreakOpenParenthesis: 1000
160+
PenaltyBreakBeforeMemberAccess: 10
142161
SortIncludes: 'true'
143162
SortUsingDeclarations: 'true'
144163
SpaceAfterTemplateKeyword: 'false'
@@ -152,7 +171,6 @@ SpacesInAngles: 'false'
152171
Standard: c++20
153172
TabWidth: '4'
154173
UseTab: Never
155-
PenaltyBreakBeforeFirstCallParameter: '120'
156174
PenaltyIndentedWhitespace: '1'
157175
QualifierAlignment: Custom
158176
QualifierOrder: [static, inline, volatile, restrict, constexpr, const, type]

.github/workflows/Linux.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ jobs:
7979
libelf-dev
8080
libdwarf-dev
8181
mold
82+
nasm
8283
llvm${{ env.LLVM_VERSION }}
8384
llvm${{ env.LLVM_VERSION }}-dev
8485
llvm${{ env.LLVM_VERSION }}-runtime
@@ -123,7 +124,7 @@ jobs:
123124
- name: Setup XMake
124125
uses: xmake-io/github-action-setup-xmake@v1
125126
with:
126-
xmake-version: Arthapz/xmake#branch@improve-jobgraph-support2
127+
xmake-version: branch@dev
127128
actions-cache-folder: .xmake-cache
128129

129130
- name: Cache XMake

.github/workflows/Windows.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ jobs:
8282
if: ${{ !steps.restore-xmakecache.outputs.cache-hit }}
8383
uses: xmake-io/github-action-setup-xmake@v1
8484
with:
85-
xmake-version: Arthapz/xmake#branch@fix-cmake-clang-msstl
85+
xmake-version: branch@dev
8686
actions-cache-folder: '.xmake-cache'
8787

8888
- name: Cache XMake

.github/workflows/macOS.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ jobs:
4949
- name: Install build tools
5050
uses: tecolicom/actions-use-homebrew-tools@v1
5151
with:
52-
tools: llvm ninja meson mold
52+
tools: llvm ninja meson mold nasm pkgconf
5353
verbose: true
5454

5555
- name: Checkout
@@ -78,7 +78,7 @@ jobs:
7878
- name: Setup XMake
7979
uses: xmake-io/github-action-setup-xmake@v1
8080
with:
81-
xmake-version: Arthapz/xmake#branch@improve-jobgraph-support2
81+
xmake-version: branch@dev
8282
actions-cache-folder: .xmake-cache
8383

8484
- name: Cache XMake

examples/engine/sprites/src/Constants.mpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,12 @@ export {
3131
// using namespace stormkit::gpu;
3232
// return std::array { VertexInputAttributeDescription { .location = 0,
3333
//.binding = 0,
34-
//.format = Format::Float2,
34+
//.format = Format::f322,
3535
//.offset =
3636
// offsetof(Vertex, position) },
3737
// VertexInputAttributeDescription { .location = 1,
3838
//.binding = 0,
39-
//.format = Format::Float3,
39+
//.format = Format::f323,
4040
//.offset = offsetof(Vertex, color) } };
4141
//}();
4242

examples/engine/sprites/src/SpritesApp.mpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export module SpritesApp;
77
import std;
88

99
import stormkit.core;
10-
import stormkit.Gpu;
10+
import stormkit.gpu;
1111
import stormkit.Engine;
1212
import stormkit.wsi;
1313

@@ -50,7 +50,7 @@ auto SpritesApp::run(std::span<const std::string_view> _) -> Int {
5050

5151
auto& render_system = world.add_system<engine::SpriteRenderSystem>(renderer, window.extent());
5252
m_application->setUpdateFrameGraphCallback(
53-
bindFront(&engine::SpriteRenderSystem::updateFrameGraph, &render_system));
53+
bind_front(&engine::SpriteRenderSystem::updateFrameGraph, &render_system));
5454

5555
engine::makeSprite(world, { 32.f, 32.f });
5656

examples/engine/sprites/xmake.lua

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ do
1515
add_defines("STORMKIT_ASSERT=0")
1616
end
1717

18-
if is_plat("windows") then add_ldflags("-Wl,/SUBSYSTEM:CONSOLE", { force = true }) end
19-
2018
add_files("src/*.cpp")
2119
add_files("src/*.mpp")
2220
add_files("shaders/*.nzsl")

examples/engine/triangle/src/TriangleApp.mpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export module TriangleApp;
77
import std;
88

99
import stormkit.core;
10-
import stormkit.Gpu;
10+
import stormkit.gpu;
1111
import stormkit.Engine;
1212
import stormkit.wsi;
1313

@@ -49,7 +49,7 @@ auto TriangleApp::run(std::span<const std::string_view> _) -> Int {
4949
m_application = engine::Application::create(APPLICATION_NAME, { 800u, 600u }, WINDOW_TITLE)
5050
.transform_error(assert("Failed to initialize Render engine"))
5151
.value();
52-
m_application->setUpdateFrameGraphCallback(bindFront(&TriangleApp::updateFrameGraph, this));
52+
m_application->setUpdateFrameGraphCallback(bind_front(&TriangleApp::updateFrameGraph, this));
5353

5454
auto& window = m_application->window();
5555
auto& event_handler = m_application->eventHandler();
@@ -59,12 +59,12 @@ auto TriangleApp::run(std::span<const std::string_view> _) -> Int {
5959
m_window_extent = window.extent();
6060

6161
m_vertex_shader
62-
= gpu::Shader::fromBytes(renderer.device(), SHADER_DATA, gpu::ShaderStageFlag::Vertex)
62+
= gpu::Shader::load_from_bytes(renderer.device(), SHADER_DATA, gpu::ShaderStageFlag::Vertex)
6363
.transform_error(assert("Failed to load vertex shader"))
6464
.value();
6565

6666
m_fragment_shader
67-
= gpu::Shader::fromBytes(renderer.device(), SHADER_DATA, gpu::ShaderStageFlag::Fragment)
67+
= gpu::Shader::load_from_bytes(renderer.device(), SHADER_DATA, gpu::ShaderStageFlag::Fragment)
6868
.transform_error(assert("Failed to load fragment shader"))
6969
.value();
7070

@@ -139,7 +139,7 @@ auto TriangleApp::updateFrameGraph(engine::FrameGraphBuilder& graph,
139139
.value();
140140
}
141141

142-
cmb.bindPipeline(m_pipeline);
142+
cmb.bind_pipeline(m_pipeline);
143143
cmb.draw(3);
144144
});
145145

examples/engine/triangle/xmake.lua

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ do
1717
add_defines("STORMKIT_ASSERT=0")
1818
end
1919

20-
if is_plat("windows") then add_ldflags("-Wl,/SUBSYSTEM:CONSOLE", { force = true }) end
21-
2220
add_files("src/*.cpp")
2321
add_files("src/*.mpp")
2422
add_files("shaders/*.nzsl")

examples/entities/gameoflife/src/App.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#ifdef STORMKIT_BUILD_MODULES
22
module App;
33

4-
import stormkit.Gpu;
4+
import stormkit.gpu;
55

66
import Components;
77
import Systems;
@@ -25,12 +25,12 @@ App::~App() {
2525
ilog("Cleaning");
2626
}
2727

28-
auto App::run([[maybe_unused]] const int argc, [[maybe_unused]] const char** argv) -> Int32 {
28+
auto App::run([[maybe_unused]] const int argc, [[maybe_unused]] CZString argv[]) -> i32 {
2929
using Clock = std::chrono::high_resolution_clock;
3030

3131
using namespace stormkit::literals;
3232

33-
doInitWindow();
33+
do_initWindow();
3434

3535
m_board = image::Image {
3636
{ BOARD_SIZE, BOARD_SIZE },
@@ -80,7 +80,7 @@ auto App::run([[maybe_unused]] const int argc, [[maybe_unused]] const char** arg
8080
return EXIT_SUCCESS;
8181
}
8282

83-
auto App::doInitWindow() -> void {
83+
auto App::do_initWindow() -> void {
8484
const auto window_style = wsi::WindowStyle::ALL;
8585

8686
m_window = allocate<wsi::Window>(WINDOW_TITLE, math::ExtentU { 800u, 600u }, window_style);
@@ -153,7 +153,7 @@ auto App::handleMouse(const stormkit::wsi::MouseButtonPushedEventData& event) ->
153153
createCell(x, y);
154154
}
155155

156-
auto App::createCell(stormkit::UInt32 x, stormkit::UInt32 y) -> void {
156+
auto App::createCell(stormkit::u32 x, stormkit::u32 y) -> void {
157157
auto e = m_entities.make_entity();
158158
auto& position = m_entities.add_component<PositionComponent>(e);
159159

examples/entities/gameoflife/src/App.mpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,14 @@ export {
3131
App();
3232
~App() override;
3333

34-
auto run(const int argc, const char** argv) -> stormkit::Int32 override;
34+
auto run(const int argc, CZString argv[]) -> stormkit::i32 override;
3535

3636
private:
37-
auto doInitWindow() -> void;
37+
auto do_initWindow() -> void;
3838

3939
auto handleKeyboard(const stormkit::wsi::KeyReleasedEventData& event) -> void;
4040
auto handleMouse(const stormkit::wsi::MouseButtonPushedEventData& event) -> void;
41-
auto createCell(stormkit::UInt32 x, stormkit::UInt32 y) -> void;
41+
auto createCell(stormkit::u32 x, stormkit::u32 y) -> void;
4242

4343
std::unique_ptr<stormkit::wsi::Window> m_window;
4444

examples/entities/gameoflife/src/Components.mpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ export {
1717
#endif
1818

1919
struct PositionComponent: public stormkit::entities::Component {
20-
stormkit::UInt32 x;
21-
stormkit::UInt32 y;
20+
stormkit::u32 x;
21+
stormkit::u32 y;
2222

2323
static constexpr Type TYPE = stormkit::entities::component_hash("PositionComponent");
2424
};

examples/entities/gameoflife/src/Constants.mpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import std;
99

1010
import stormkit.core;
1111
import stormkit.log;
12-
import stormkit.Gpu;
12+
import stormkit.gpu;
1313

1414
export {
1515
#else
@@ -30,11 +30,11 @@ export {
3030
inline constexpr auto MESH_VERTEX_ATTRIBUTE_DESCRIPTIONS = std::array {
3131
stormkit::gpu::VertexInputAttributeDescription { .location = 0,
3232
.binding = 0,
33-
.format = stormkit::gpu::format::Float2,
33+
.format = stormkit::gpu::format::f322,
3434
.offset = 0 },
3535
stormkit::gpu::VertexInputAttributeDescription { .location = 1,
3636
.binding = 0,
37-
.format = stormkit::gpu::format::Float2,
37+
.format = stormkit::gpu::format::f322,
3838
.offset
3939
= sizeof(stormkit::math::Vector2F) }
4040
};

0 commit comments

Comments
 (0)