Skip to content

Commit c66425b

Browse files
committed
WIP: cleanup gpu, update zgui, zflecs, bgfx.
1 parent b4de573 commit c66425b

File tree

438 files changed

+121865
-80221
lines changed

Some content is hidden

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

438 files changed

+121865
-80221
lines changed

.generate_ide.zon

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@
66
.{ .name = "CETech1 Tests", .program = "zig-out/bin/cetech1_test", .args = .{} },
77
.{ .name = "CETech1 Tests UI", .args = .{"--test-ui"} },
88
.{ .name = "CETech1 Tests UI (headless)", .args = .{ "--test-ui", "--headless", "--test-ui-junit", "./result.xml" } },
9-
.{ .name = "CETech1 (Vulkan)", .args = .{ "--asset-root", "fixtures/test_asset/", "--renderer", "vulkan" } },
9+
.{ .name = "CETech1 (Vulkan)", .args = .{ "--asset-root", "fixtures/test_asset/", "--renderer", "bgfx_vulkan" } },
1010
},
1111
}

.github/workflows/test.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ jobs:
120120
x86-64-macos:
121121
needs: ["validation"]
122122
name: x86-64 Macos
123-
runs-on: macos-13-large # macos-latest
123+
runs-on: macos-15-large # macos-latest
124124
timeout-minutes: 10
125125
steps:
126126
- name: Checkout

.lldbinit-template

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
command script import <CHANGE_ME_TO_REPODIR>/zig/tools/lldb_pretty_printers.py
2-
type category enable zig
1+
command script import <CHANGE_ME_TO_REPODIR>/lldb_pretty_printers.py
2+
type category enable zig.lang
33
type category enable zig.std

build.zig.zon

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.{
22
.name = .cetech1_kernel,
33
.version = "0.1.0",
4-
.minimum_zig_version = "0.15.1",
4+
.minimum_zig_version = "0.15.2",
55
.fingerprint = 0x999557f3ebfaa97a,
66
.paths = .{
77
"docs",
@@ -80,6 +80,7 @@
8080
.system_sdk = .{
8181
.url = "https://github.com/zig-gamedev/system_sdk/archive/c0dbf11cdc17da5904ea8a17eadc54dee26567ec.tar.gz",
8282
.hash = "system_sdk-0.3.0-dev-alwUNnYaaAJAtIdE2fg4NQfDqEKs7QCXy_qYukAOBfmF",
83+
.lazy = true,
8384
},
8485
.zglfw = .{ .path = "externals/shared/lib/zglfw" },
8586
.zflecs = .{ .path = "externals/shared/lib/zflecs" },

docs/topics/getting-started.md

Lines changed: 53 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -84,22 +84,23 @@ Get ZIG `0.15.1`.
8484
> Bool arguments does not need value 1 for true value. ex.: `--fullscreen` is equal `--fullscreen 1`
8585
> {style="note"}
8686
87-
| Args | Value | Default | Description |
88-
|--------------------------|--------------------------------|-----------|---------------------------------------------|
89-
| `--load-dynamic` | `1` or `0` | `1` | Load dynamic modules? |
90-
| `--max-kernel-tick` | `n` | `null` | Quit after kernel make n ticks. |
91-
| `--max-kernel-tick-rate` | `n` | `60` | Kernel frame rate. |
92-
| `--headless` | `1` or `0` | `0` | Without creating real window. |
93-
| `--asset-root` | `str` | `null` | Path to asset root. (project path) |
94-
| `--renderer-debug` | `1` or `0` | `0` | Render backed debug. (shaders) |
95-
| `--renderer-profile` | `1` or `0` | `0` | Render backed profile. (shaders) |
96-
| `--vsync` | `1` or `0` | `0` | Vsync. |
97-
| `--fullscreen` | `1` or `0` | `0` | Force full-screen mode, nice for SteamDeck. |
98-
| `--worker-count` | number | cpu count | Max threads for task system. |
99-
| `--test-ui` | `1` or `0` | `0` | Run UI tests and quit. |
100-
| `--test-ui-filter` | `str` | `all` | Run only ui tests that pass this filter. |
101-
| `--test-ui-speed` | `fast`, `normal`, `cinematic` | `fast` | UI test speed. |
102-
| `--test-ui-junit` | `str` | `null` | UI test JUnit result filename. |
87+
| Args | Value | Default | Description |
88+
|--------------------------|-------------------------------------------------------|-----------------|---------------------------------------------|
89+
| `--asset-root` | `str` | `null` | Path to asset root. (project path) |
90+
| `--load-dynamic` | `1` or `0` | `1` | Load dynamic modules? |
91+
| `--max-kernel-tick` | `n` | `null` | Quit after kernel make n ticks. |
92+
| `--max-kernel-tick-rate` | `n` | `60` | Kernel frame rate. |
93+
| `--worker-count` | number | CPU count | Max threads for task system. |
94+
| `--renderer` | `bgfx_metal`, `bgfx_vulkan`, `bgfx_dx12`, `bgfx_noop` | Autoselect best | Render backed. |
95+
| `--renderer-debug` | `1` or `0` | `0` | Render backed debug. (shaders) |
96+
| `--renderer-profile` | `1` or `0` | `0` | Render backed profile. (shaders) |
97+
| `--headless` | `1` or `0` | `0` | Without creating real window. |
98+
| `--vsync` | `1` or `0` | `0` | Vsync. |
99+
| `--fullscreen` | `1` or `0` | `0` | Force full-screen mode, nice for SteamDeck. |
100+
| `--test-ui` | `1` or `0` | `0` | Run UI tests and quit. |
101+
| `--test-ui-filter` | `str` | `all` | Run only ui tests that pass this filter. |
102+
| `--test-ui-speed` | `fast`, `normal`, `cinematic` | `fast` | UI test speed. |
103+
| `--test-ui-junit` | `str` | `null` | UI test JUnit result filename. |
103104

104105
## ZLS
105106

@@ -122,40 +123,6 @@ CETech provide ZLS as submodule, but you must build it.
122123
</tab>
123124
</tabs>
124125

125-
## VSCode
126-
127-
> Repository contain recommended extension.
128-
129-
1. Create vscode configs.
130-
<code-block lang="bash">
131-
# This generate vscode launch.json with predefined cases
132-
# create or update settings.json
133-
# and set zls path to locally builded
134-
zig build gen-ide -Dide=vscode
135-
</code-block>
136-
2. Install extension `ziglang.vscode-zig` (or install all recommended)
137-
138-
## Fleet
139-
140-
1. Create fleet configs.
141-
<code-block lang="bash">
142-
# This generate fleet run.json with predefined cases
143-
# create or update settings.json
144-
# and set zls path to locally builded
145-
zig build gen-ide -Dide=fleet
146-
</code-block>
147-
148-
## Idea
149-
150-
Need [zigbrains](https://plugins.jetbrains.com/plugin/22456-zigbrains)
151-
152-
1. Create idea configs.
153-
<code-block lang="bash">
154-
# This generate basic files in .idea and run configuration predefined cases
155-
# and set zls path to locally builded
156-
zig build gen-ide -Dide=idea
157-
</code-block>
158-
159126
## Tracy profiler
160127

161128
CETech1 has builtin support for tracy profiler and provide Tracy as submodule, but you must build it first.
@@ -168,15 +135,15 @@ CETech1 has builtin support for tracy profiler and provide Tracy as submodule, b
168135
git submodule update --init externals/shared/repo/tracy
169136
cd externals/shared/repo/tracy
170137
cmake -B profiler/build -S profiler -DCMAKE_BUILD_TYPE=Release
171-
make -C profiler/build
138+
cmake --build profiler/build --parallel --config Release
172139
</code-block>
173140
</tab>
174141
<tab title="Windows">
175142
<code-block lang="bash">
176143
git submodule update --init externals/shared/repo/tracy
177144
cd externals/shared/repo/tracy
178145
cmake -B profiler/build -S profiler -DCMAKE_BUILD_TYPE=Release
179-
make -C profiler/build
146+
cmake --build profiler/build --parallel --config Release
180147
</code-block>
181148
</tab>
182149
</tabs>
@@ -198,3 +165,37 @@ CETech1 has builtin support for tracy profiler and provide Tracy as submodule, b
198165
</code-block>
199166
</tab>
200167
</tabs>
168+
169+
## VSCode
170+
171+
> Repository contain recommended extension.
172+
173+
1. Create vscode configs.
174+
<code-block lang="bash">
175+
# This generate vscode launch.json with predefined cases
176+
# create or update settings.json
177+
# and set zls path to locally builded
178+
zig build gen-ide -Dide=vscode
179+
</code-block>
180+
2. Install extension `ziglang.vscode-zig` (or install all recommended)
181+
182+
## Fleet
183+
184+
1. Create fleet configs.
185+
<code-block lang="bash">
186+
# This generate fleet run.json with predefined cases
187+
# create or update settings.json
188+
# and set zls path to locally builded
189+
zig build gen-ide -Dide=fleet
190+
</code-block>
191+
192+
## Idea
193+
194+
Need [zigbrains](https://plugins.jetbrains.com/plugin/22456-zigbrains)
195+
196+
1. Create idea configs.
197+
<code-block lang="bash">
198+
# This generate basic files in .idea and run configuration predefined cases
199+
# and set zls path to locally builded
200+
zig build gen-ide -Dide=idea
201+
</code-block>

examples/editor_foo_tab/src/private.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ const FooTab = struct {
4040
// Fill editor tab interface
4141
var foo_tab = editor.TabTypeI.implement(editor.TabTypeIArgs{
4242
.tab_name = TAB_NAME,
43-
.tab_hash = cetech1.strId32(TAB_NAME),
43+
.tab_hash = .fromStr(TAB_NAME),
4444
.category = "Examples",
4545
}, struct {
4646

examples/editor_foo_viewport_tab/src/private.zig

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ var _apidb: *const cetech1.apidb.ApiDbAPI = undefined;
4444
var _log: *const cetech1.log.LogAPI = undefined;
4545
var _cdb: *const cdb.CdbAPI = undefined;
4646
var _coreui: *const coreui.CoreUIApi = undefined;
47-
var _gpu: *const gpu.GpuApi = undefined;
47+
4848
var _render_graph: *const render_graph.RenderGraphApi = undefined;
4949
var _kernel: *const cetech1.kernel.KernelApi = undefined;
5050
var _ecs: *const ecs.EcsAPI = undefined;
@@ -159,13 +159,13 @@ const move_system_i = ecs.SystemI.implement(
159159

160160
// Rendering component
161161

162-
const ECS_WORLD_CONTEXT = cetech1.strId32("ecs_world_context");
163-
const ECS_ENTITY_CONTEXT = cetech1.strId32("ecs_entity_context");
162+
const ECS_WORLD_CONTEXT = .fromStr("ecs_world_context");
163+
const ECS_ENTITY_CONTEXT = .fromStr("ecs_entity_context");
164164

165165
// Fill editor tab interface
166166
var foo_tab = editor.TabTypeI.implement(editor.TabTypeIArgs{
167167
.tab_name = TAB_NAME,
168-
.tab_hash = cetech1.strId32(TAB_NAME),
168+
.tab_hash = .fromStr(TAB_NAME),
169169
.category = "Examples",
170170
}, struct {
171171

@@ -192,17 +192,19 @@ var foo_tab = editor.TabTypeI.implement(editor.TabTypeIArgs{
192192
_ = w.setId(transform.Rotation, camera_ent, &transform.Rotation{});
193193
_ = w.setId(camera.Camera, camera_ent, &camera.Camera{});
194194

195+
const gpu_backend = _kernel.getGpuBackend().?;
195196
var tab_inst = _allocator.create(FooViewportTab) catch undefined;
196197
tab_inst.* = .{
197198
.viewport = try _render_viewport.createViewport(
198199
name,
200+
gpu_backend,
199201
w,
200202
camera_ent,
201203
),
202204
.camera_ent = camera_ent,
203205
.world = w,
204206

205-
.render_pipeline = try _render_pipeline.createDefault(_allocator, w),
207+
.render_pipeline = try _render_pipeline.createDefault(_allocator, gpu_backend, w),
206208
.tab_i = .{
207209
.vt = _g.test_tab_vt_ptr,
208210
.inst = @ptrCast(tab_inst),
@@ -424,7 +426,7 @@ pub fn load_module_zig(apidb: *const cetech1.apidb.ApiDbAPI, allocator: Allocato
424426
_apidb = apidb;
425427
_cdb = apidb.getZigApi(module_name, cdb.CdbAPI).?;
426428
_coreui = apidb.getZigApi(module_name, coreui.CoreUIApi).?;
427-
_gpu = apidb.getZigApi(module_name, gpu.GpuApi).?;
429+
428430
_render_graph = apidb.getZigApi(module_name, render_graph.RenderGraphApi).?;
429431
_kernel = apidb.getZigApi(module_name, cetech1.kernel.KernelApi).?;
430432
_ecs = apidb.getZigApi(module_name, ecs.EcsAPI).?;

examples/foo/src/private.zig

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -140,15 +140,15 @@ var update_task = cetech1.kernel.KernelTaskUpdateI.implment(
140140
var update_task2 = cetech1.kernel.KernelTaskUpdateI.implment(
141141
cetech1.kernel.OnUpdate,
142142
"FooUpdate2",
143-
&[_]cetech1.StrId64{cetech1.strId64("FooUpdate")},
143+
&[_]cetech1.StrId64{.fromStr("FooUpdate")},
144144
null,
145145
KernelTask,
146146
);
147147

148148
var update_task3 = cetech1.kernel.KernelTaskUpdateI.implment(
149149
cetech1.kernel.OnUpdate,
150150
"FooUpdate3",
151-
&[_]cetech1.StrId64{cetech1.strId64("FooUpdate2")},
151+
&[_]cetech1.StrId64{.fromStr("FooUpdate2")},
152152
null,
153153
KernelTask,
154154
);
@@ -157,8 +157,8 @@ var update_task4 = cetech1.kernel.KernelTaskUpdateI.implment(
157157
cetech1.kernel.OnUpdate,
158158
"FooUpdate4",
159159
&[_]cetech1.StrId64{
160-
cetech1.strId64("FooUpdate2"),
161-
cetech1.strId64("FooUpdate"),
160+
.fromStr("FooUpdate2"),
161+
.fromStr("FooUpdate"),
162162
},
163163
null,
164164
KernelTask,
@@ -168,7 +168,7 @@ var update_task5 = cetech1.kernel.KernelTaskUpdateI.implment(
168168
cetech1.kernel.OnStore,
169169
"FooUpdate5",
170170
&[_]cetech1.StrId64{
171-
//cetech1.strId64("FooUpdate4"),
171+
//.fromStr("FooUpdate4"),
172172
},
173173
null,
174174
KernelTask,
@@ -177,7 +177,7 @@ var update_task6 = cetech1.kernel.KernelTaskUpdateI.implment(
177177
cetech1.kernel.OnStore,
178178
"FooUpdate6",
179179
&[_]cetech1.StrId64{
180-
//cetech1.strId64("FooUpdate5"),
180+
//.fromStr("FooUpdate5"),
181181
},
182182
null,
183183
KernelTask,
@@ -186,7 +186,7 @@ var update_task7 = cetech1.kernel.KernelTaskUpdateI.implment(
186186
cetech1.kernel.OnStore,
187187
"FooUpdate7",
188188
&[_]cetech1.StrId64{
189-
//cetech1.strId64("FooUpdate5"),
189+
//.fromStr("FooUpdate5"),
190190
},
191191
null,
192192
KernelTask,
@@ -195,7 +195,7 @@ var update_task8 = cetech1.kernel.KernelTaskUpdateI.implment(
195195
cetech1.kernel.OnStore,
196196
"FooUpdate8",
197197
&[_]cetech1.StrId64{
198-
//cetech1.strId64("FooUpdate7"),
198+
//.fromStr("FooUpdate7"),
199199
},
200200
null,
201201
KernelTask,

externals/shared/lib/SDL_GameControllerDB/README.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,6 @@ Third party cross-platform tool with GUI (Windows, macOS and Linux)
4141
### [SDL](https://github.com/libsdl-org/SDL/releases/latest)
4242
[testcontroller (SDL3)](https://github.com/libsdl-org/SDL/blob/main/test/testcontroller.c) and [controllermap (SDL2)](https://github.com/libsdl-org/SDL/blob/SDL2/test/controllermap.c) utilities are the official tools to create these mappings on all SDL supported platforms (Windows, Mac, Linux, iOS, Android, etc).
4343

44-
```
45-
"SDL_GamepadBind" "030000004c050000c405000000010000,PS4 Controller,platform:Windows,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,"
46-
```
47-
4844
## Resources
4945

5046
### [SDL2](https://wiki.libsdl.org/SDL2/)

0 commit comments

Comments
 (0)