Skip to content

Commit aacbc22

Browse files
committed
Progress towards 0.2.0
1 parent 76607ae commit aacbc22

25 files changed

Lines changed: 399 additions & 348 deletions

.clang-format

Lines changed: 39 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -9,53 +9,61 @@ AlignConsecutiveAssignments:
99
AcrossEmptyLines: false
1010
AcrossComments: false
1111
AlignCompound: false
12+
AlignFunctionDeclarations: false
1213
AlignFunctionPointers: false
1314
PadOperators: true
1415
AlignConsecutiveBitFields:
1516
Enabled: false
1617
AcrossEmptyLines: false
1718
AcrossComments: false
1819
AlignCompound: false
20+
AlignFunctionDeclarations: false
1921
AlignFunctionPointers: false
2022
PadOperators: true
2123
AlignConsecutiveDeclarations:
2224
Enabled: false
2325
AcrossEmptyLines: false
2426
AcrossComments: false
2527
AlignCompound: false
28+
AlignFunctionDeclarations: true
2629
AlignFunctionPointers: false
2730
PadOperators: true
2831
AlignConsecutiveMacros:
2932
Enabled: false
3033
AcrossEmptyLines: false
3134
AcrossComments: false
3235
AlignCompound: false
36+
AlignFunctionDeclarations: false
3337
AlignFunctionPointers: false
3438
PadOperators: true
3539
AlignConsecutiveShortCaseStatements:
3640
Enabled: false
3741
AcrossEmptyLines: false
3842
AcrossComments: false
43+
AlignCaseArrows: false
3944
AlignCaseColons: false
4045
AlignConsecutiveTableGenBreakingDAGArgColons:
4146
Enabled: false
4247
AcrossEmptyLines: false
4348
AcrossComments: false
4449
AlignCompound: false
50+
AlignFunctionDeclarations: false
4551
AlignFunctionPointers: false
4652
PadOperators: true
4753
AlignConsecutiveTableGenCondOperatorColons:
4854
Enabled: false
4955
AcrossEmptyLines: false
5056
AcrossComments: false
5157
AlignCompound: false
58+
AlignFunctionDeclarations: false
5259
AlignFunctionPointers: false
5360
PadOperators: true
5461
AlignConsecutiveTableGenDefinitionColons:
5562
Enabled: false
5663
AcrossEmptyLines: false
5764
AcrossComments: false
5865
AlignCompound: false
66+
AlignFunctionDeclarations: false
5967
AlignFunctionPointers: false
6068
PadOperators: true
6169
AlignEscapedNewlines: DontAlign
@@ -75,22 +83,26 @@ AllowShortFunctionsOnASingleLine: Empty
7583
AllowShortIfStatementsOnASingleLine: WithoutElse
7684
AllowShortLambdasOnASingleLine: Inline
7785
AllowShortLoopsOnASingleLine: false
86+
AllowShortNamespacesOnASingleLine: false
87+
AlwaysBreakAfterDefinitionReturnType: None
7888
AlwaysBreakBeforeMultilineStrings: false
7989
#AttributeMacros:
8090
BinPackArguments: false
91+
#BinPackLongBracedList: true
8192
BinPackParameters: OnePerLine
8293
BitFieldColonSpacing: Both
94+
BracedInitializerIndentWidth: 4
8395
BraceWrapping:
8496
AfterCaseLabel: true
8597
AfterClass: true
8698
AfterControlStatement: Always
8799
AfterEnum: true
100+
AfterExternBlock: true
88101
AfterFunction: true
89102
AfterNamespace: true
90103
AfterObjCDeclaration: true
91104
AfterStruct: true
92105
AfterUnion: true
93-
AfterExternBlock: true
94106
BeforeCatch: false
95107
BeforeElse: false
96108
BeforeLambdaBody: false
@@ -99,16 +111,16 @@ BraceWrapping:
99111
SplitEmptyFunction: false
100112
SplitEmptyRecord: false
101113
SplitEmptyNamespace: false
102-
BracedInitializerIndentWidth: 4
103114
BreakAdjacentStringLiterals: true
104115
BreakAfterAttributes: Leave
105116
BreakAfterJavaFieldAnnotations: true
106117
BreakAfterReturnType: Automatic
107118
BreakArrays: false
108119
BreakBeforeBinaryOperators: None
109-
BreakBeforeBraces: Custom
110120
BreakBeforeConceptDeclarations: Never
121+
BreakBeforeBraces: Custom
111122
BreakBeforeInlineASMColon: OnlyMultiline
123+
#BreakBeforeTemplateCloser: false
112124
BreakBeforeTernaryOperators: true
113125
BreakBinaryOperations: RespectPrecedence
114126
BreakConstructorInitializers: AfterColon
@@ -126,22 +138,31 @@ DerivePointerAlignment: false
126138
DisableFormat: false
127139
EmptyLineAfterAccessModifier: Leave
128140
EmptyLineBeforeAccessModifier: LogicalBlock
141+
#EnumTrailingComma: Leave
142+
ExperimentalAutoDetectBinPacking: false
129143
FixNamespaceComments: true
130144
#ForEachMacros:
131145
#IfMacros:
132146
IncludeBlocks: Merge
133147
IncludeCategories:
134148
- Regex: '^<.*'
135149
Priority: 1
150+
SortPriority: 0
151+
CaseSensitive: false
136152
- Regex: '^".*'
137153
Priority: 2
154+
SortPriority: 0
155+
CaseSensitive: false
138156
- Regex: '.*'
139157
Priority: 3
158+
SortPriority: 0
159+
CaseSensitive: false
140160
IncludeIsMainRegex: '^$'
141-
#IncludeIsMainSourceRegex:
161+
IncludeIsMainSourceRegex: ''
142162
IndentAccessModifiers: true
143163
IndentCaseBlocks: false
144164
IndentCaseLabels: true
165+
IndentExportBlock: true
145166
IndentExternBlock: NoIndent
146167
IndentGotoLabels: false
147168
IndentPPDirectives: None
@@ -158,43 +179,41 @@ IntegerLiteralSeparator:
158179
DecimalMinDigits: 0
159180
Hex: 0
160181
HexMinDigits: 0
161-
#JavaImportGroups:
162182
JavaScriptQuotes: Double
163183
JavaScriptWrapImports: true
164184
KeepEmptyLines:
165185
AtEndOfFile: false
166186
AtStartOfBlock: false
167187
AtStartOfFile: false
168-
#KeepFormFeed is in the documentation but is not recognized here
188+
KeepFormFeed: false
169189
LambdaBodyIndentation: Signature
170190
LineEnding: LF
171-
#MacroBlockBegin:
172-
#MacroBlockEnd:
173-
#Macros:
191+
MacroBlockBegin: ''
192+
MacroBlockEnd: ''
174193
MainIncludeChar: Quote
175194
MaxEmptyLinesToKeep: 2
176195
NamespaceIndentation: Inner
177-
#NamespaceMacros:
178196
ObjCBinPackProtocolList: Auto
179197
ObjCBlockIndentWidth: 4
180198
ObjCBreakBeforeNestedBlockParam: false
181-
#ObjCPropertyAttributeOrder:
182199
ObjCSpaceAfterProperty: false
183200
ObjCSpaceBeforeProtocolList: false
184-
PPIndentWidth: -1
201+
#OneLineFormatOffRegex: ''
185202
PackConstructorInitializers: CurrentLine
186203
PenaltyBreakAssignment: 10000
187204
PenaltyBreakBeforeFirstCallParameter: 5000
205+
PenaltyBreakBeforeMemberAccess: 1000
188206
#PenaltyBreakComment:
189207
#PenaltyBreakFirstLessLess:
190208
PenaltyBreakOpenParenthesis: 700
191-
#PenaltyBreakScopeResolution:
209+
PenaltyBreakScopeResolution: 800
192210
PenaltyBreakString: 100
193211
PenaltyBreakTemplateDeclaration: 100
194212
#PenaltyExcessCharacter:
195213
#PenaltyIndentedWhitespace:
196214
PenaltyReturnTypeOnItsOwnLine: 2000
197215
PointerAlignment: Right
216+
PPIndentWidth: -1
198217
QualifierAlignment: Custom
199218
QualifierOrder:
200219
- static
@@ -205,10 +224,10 @@ QualifierOrder:
205224
- const
206225
- restrict
207226
- type
208-
#RawStringFormats:
209227
ReferenceAlignment: Pointer
210-
ReflowComments: false
211-
#RemoveEmptyLinesInUnwrappedLines is in the documentation but is not recognized here
228+
ReflowComments: Never
229+
RemoveBracesLLVM: false
230+
RemoveEmptyLinesInUnwrappedLines: true
212231
RemoveParentheses: Leave
213232
RemoveSemicolon: false
214233
RequiresClausePosition: SingleLine
@@ -221,6 +240,7 @@ SortJavaStaticImport: Before
221240
SortUsingDeclarations: Lexicographic
222241
SpaceAfterCStyleCast: false
223242
SpaceAfterLogicalNot: false
243+
#SpaceAfterOperatorKeyword: false
224244
SpaceAfterTemplateKeyword: false
225245
SpaceAroundPointerQualifiers: Default
226246
SpaceBeforeAssignmentOperators: true
@@ -244,12 +264,9 @@ SpacesInSquareBrackets: false
244264
Standard: Auto
245265
#StatementAttributeLikeMacros:
246266
#StatementMacros:
247-
TabWidth: 4
248267
TableGenBreakInsideDAGArg: DontBreak
249-
#TableGenBreakingDAGArgOperators:
250-
#TemplateNames is in the documentation but is not recognized here
251-
#TypeNames:
252-
#TypenameMacros:
268+
TabWidth: 4
253269
UseTab: Never
254270
VerilogBreakBetweenInstancePorts: true
255-
#WhitespaceSensitiveMacros:
271+
#WhitespaceSensitiveMacros:
272+
WrapNamespaceBodyWithEmptyLines: Leave

.clang-tidy

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ cppcoreguidelines-*,
2424
-cppcoreguidelines-prefer-member-initializer,
2525
-cppcoreguidelines-pro-bounds-array-to-pointer-decay,
2626
-cppcoreguidelines-pro-bounds-pointer-arithmetic,
27+
-cppcoreguidelines-pro-type-const-cast,
2728
-cppcoreguidelines-pro-type-reinterpret-cast,
2829
-cppcoreguidelines-pro-type-union-access,
2930
-cppcoreguidelines-special-member-functions,

CMakeLists.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,8 @@ add_library(Luna STATIC
6969
include/luna/lunaDrawing.h
7070
include/luna/lunaImage.h
7171
include/luna/lunaInstance.h
72-
include/luna/lunaPipeline.h
73-
include/luna/lunaRenderPass.h
7472
include/luna/lunaTypes.h
73+
include/luna/lunaBuffer.h
7574
)
7675
target_compile_options(Luna PRIVATE $<IF:$<CONFIG:Debug>,${DEBUG_FLAGS},${RELEASE_FLAGS}>)
7776
target_link_libraries(Luna PUBLIC _LunaInternal_PublicDependencies)

example/helloTriangle.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,6 @@
33
//
44

55
#include <luna/luna.h>
6-
#include <luna/lunaDevice.h>
7-
#include <luna/lunaDrawing.h>
8-
#include <luna/lunaInstance.h>
9-
#include <luna/lunaPipeline.h>
10-
#include <luna/lunaRenderPass.h>
11-
#include <luna/lunaTypes.h>
126
#include <SDL3/SDL_events.h>
137
#include <SDL3/SDL_init.h>
148
#include <SDL3/SDL_scancode.h>

example/lunaCube.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,6 @@
55
#include <cglm/cglm.h>
66
#include <lodepng.h>
77
#include <luna/luna.h>
8-
#include <luna/lunaDevice.h>
9-
#include <luna/lunaDrawing.h>
10-
#include <luna/lunaImage.h>
11-
#include <luna/lunaInstance.h>
12-
#include <luna/lunaPipeline.h>
13-
#include <luna/lunaRenderPass.h>
14-
#include <luna/lunaTypes.h>
158
#include <SDL3/SDL_events.h>
169
#include <SDL3/SDL_init.h>
1710
#include <SDL3/SDL_scancode.h>

include/luna/luna.h

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,17 @@ extern "C"
1010
{
1111
#endif
1212

13-
#include <luna/lunaDevice.h> // NOLINT(*-include-cleaner)
14-
#include <luna/lunaDrawing.h> // NOLINT(*-include-cleaner)
15-
#include <luna/lunaImage.h> // NOLINT(*-include-cleaner)
16-
#include <luna/lunaInstance.h> // NOLINT(*-include-cleaner)
17-
#include <luna/lunaPipeline.h> // NOLINT(*-include-cleaner)
18-
#include <luna/lunaRenderPass.h> // NOLINT(*-include-cleaner)
13+
// NOLINTBEGIN(*-include-cleaner)
14+
#include <luna/lunaBuffer.h>
15+
#include <luna/lunaDevice.h>
16+
#include <luna/lunaDrawing.h>
17+
#include <luna/lunaImage.h>
18+
#include <luna/lunaInstance.h>
1919
#include <luna/lunaTypes.h>
2020
#include <stddef.h>
2121
#include <stdint.h>
2222
#include <vulkan/vulkan_core.h>
23+
// NOLINTEND(*-include-cleaner)
2324

2425
VkResult lunaCreateDescriptorPool(const LunaDescriptorPoolCreationInfo *creationInfo,
2526
LunaDescriptorPool *descriptorPool);
@@ -32,12 +33,8 @@ void lunaDestroyDescriptorSet(LunaDescriptorSet descriptorSet);
3233

3334
VkResult lunaCreateShaderModule(const LunaShaderModuleCreationInfo *creationInfo, LunaShaderModule *shaderModule);
3435

35-
VkResult lunaAllocateBuffer(const LunaBufferCreationInfo *creationInfo);
36-
VkResult lunaCreateBuffer(const LunaBufferCreationInfo *creationInfo, LunaBuffer *buffer);
37-
VkResult lunaCreateBuffers(uint32_t count, const LunaBufferCreationInfo *creationInfos, LunaBuffer **buffers);
38-
void lunaDestroyBuffer(LunaBuffer buffer);
39-
VkResult lunaResizeBuffer(LunaBuffer buffer, VkDeviceSize newSize);
40-
void lunaWriteDataToBuffer(LunaBuffer buffer, const void *data, size_t bytes, size_t offset);
36+
VkResult lunaCreateGraphicsPipeline(const LunaGraphicsPipelineCreationInfo *creationInfo,
37+
LunaGraphicsPipeline *pipeline);
4138

4239
VkResult lunaCreateCommandPool(const LunaCommandPoolCreationInfo *creationInfo, LunaCommandPool *commandPool);
4340
VkResult lunaResetCommandPool(LunaCommandPool commandPool, VkCommandPoolResetFlagBits flags);

include/luna/lunaBuffer.h

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
//
2+
// Created by NBT22 on 9/26/25.
3+
//
4+
5+
#ifndef LUNA_LUNABUFFER_H
6+
#define LUNA_LUNABUFFER_H
7+
8+
#ifdef __cplusplus
9+
extern "C"
10+
{
11+
#endif
12+
13+
#include <luna/lunaTypes.h>
14+
#include <stddef.h>
15+
#include <stdint.h>
16+
#include <vulkan/vulkan_core.h>
17+
18+
VkResult lunaCreateBuffer(const LunaBufferCreationInfo *creationInfo, LunaBuffer *buffer);
19+
VkResult lunaCreateBuffers(uint32_t count, const LunaBufferCreationInfo *creationInfos, LunaBuffer **buffers);
20+
21+
void lunaDestroyBuffer(LunaBuffer buffer);
22+
23+
VkResult lunaResizeBuffer(LunaBuffer *buffer, VkDeviceSize newSize);
24+
25+
void lunaWriteDataToBuffer(LunaBuffer buffer, const void *data, size_t bytes, size_t offset);
26+
27+
LunaBufferCreationInfo lunaBufferGetCreationInfo(LunaBuffer buffer);
28+
29+
#ifdef __cplusplus
30+
}
31+
#endif
32+
33+
#endif //LUNA_LUNABUFFER_H

include/luna/lunaDrawing.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,14 @@ extern "C"
1414
#include <stdint.h>
1515
#include <vulkan/vulkan_core.h>
1616

17+
VkResult lunaCreateRenderPass(const LunaRenderPassCreationInfo *creationInfo, LunaRenderPass *renderPass);
18+
VkResult lunaCreateRenderPass2(const LunaRenderPassCreationInfo2 *creationInfo, LunaRenderPass *renderPass);
19+
LunaRenderPassSubpass lunaGetRenderPassSubpassByName(LunaRenderPass renderPass, const char *name);
20+
21+
VkResult lunaBeginRenderPass(LunaRenderPass renderPass, const LunaRenderPassBeginInfo *beginInfo);
22+
void lunaNextSubpass(void);
23+
void lunaEndRenderPass(void);
24+
1725
void lunaBindVertexBuffers(uint32_t firstBinding,
1826
uint32_t bindingCount,
1927
const LunaBuffer *buffers,
@@ -76,7 +84,9 @@ VkResult lunaDrawBufferIndexedIndirectCount(LunaBuffer vertexBuffer,
7684

7785
// TODO: This should take a pipeline layout, but those don't exist yet
7886
void lunaBindDescriptorSets(LunaGraphicsPipeline pipeline, const LunaDescriptorSetBindInfo *bindInfo);
87+
7988
VkResult lunaPushConstants(LunaGraphicsPipeline pipeline);
89+
8090
VkResult lunaResizeSwapchain(uint32_t renderPassResizeInfoCount,
8191
const LunaRenderPassResizeInfo *renderPassResizeInfos,
8292
const VkExtent2D *targetExtent,

include/luna/lunaInstance.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ extern "C"
1111
#endif
1212

1313
#include <luna/lunaTypes.h>
14-
#include <stdbool.h>
1514
#include <stdint.h>
1615
#include <vulkan/vulkan_core.h>
1716

0 commit comments

Comments
 (0)