Skip to content

Commit b3fe37a

Browse files
committed
feat: add support for direct functions (instead of API structs)
1 parent ecc35d7 commit b3fe37a

120 files changed

Lines changed: 6102 additions & 3134 deletions

File tree

Some content is hidden

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

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ A template application can be found [here](https://git.pilotlight.tech/pilotligh
4545
* <ins>libs</ins> - Contains standalone "stb-style" libraries that can be used in other projects.
4646
* <ins>build</ins> - Contains a lightweight python-based build system used for this project.
4747
* <ins>editor</ins> - Contains janky code used for development & eventual editor.
48+
* <ins>retired</ins> - Contains old code I may still find helpful.
4849
* <ins>scripts</ins> - Contains helper scripts for various things.
4950
* <ins>shaders</ins> - Contains shader code.
5051
* <ins>src</ins> - Contains the small core of Pilot Light.

docs/changelog.txt

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,26 @@
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.0 (2026-04-16)
8+
- v0.9.0 (2026-04-21) (core) -added support for direct functions! (see example_basic_2.c)
9+
(starter v1.4.0) -performance improvements for resizing
10+
(screen log v2.2.0) -add flags for hiding messages
11+
(window v1.2.0) -expose experimental features (must be checked by user)
12+
(build v1.5.0) -automatically add "lib" to unix libraries(BREAKING)
13+
(string int.v2.0.0) -remove "string" from function names(BREAKING)
14+
(profile v2.0.0) -rename macros (BREAKING, SEE FILE)
15+
(log v2.0.0) -rename macros (BREAKING, SEE FILE)
16+
(rect pack v2.0.0) -rename function from "pack_rects" to "pack" (BREAKING)
17+
(atomics v2.0.0) -rename functions (BREAKING, SEE FILE)
18+
(camera) -add reverse Z orthographic camera
19+
(math) -rename double structs
20+
(stage) -add resource staging extension
21+
(imgui) -update imgui & implot versions
22+
(renderer) -fix CSM calculations
23+
-shader performance improvements
24+
-fix many environment probe issues
25+
-remove finalize scene workflow
26+
-improve internal resource usages
27+
-fix PCF calculations
928
- v0.8.0 (2026-03-06) (graphics v1.7.2) -expose color write mask for stencil buffer
1029
-fix copy buffer issues in vulkan backend
1130
(draw v2.0.0) -re-combined draw & draw extensions

docs/version.txt

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

33
-----------------------------------------------------------------------------
44
Versioning
@@ -37,7 +37,7 @@ the API is complete. It just means we won't break what currently exists.
3737
* Memory v1.1.3 (pl.h)
3838
* Extension Registry v1.1.0 (pl.h)
3939
* IO v1.1.1 (pl.h)
40-
* Window v1.1.0 (pl.h)
40+
* Window v1.2.0 (pl.h)
4141
* Library v1.0.2 (pl.h)
4242

4343
## Libraries
@@ -53,36 +53,36 @@ the API is complete. It just means we won't break what currently exists.
5353

5454
## Stable Extensions
5555

56-
* Log v1.0.0 (pl_log_ext.h)
57-
* Config v1.1.0 (pl_config_ext.h)
58-
* Console v1.0.0 (pl_console_ext.h)
59-
* Draw v2.0.0 (pl_draw_ext.h)
60-
* DXT v1.0.0 (pl_dxt_ext.h)
61-
* GPU Allocators v1.0.0 (pl_gpu_allocators_ext.h)
62-
* Graphics v1.7.2 (pl_graphics_ext.h)
63-
* Image v1.1.0 (pl_image_ext.h)
64-
* Job v2.2.0 (pl_job_ext.h)
65-
* Atomics v1.0.0 (pl_platform_ext.h)
56+
* Log v2.0.0 (pl_log_ext.h)
57+
* Config v1.2.0 (pl_config_ext.h)
58+
* Console v1.1.0 (pl_console_ext.h)
59+
* Draw v2.1.0 (pl_draw_ext.h)
60+
* DXT v1.1.0 (pl_dxt_ext.h)
61+
* GPU Allocators v1.1.0 (pl_gpu_allocators_ext.h)
62+
* Graphics v1.8.0 (pl_graphics_ext.h)
63+
* Image v1.2.0 (pl_image_ext.h)
64+
* Job v2.3.0 (pl_job_ext.h)
65+
* Atomics v2.0.0 (pl_platform_ext.h)
6666
* File v1.1.0 (pl_platform_ext.h)
6767
* Network v1.0.0 (pl_platform_ext.h)
6868
* Threads v1.0.1 (pl_platform_ext.h)
6969
* Virtual Memory v1.0.0 (pl_platform_ext.h)
70-
* Profile v1.0.0 (pl_profile_ext.h)
71-
* Rectangle Packing v1.0.0 (pl_rect_pack_ext.h)
72-
* Screen Log v2.1.0 (pl_screen_log_ext.h)
73-
* Shader v1.3.0 (pl_shader_ext.h)
74-
* Starter v1.3.4 (pl_starter_ext.h)
75-
* Stats v1.0.0 (pl_stats_ext.h)
70+
* Profile v2.0.0 (pl_profile_ext.h)
71+
* Rectangle Packing v1.1.0 (pl_rect_pack_ext.h)
72+
* Screen Log v2.2.0 (pl_screen_log_ext.h)
73+
* Shader v1.4.0 (pl_shader_ext.h)
74+
* Starter v1.4.0 (pl_starter_ext.h)
75+
* Stats v1.1.0 (pl_stats_ext.h)
7676
* String Interning v2.0.0 (pl_string_intern_ext.h)
77-
* UI Tools v1.0.0 (pl_tools_ext.h)
78-
* UI v1.0.0 (pl_ui_ext.h)
79-
* Pak Files v1.1.0 (pl_pak_ext.h)
80-
* Date & Time v1.0.1 (pl_datetime_ext.h)
81-
* Compression v1.0.0 (pl_compress_ext.h)
82-
* Virtual File System v2.0.0 (pl_vfs_ext.h)
83-
* ECS v1.0.0 (pl_ecs_ext.h)
84-
* DDS v1.0.0 (pl_dds_ext.h)
85-
* Resource v1.4.0 (pl_resource_ext.h)
77+
* UI Tools v1.1.0 (pl_tools_ext.h)
78+
* UI v1.1.0 (pl_ui_ext.h)
79+
* Pak Files v1.2.0 (pl_pak_ext.h)
80+
* Date & Time v1.1.0 (pl_datetime_ext.h)
81+
* Compression v1.1.0 (pl_compress_ext.h)
82+
* Virtual File System v2.1.0 (pl_vfs_ext.h)
83+
* ECS v1.1.0 (pl_ecs_ext.h)
84+
* DDS v1.1.0 (pl_dds_ext.h)
85+
* Resource v1.5.0 (pl_resource_ext.h)
8686

8787
## Nearly Stable Extensions
8888

editor/app.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -623,7 +623,7 @@ pl_app_update(plAppData* ptAppData)
623623
if(!gptStarter->begin_frame())
624624
return;
625625

626-
pl_begin_cpu_sample(gptProfile, 0, __FUNCTION__);
626+
PL_PROFILE_BEGIN_SAMPLE_API(gptProfile, 0, __FUNCTION__);
627627

628628
gptResource->new_frame();
629629

@@ -684,7 +684,7 @@ pl_app_update(plAppData* ptAppData)
684684
}
685685

686686
// run ecs system
687-
pl_begin_cpu_sample(gptProfile, 0, "Run ECS");
687+
PL_PROFILE_BEGIN_SAMPLE_API(gptProfile, 0, "Run ECS");
688688
gptScript->run_update_system(ptAppData->ptComponentLibrary);
689689
gptAnimation->run_animation_update_system(ptAppData->ptComponentLibrary, ptIO->fDeltaTime);
690690
gptPhysics->update(ptIO->fDeltaTime, ptAppData->ptComponentLibrary);
@@ -696,7 +696,7 @@ pl_app_update(plAppData* ptAppData)
696696
gptRenderer->run_skin_update_system(ptAppData->ptComponentLibrary);
697697
gptRenderer->run_object_update_system(ptAppData->ptComponentLibrary);
698698
gptRenderer->run_environment_probe_update_system(ptAppData->ptComponentLibrary); // run after object update
699-
pl_end_cpu_sample(gptProfile, 0);
699+
PL_PROFILE_END_SAMPLE_API(gptProfile, 0);
700700

701701
plEntity tNextEntity = {0};
702702
if(gptRenderer->get_hovered_entity(ptAppData->ptView, &tNextEntity))
@@ -723,7 +723,7 @@ pl_app_update(plAppData* ptAppData)
723723

724724
if(ptAppData->bShowEntityWindow)
725725
{
726-
if(gptEcsTools->show_ecs_window(ptAppData->ptComponentLibrary, &ptAppData->tSelectedEntity, ptAppData->ptScene, &ptAppData->bShowEntityWindow))
726+
if(gptEcsTools->show_window(ptAppData->ptComponentLibrary, &ptAppData->tSelectedEntity, ptAppData->ptScene, &ptAppData->bShowEntityWindow))
727727
{
728728
if(ptAppData->tSelectedEntity.uData == UINT64_MAX)
729729
{
@@ -867,7 +867,7 @@ pl_app_update(plAppData* ptAppData)
867867

868868
plRenderEncoder* ptRenderEncoder = gptStarter->begin_main_pass();
869869
gptStarter->end_main_pass();
870-
pl_end_cpu_sample(gptProfile, 0);
870+
PL_PROFILE_END_SAMPLE_API(gptProfile, 0);
871871
gptStarter->end_frame();
872872
}
873873

@@ -1154,7 +1154,8 @@ pl__show_editor_window(plAppData* ptAppData)
11541154

11551155
if(gptUI->begin_collapsing_header(ICON_FA_BOXES_STACKED " Physics", 0))
11561156
{
1157-
plPhysicsEngineSettings tPhysicsSettings = gptPhysics->get_settings();
1157+
plPhysicsEngineSettings tPhysicsSettings = {0};
1158+
gptPhysics->get_settings(&tPhysicsSettings);
11581159

11591160
gptUI->checkbox("Enabled", &tPhysicsSettings.bEnabled);
11601161
gptUI->checkbox("Debug Draw", &ptAppData->bPhysicsDebugDraw);

editor/editor.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ pl_app_update(plAppData* ptAppData)
397397
if(!gptStarter->begin_frame())
398398
return;
399399

400-
pl_begin_cpu_sample(gptProfile, 0, __FUNCTION__);
400+
PL_PROFILE_BEGIN_SAMPLE_API(gptProfile, 0, __FUNCTION__);
401401

402402
gptResource->new_frame();
403403

@@ -450,7 +450,6 @@ pl_app_update(plAppData* ptAppData)
450450
}
451451

452452
// run ecs system
453-
pl_begin_cpu_sample(gptProfile, 0, "Run ECS");
454453
gptScript->run_update_system(ptAppData->ptCompLibrary);
455454
gptAnimation->run_animation_update_system(ptAppData->ptCompLibrary, ptIO->fDeltaTime);
456455
gptPhysics->update(ptIO->fDeltaTime, ptAppData->ptCompLibrary);
@@ -462,7 +461,6 @@ pl_app_update(plAppData* ptAppData)
462461
gptRenderer->run_skin_update_system(ptAppData->ptCompLibrary);
463462
gptRenderer->run_object_update_system(ptAppData->ptCompLibrary);
464463
gptRenderer->run_environment_probe_update_system(ptAppData->ptCompLibrary); // run after object update
465-
pl_end_cpu_sample(gptProfile, 0);
466464

467465
plEntity tNextEntity = {0};
468466
if(gptRenderer->get_hovered_entity(ptAppData->ptView, &tNextEntity))
@@ -489,7 +487,7 @@ pl_app_update(plAppData* ptAppData)
489487

490488
if(ptAppData->bShowEntityWindow)
491489
{
492-
if(gptEcsTools->show_ecs_window(ptAppData->ptCompLibrary, &ptAppData->tSelectedEntity, ptAppData->ptScene, &ptAppData->bShowEntityWindow))
490+
if(gptEcsTools->show_window(ptAppData->ptCompLibrary, &ptAppData->tSelectedEntity, ptAppData->ptScene, &ptAppData->bShowEntityWindow))
493491
{
494492
if(ptAppData->tSelectedEntity.uData == UINT64_MAX)
495493
{
@@ -750,7 +748,7 @@ pl_app_update(plAppData* ptAppData)
750748
plDrawList2D* ptMessageDrawlist = gptScreenLog->get_drawlist(tLogOffset.x, tLogOffset.y, fWidth * 0.2f, fHeight);
751749
gptDraw->submit_2d_drawlist(ptMessageDrawlist, ptRenderEncoder, fWidth, fHeight, gptGfx->get_swapchain_info(gptStarter->get_swapchain()).tSampleCount);
752750
gptStarter->end_main_pass();
753-
pl_end_cpu_sample(gptProfile, 0);
751+
PL_PROFILE_END_SAMPLE_API(gptProfile, 0);
754752
gptStarter->end_frame();
755753
}
756754

@@ -1277,7 +1275,8 @@ pl__show_editor_window(plAppData* ptAppData)
12771275

12781276
if(ImGui::CollapsingHeader(ICON_FA_BOXES_STACKED " Physics", 0))
12791277
{
1280-
plPhysicsEngineSettings tPhysicsSettings = gptPhysics->get_settings();
1278+
plPhysicsEngineSettings tPhysicsSettings = {};
1279+
gptPhysics->get_settings(&tPhysicsSettings);
12811280

12821281
ImGui::Checkbox("Enabled", &tPhysicsSettings.bEnabled);
12831282
ImGui::Checkbox("Debug Draw", &ptAppData->bPhysicsDebugDraw);

examples/README.md

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -32,17 +32,26 @@ pilot_light -a example_gfx_2
3232

3333
## Basic Examples
3434

35-
### Example 0 - Minimal App (example_basic_0.c)
35+
### Example 0 - Minimal App With API Registry (example_basic_0.c)
3636
Demonstrates the bare minimum app. This app loads, runs 50 iterations of the update function (printing to console), then exits. Note: this app is not really meant to run. It is for reference.
3737

38-
### Example 1 - API Loading (example_basic_1.c)
38+
### Example 1 - API Loading With API Registry (example_basic_1.c)
3939
Note: this app is not really meant to run. It is for reference.
4040
Demonstrates:
4141
* loading APIs
4242
* hot reloading
4343

4444
### Example 2 - Starter & Basic Extensions (example_basic_2.c)
4545
Demonstrates:
46+
* loading extensions
47+
* starter extension
48+
* basic drawing extension (2D)
49+
* basic screen log extension
50+
* basic console extension
51+
* basic UI extension
52+
53+
### Example 3 - Starter & Basic Extensions With API Registry (example_basic_3.c)
54+
Demonstrates:
4655
* loading APIs
4756
* loading extensions
4857
* starter extension
@@ -51,49 +60,41 @@ Demonstrates:
5160
* basic console extension
5261
* basic UI extension
5362

54-
### Example 3 - Draw Extension (example_basic_3.c)
63+
### Example 4 - Draw Extension With API Registry (example_basic_4.c)
5564
Demonstrates:
5665
* loading APIs
5766
* loading extensions
5867
* drawing extension (2D)
5968

60-
### Example 4 - UI Extension (example_basic_4.c)
69+
### Example 5 - UI Extension With API Registry (example_basic_5.c)
6170
Demonstrates:
6271
* loading APIs
6372
* loading extensions
6473
* hot reloading
6574
* ui extension
6675

67-
### Example 5 - Dear ImGui (example_basic_5.c)
76+
### Example 6 - Dear ImGui With API Registry (example_basic_6.c)
6877
Demonstrates:
6978
* Dear ImGui integration
7079

71-
### Example 2 - Starter & Draw & Collision (example_basic_6.c)
72-
Demonstrates:
73-
* loading APIs
74-
* loading extensions
75-
* starter extension
76-
* basic drawing extension (3D)
77-
* basic screen log extension
78-
* collision extension
7980

8081
## Low Level Graphics Examples
8182

82-
### Example 0 - Graphics Extension 0 (example_gfx_0.c)
83+
### Example 0 - Graphics Extension 0 With API Registry (example_gfx_0.c)
8384
Demonstrates:
8485
* vertex buffers
8586
* shaders
8687
* non-index drawing
8788

88-
### Example 1 - Graphics Extension 1 (example_gfx_1.c)
89+
### Example 1 - Graphics Extension 1 With API Registry (example_gfx_1.c)
8990
Demonstrates:
9091
* vertex buffers
9192
* index buffers
9293
* staging buffers
9394
* shaders
9495
* indexed drawing
9596

96-
### Example 2 - Graphics Extension 2 (example_gfx_2.c)
97+
### Example 2 - Graphics Extension 2 With API Registry (example_gfx_2.c)
9798
Demonstrates:
9899
* bind groups
99100
* vertex, index, staging buffers
@@ -102,12 +103,12 @@ Demonstrates:
102103
* indexed drawing
103104
* image extension
104105

105-
### Example 3 - Graphics Extension 3 (example_gfx_3.c)
106+
### Example 3 - Graphics Extension 3 With API Registry (example_gfx_3.c)
106107
Demonstrates:
107108
* starter extension
108109
* drawing extension (2D & 3D)
109110

110-
### Example 4 - Graphics Extension 4 (example_gfx_4.c)
111+
### Example 4 - Graphics Extension 4 With API Registry (example_gfx_4.c)
111112
Demonstrates:
112113
* starter extension
113114
* render passes

0 commit comments

Comments
 (0)