Skip to content

Commit 9bf7c32

Browse files
committed
WIP 0
1 parent 131c897 commit 9bf7c32

49 files changed

Lines changed: 5769 additions & 7351 deletions

Some content is hidden

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

.github/workflows/build.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434

3535
- name: Install Dependencies
3636
run: |
37-
Invoke-WebRequest -Uri "https://sdk.lunarg.com/sdk/download/1.3.296.0/windows/VulkanSDK-1.3.296.0-Installer.exe" -OutFile VulkanSDK.exe
37+
Invoke-WebRequest -Uri "https://sdk.lunarg.com/sdk/download/1.4.350.0/windows/vulkansdk-windows-X64-1.4.350.0.exe" -OutFile VulkanSDK.exe
3838
# ./VulkanSDK.exe --help
3939
./VulkanSDK.exe --accept-licenses --default-answer --root D:/a/VulkanSDK --confirm-command install
4040
@@ -136,9 +136,9 @@ jobs:
136136

137137
- name: Install Dependencies
138138
run: |
139-
curl https://sdk.lunarg.com/sdk/download/1.3.283.0/mac/vulkansdk-macos-1.3.283.0.dmg -o vk.dmg
140-
hdiutil attach vk.dmg
141-
sudo /Volumes/vulkansdk-macos-1.3.283.0/InstallVulkan.app/Contents/MacOS/InstallVulkan --root ~/VulkanSDK/1.3.283.0 --accept-licenses --default-answer --confirm-command install com.lunarg.vulkan.core com.lunarg.vulkan.usr com.lunarg.vulkan.sdl2 com.lunarg.vulkan.glm com.lunarg.vulkan.volk com.lunarg.vulkan.vma com.lunarg.vulkan.ios
139+
curl https://sdk.lunarg.com/sdk/download/1.4.350.0/mac/vulkansdk-macos-1.4.350.0.zip -o vk.zip
140+
unzip vk.zip
141+
sudo ./vulkansdk-macOS-1.4.350.0.app/Contents/MacOS/vulkansdk-macOS-1.4.350.0 --root ~/VulkanSDK/1.4.350.0 --accept-licenses --default-answer --confirm-command install com.lunarg.vulkan.core com.lunarg.vulkan.usr com.lunarg.vulkan.sdl2 com.lunarg.vulkan.glm com.lunarg.vulkan.volk com.lunarg.vulkan.vma com.lunarg.vulkan.ios
142142
143143
- name: Prep 1
144144
run: |

docs/changelog.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
Below is the change log for typical users. Minor and older changes stripped
66
away, please see git history for details.
77

8-
- v0.9.3 (2026-06-02)(graphics v1.10.0) -last version before 2.x with breaking changes
8+
- v0.10.0 (xx-xx-xx)
9+
- v0.9.3 (2026-06-02)(graphics v1.10.0) -last version before 2.x with breaking changes
910
-remove necessity of subpass dependencies
1011
-remove necessity of "set_texture_usage(...)"
1112
(camera v1.0.1) -fix camera zero init issues

docs/version.txt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
v0.9.3
1+
v0.10.0 WIP
22

33
-----------------------------------------------------------------------------
44
Versioning
@@ -56,10 +56,10 @@ the API is complete. It just means we won't break what currently exists.
5656
* Log v2.0.0 (pl_log_ext.h)
5757
* Config v1.2.0 (pl_config_ext.h)
5858
* Console v1.1.0 (pl_console_ext.h)
59-
* Draw v2.1.1 (pl_draw_ext.h)
59+
* Draw v3.0.0 (pl_draw_ext.h)
6060
* DXT v1.1.0 (pl_dxt_ext.h)
6161
* GPU Allocators v1.1.1 (pl_gpu_allocators_ext.h)
62-
* Graphics v1.10.0 (pl_graphics_ext.h)
62+
* Graphics v2.0.0 (pl_graphics_ext.h)
6363
* Image v1.2.0 (pl_image_ext.h)
6464
* Job v2.3.0 (pl_job_ext.h)
6565
* Atomics v2.0.0 (pl_platform_ext.h)
@@ -71,7 +71,7 @@ the API is complete. It just means we won't break what currently exists.
7171
* Rectangle Packing v1.1.0 (pl_rect_pack_ext.h)
7272
* Screen Log v2.2.0 (pl_screen_log_ext.h)
7373
* Shader v1.4.0 (pl_shader_ext.h)
74-
* Starter v1.4.1 (pl_starter_ext.h)
74+
* Starter v2.0.0 (pl_starter_ext.h)
7575
* Stats v1.1.0 (pl_stats_ext.h)
7676
* String Interning v2.0.0 (pl_string_intern_ext.h)
7777
* UI Tools v1.1.0 (pl_tools_ext.h)
@@ -100,13 +100,13 @@ the API is complete. It just means we won't break what currently exists.
100100
* Camera ECS v0.1.0 (pl_camera_ext.h)
101101
* Gizmo v0.1.0 (pl_gizmo_ext.h)
102102
* Model Loader v0.3.0 (pl_model_loader_ext.h)
103-
* Dear ImGui v0.1.0 (pl_dear_imgui_ext.h)
103+
* Dear ImGui v0.2.0 (pl_dear_imgui_ext.h)
104104
* Animation v0.1.0 (pl_animation_ext.h)
105105
* Material v0.1.0 (pl_material_ext.h)
106106
* Terrain v0.1.0 (pl_terrain_ext.h)
107107
* Free List v0.1.0 (pl_freelist_ext.h)
108108
* Image Ops v0.1.0 (pl_image_ops_ext.h)
109-
* Stage v0.1.0 (pl_stage_ext.h)
109+
* Stage v0.2.0 (pl_stage_ext.h)
110110
* Renderer v0.3.0 (pl_renderer_ext.h)
111111
* Renderer Terrain v0.1.0 (pl_renderer_ext.h)
112112
* Renderer Ecs v0.1.0 (pl_renderer_ext.h)

examples/example_basic_4.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -384,11 +384,13 @@ pl_app_update(plAppData* ptAppData)
384384
// the scope of the draw extension.
385385

386386
// start main pass & return the encoder being used
387-
plRenderEncoder* ptEncoder = gptStarter->begin_main_pass();
387+
plCommandBuffer* ptCmdBuffer = gptStarter->begin_main_pass();
388388

389389
// submit our drawlist
390390
plIO* ptIO = gptIO->get_io();
391-
gptDraw->submit_2d_drawlist(ptAppData->ptDrawlist, ptEncoder, ptIO->tMainViewportSize.x, ptIO->tMainViewportSize.y, 1);
391+
plRenderAttachmentInfo tRenderAttachmentInfo = {0};
392+
gptStarter->get_render_attachment_info(&tRenderAttachmentInfo);
393+
gptDraw->submit_2d_drawlist(ptAppData->ptDrawlist, ptCmdBuffer, ptIO->tMainViewportSize.x, ptIO->tMainViewportSize.y, 1, &tRenderAttachmentInfo);
392394

393395
// allows the starter extension to handle some things then ends the main pass
394396
gptStarter->end_main_pass();

examples/example_basic_5.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ Index of this file:
4545
#include "pl_ui_ext.h"
4646
#include "pl_draw_ext.h"
4747
#include "pl_starter_ext.h"
48+
#include "pl_graphics_ext.h"
4849

4950
//-----------------------------------------------------------------------------
5051
// [SECTION] structs
@@ -220,7 +221,7 @@ pl_app_update(plAppData* ptAppData)
220221
// the scope of the draw extension.
221222

222223
// start main pass & return the encoder being used
223-
plRenderEncoder* ptEncoder = gptStarter->begin_main_pass();
224+
plCommandBuffer* ptCmdBuffer = gptStarter->begin_main_pass();
224225

225226
// this must be called which handles several things but
226227
// most importantly it orders the various draw layers in
@@ -230,8 +231,10 @@ pl_app_update(plAppData* ptAppData)
230231
// now we must submit both the drawlist & debug drawlist provided by
231232
// the UI extension.
232233
plVec2 tViewportSize = gptIO->get_io()->tMainViewportSize;
233-
gptDraw->submit_2d_drawlist(gptUi->get_draw_list(), ptEncoder, tViewportSize.x, tViewportSize.y, 1);
234-
gptDraw->submit_2d_drawlist(gptUi->get_debug_draw_list(), ptEncoder, tViewportSize.x, tViewportSize.y, 1);
234+
plRenderAttachmentInfo tRenderAttachmentInfo = {0};
235+
gptStarter->get_render_attachment_info(&tRenderAttachmentInfo);
236+
gptDraw->submit_2d_drawlist(gptUi->get_draw_list(), ptCmdBuffer, tViewportSize.x, tViewportSize.y, 1, &tRenderAttachmentInfo);
237+
gptDraw->submit_2d_drawlist(gptUi->get_debug_draw_list(), ptCmdBuffer, tViewportSize.x, tViewportSize.y, 1, &tRenderAttachmentInfo);
235238

236239
// allows the starter extension to handle some things then ends the main pass
237240
gptStarter->end_main_pass();

examples/example_basic_6.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,9 @@ pl_app_load(plApiRegistryI* ptApiRegistry, plAppData* ptAppData)
187187
gptStarter->finalize();
188188

189189
// initializes out Dear ImGui backend
190-
gptDearImGui->initialize(gptStarter->get_device(), gptStarter->get_swapchain(), gptStarter->get_render_pass());
190+
plRenderAttachmentInfo tRenderAttachmentInfo = {};
191+
gptStarter->get_render_attachment_info(&tRenderAttachmentInfo);
192+
gptDearImGui->initialize(gptStarter->get_device(), gptStarter->get_swapchain(), &tRenderAttachmentInfo);
191193

192194
// same process for implot as imgui
193195
ImPlot::SetCurrentContext((ImPlotContext*)ptDataRegistry->get_data("implot"));
@@ -233,7 +235,7 @@ pl_app_update(plAppData* ptAppData)
233235
if(!gptStarter->begin_frame())
234236
return;
235237

236-
gptDearImGui->new_frame(gptStarter->get_device(), gptStarter->get_render_pass());
238+
gptDearImGui->new_frame(gptStarter->get_device());
237239

238240
ImGui::DockSpaceOverViewport();
239241

@@ -253,10 +255,10 @@ pl_app_update(plAppData* ptAppData)
253255

254256

255257
// start main pass & return the encoder being used
256-
plRenderEncoder* ptEncoder = gptStarter->begin_main_pass();
258+
plCommandBuffer* ptCommandBuffer = gptStarter->begin_main_pass();
257259

258260
// submit Dear ImGui stuff
259-
gptDearImGui->render(ptEncoder, gptGfx->get_encoder_command_buffer(ptEncoder));
261+
gptDearImGui->render(ptCommandBuffer);
260262

261263
// allows the starter extension to handle some things then ends the main pass
262264
gptStarter->end_main_pass();

examples/example_gfx_0.c

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ pl_app_load(plApiRegistryI* ptApiRegistry, plAppData* ptAppData)
216216

217217
// create vertex buffer
218218
const plBufferDesc tBufferDesc = {
219-
.tUsage = PL_BUFFER_USAGE_VERTEX | PL_BUFFER_USAGE_TRANSFER_DESTINATION,
219+
.eUsage = PL_BUFFER_USAGE_VERTEX | PL_BUFFER_USAGE_TRANSFER,
220220
.szByteSize = sizeof(float) * PL_ARRAYSIZE(atVertexData),
221221
.pcDebugName = "vertex buffer"
222222
};
@@ -244,26 +244,26 @@ pl_app_load(plApiRegistryI* ptApiRegistry, plAppData* ptAppData)
244244

245245
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~shaders~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
246246

247-
const plShaderDesc tShaderDesc = {
247+
plShaderDesc tShaderDesc = {
248248
.tVertexShader = gptShader->load_glsl("example_gfx_0.vert", "main", NULL, NULL),
249249
.tFragmentShader = gptShader->load_glsl("example_gfx_0.frag", "main", NULL, NULL),
250250
.tGraphicsState = {
251-
.ulDepthWriteEnabled = 0,
252-
.ulDepthMode = PL_COMPARE_MODE_ALWAYS,
253-
.ulCullMode = PL_CULL_MODE_NONE,
254-
.ulWireframe = 0,
255-
.ulStencilMode = PL_COMPARE_MODE_ALWAYS,
256-
.ulStencilRef = 0xff,
257-
.ulStencilMask = 0xff,
258-
.ulStencilOpFail = PL_STENCIL_OP_KEEP,
259-
.ulStencilOpDepthFail = PL_STENCIL_OP_KEEP,
260-
.ulStencilOpPass = PL_STENCIL_OP_KEEP
251+
.bDepthWriteEnabled = 0,
252+
.eDepthMode = PL_COMPARE_MODE_ALWAYS,
253+
.eCullMode = PL_CULL_MODE_NONE,
254+
.bWireframe = 0,
255+
.eStencilMode = PL_COMPARE_MODE_ALWAYS,
256+
.uStencilRef = 0xff,
257+
.uStencilMask = 0xff,
258+
.eStencilOpFail = PL_STENCIL_OP_KEEP,
259+
.eStencilOpDepthFail = PL_STENCIL_OP_KEEP,
260+
.eStencilOpPass = PL_STENCIL_OP_KEEP
261261
},
262262
.atVertexBufferLayouts = {
263263
{
264264
.atAttributes = {
265-
{.tFormat = PL_VERTEX_FORMAT_FLOAT2 },
266-
{.tFormat = PL_VERTEX_FORMAT_FLOAT4 },
265+
{.eFormat = PL_VERTEX_FORMAT_FLOAT2 },
266+
{.eFormat = PL_VERTEX_FORMAT_FLOAT4 },
267267
}
268268
}
269269
},
@@ -272,9 +272,9 @@ pl_app_load(plApiRegistryI* ptApiRegistry, plAppData* ptAppData)
272272
.bBlendEnabled = false,
273273
.uColorWriteMask = PL_COLOR_WRITE_MASK_ALL
274274
}
275-
},
276-
.tRenderPassLayout = gptStarter->get_render_pass_layout(),
275+
}
277276
};
277+
gptStarter->get_render_attachment_info(&tShaderDesc.tRenderAttachmentInfo);
278278
ptAppData->tShader = gptGfx->create_shader(ptDevice, &tShaderDesc);
279279

280280
// return app memory
@@ -323,17 +323,17 @@ pl_app_update(plAppData* ptAppData)
323323
return;
324324

325325
// start main pass & return the encoder being used
326-
plRenderEncoder* ptEncoder = gptStarter->begin_main_pass();
326+
plCommandBuffer* ptCmdBuffer = gptStarter->begin_main_pass();
327327

328328
// submit nonindexed draw using basic API
329-
gptGfx->bind_shader(ptEncoder, ptAppData->tShader);
330-
gptGfx->bind_vertex_buffer(ptEncoder, ptAppData->tVertexBuffer);
329+
gptGfx->bind_shader(ptCmdBuffer, ptAppData->tShader);
330+
gptGfx->bind_vertex_buffer(ptCmdBuffer, ptAppData->tVertexBuffer);
331331

332332
plDraw tDraw = {
333333
.uInstanceCount = 1,
334334
.uVertexCount = 3
335335
};
336-
gptGfx->draw(ptEncoder, 1, &tDraw);
336+
gptGfx->draw(ptCmdBuffer, 1, &tDraw);
337337

338338
// allows the starter extension to handle some things then ends the main pass
339339
gptStarter->end_main_pass();

examples/example_gfx_1.c

Lines changed: 29 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ pl_app_load(plApiRegistryI* ptApiRegistry, plAppData* ptAppData)
184184

185185
// create vertex buffer
186186
const plBufferDesc tVertexBufferDesc = {
187-
.tUsage = PL_BUFFER_USAGE_VERTEX | PL_BUFFER_USAGE_TRANSFER_DESTINATION,
187+
.eUsage = PL_BUFFER_USAGE_VERTEX | PL_BUFFER_USAGE_TRANSFER,
188188
.szByteSize = sizeof(float) * PL_ARRAYSIZE(atVertexData),
189189
.pcDebugName = "vertex buffer"
190190
};
@@ -213,7 +213,7 @@ pl_app_load(plApiRegistryI* ptApiRegistry, plAppData* ptAppData)
213213

214214
// create index buffer
215215
const plBufferDesc tIndexBufferDesc = {
216-
.tUsage = PL_BUFFER_USAGE_INDEX | PL_BUFFER_USAGE_TRANSFER_DESTINATION,
216+
.eUsage = PL_BUFFER_USAGE_INDEX | PL_BUFFER_USAGE_TRANSFER,
217217
.szByteSize = sizeof(uint32_t) * PL_ARRAYSIZE(atIndexData),
218218
.pcDebugName = "index buffer"
219219
};
@@ -236,7 +236,7 @@ pl_app_load(plApiRegistryI* ptApiRegistry, plAppData* ptAppData)
236236

237237
// create vertex buffer
238238
const plBufferDesc tStagingBufferDesc = {
239-
.tUsage = PL_BUFFER_USAGE_TRANSFER_SOURCE,
239+
.eUsage = PL_BUFFER_USAGE_TRANSFER,
240240
.szByteSize = 4096,
241241
.pcDebugName = "staging buffer"
242242
};
@@ -264,33 +264,36 @@ pl_app_load(plApiRegistryI* ptApiRegistry, plAppData* ptAppData)
264264
// begin blit pass, copy buffer, end pass
265265
// NOTE: we are using the starter extension to get a blit encoder, later examples we will
266266
// handle this ourselves
267-
plBlitEncoder* ptEncoder = gptStarter->get_blit_encoder();
268-
gptGfx->copy_buffer(ptEncoder, ptAppData->tStagingBuffer, ptAppData->tVertexBuffer, 0, 0, sizeof(float) * PL_ARRAYSIZE(atVertexData));
269-
gptGfx->copy_buffer(ptEncoder, ptAppData->tStagingBuffer, ptAppData->tIndexBuffer, 1024, 0, sizeof(uint32_t) * PL_ARRAYSIZE(atIndexData));
270-
gptStarter->return_blit_encoder(ptEncoder);
267+
268+
plCommandBuffer* ptCommandBuffer = gptStarter->get_temporary_command_buffer();
269+
gptGfx->begin_compute_pass(ptCommandBuffer, NULL);
270+
gptGfx->copy_buffer(ptCommandBuffer, ptAppData->tStagingBuffer, ptAppData->tVertexBuffer, 0, 0, sizeof(float) * PL_ARRAYSIZE(atVertexData));
271+
gptGfx->copy_buffer(ptCommandBuffer, ptAppData->tStagingBuffer, ptAppData->tIndexBuffer, 1024, 0, sizeof(uint32_t) * PL_ARRAYSIZE(atIndexData));
272+
gptGfx->end_compute_pass(ptCommandBuffer);
273+
gptStarter->submit_temporary_command_buffer(ptCommandBuffer);
271274

272275
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~shaders~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
273276

274-
const plShaderDesc tShaderDesc = {
277+
plShaderDesc tShaderDesc = {
275278
.tVertexShader = gptShader->load_glsl("example_gfx_0.vert", "main", NULL, NULL),
276279
.tFragmentShader = gptShader->load_glsl("example_gfx_0.frag", "main", NULL, NULL),
277280
.tGraphicsState = {
278-
.ulDepthWriteEnabled = 0,
279-
.ulDepthMode = PL_COMPARE_MODE_ALWAYS,
280-
.ulCullMode = PL_CULL_MODE_NONE,
281-
.ulWireframe = 0,
282-
.ulStencilMode = PL_COMPARE_MODE_ALWAYS,
283-
.ulStencilRef = 0xff,
284-
.ulStencilMask = 0xff,
285-
.ulStencilOpFail = PL_STENCIL_OP_KEEP,
286-
.ulStencilOpDepthFail = PL_STENCIL_OP_KEEP,
287-
.ulStencilOpPass = PL_STENCIL_OP_KEEP
281+
.bDepthWriteEnabled = 0,
282+
.eDepthMode = PL_COMPARE_MODE_ALWAYS,
283+
.eCullMode = PL_CULL_MODE_NONE,
284+
.bWireframe = 0,
285+
.eStencilMode = PL_COMPARE_MODE_ALWAYS,
286+
.uStencilRef = 0xff,
287+
.uStencilMask = 0xff,
288+
.eStencilOpFail = PL_STENCIL_OP_KEEP,
289+
.eStencilOpDepthFail = PL_STENCIL_OP_KEEP,
290+
.eStencilOpPass = PL_STENCIL_OP_KEEP
288291
},
289292
.atVertexBufferLayouts = {
290293
{
291294
.atAttributes = {
292-
{.tFormat = PL_VERTEX_FORMAT_FLOAT2},
293-
{.tFormat = PL_VERTEX_FORMAT_FLOAT4},
295+
{.eFormat = PL_VERTEX_FORMAT_FLOAT2},
296+
{.eFormat = PL_VERTEX_FORMAT_FLOAT4},
294297
}
295298
}
296299
},
@@ -299,9 +302,9 @@ pl_app_load(plApiRegistryI* ptApiRegistry, plAppData* ptAppData)
299302
.bBlendEnabled = false,
300303
.uColorWriteMask = PL_COLOR_WRITE_MASK_ALL
301304
}
302-
},
303-
.tRenderPassLayout = gptStarter->get_render_pass_layout(),
305+
}
304306
};
307+
gptStarter->get_render_attachment_info(&tShaderDesc.tRenderAttachmentInfo);
305308
ptAppData->tShader = gptGfx->create_shader(ptDevice, &tShaderDesc);
306309

307310
// return app memory
@@ -352,18 +355,18 @@ pl_app_update(plAppData* ptAppData)
352355
return;
353356

354357
// start main pass & return the encoder being used
355-
plRenderEncoder* ptEncoder = gptStarter->begin_main_pass();
358+
plCommandBuffer* ptCommandBuffer = gptStarter->begin_main_pass();
356359

357360
// submit nonindexed draw using basic API
358-
gptGfx->bind_shader(ptEncoder, ptAppData->tShader);
359-
gptGfx->bind_vertex_buffer(ptEncoder, ptAppData->tVertexBuffer);
361+
gptGfx->bind_shader(ptCommandBuffer, ptAppData->tShader);
362+
gptGfx->bind_vertex_buffer(ptCommandBuffer, ptAppData->tVertexBuffer);
360363

361364
const plDrawIndex tDraw = {
362365
.uInstanceCount = 1,
363366
.uIndexCount = 6,
364367
.tIndexBuffer = ptAppData->tIndexBuffer
365368
};
366-
gptGfx->draw_indexed(ptEncoder, 1, &tDraw);
369+
gptGfx->draw_indexed(ptCommandBuffer, 1, &tDraw);
367370

368371
// allows the starter extension to handle some things then ends the main pass
369372
gptStarter->end_main_pass();

0 commit comments

Comments
 (0)