summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorskal <pascal.massimino@gmail.com>2026-02-17 11:04:09 +0100
committerskal <pascal.massimino@gmail.com>2026-02-17 11:04:09 +0100
commit4a95bb4f59ee4e5f4fddf3f18c597e19f5bd98f8 (patch)
tree504f15a57d83c427e698d80a4e51d55921e2640e /tools
parenta30a9878fe083240dbd98ae4ca93339cd8a8d667 (diff)
refactor(codegen): Use gpu_init helper in seq_compiler.py
Refactors the timeline code generator (`tools/seq_compiler.py`) to use the `gpu_init_color_attachment` helper function from `src/gpu/gpu.h`. This change removes platform-specific `#if !defined(DEMO_CROSS_COMPILE_WIN32)` directives from the generated C++ files (`timeline.cc`, `test_timeline.cc`) and centralizes the platform-aware initialization logic within the existing helper function. The generated code is now cleaner and easier to maintain. Both native macOS and Windows cross-compilation builds are confirmed to be successful.
Diffstat (limited to 'tools')
-rwxr-xr-xtools/seq_compiler.py17
1 files changed, 3 insertions, 14 deletions
diff --git a/tools/seq_compiler.py b/tools/seq_compiler.py
index 8c92996..dec3ab1 100755
--- a/tools/seq_compiler.py
+++ b/tools/seq_compiler.py
@@ -639,13 +639,7 @@ void RenderTimeline(WGPUSurface surface, float time, int width, int height,
// Clear source
WGPURenderPassColorAttachment clear_attach = {};
- clear_attach.view = g_source_view;
- #if !defined(DEMO_CROSS_COMPILE_WIN32)
- clear_attach.depthSlice = WGPU_DEPTH_SLICE_UNDEFINED;
-#endif
- clear_attach.loadOp = WGPULoadOp_Clear;
- clear_attach.storeOp = WGPUStoreOp_Store;
- clear_attach.clearValue = {0.0, 0.0, 0.0, 1.0};
+ gpu_init_color_attachment(clear_attach, g_source_view);
WGPURenderPassDescriptor clear_desc = {};
clear_desc.colorAttachmentCount = 1;
@@ -664,15 +658,10 @@ void RenderTimeline(WGPUSurface surface, float time, int width, int height,
if (surface_texture.status == WGPUSurfaceGetCurrentTextureStatus_SuccessOptimal) {
WGPURenderPassColorAttachment blit_attach = {};
- blit_attach.view = surface_texture.texture
+ WGPUTextureView blit_view = surface_texture.texture
? wgpuTextureCreateView(surface_texture.texture, nullptr)
: nullptr;
- #if !defined(DEMO_CROSS_COMPILE_WIN32)
- blit_attach.depthSlice = WGPU_DEPTH_SLICE_UNDEFINED;
-#endif
- blit_attach.loadOp = WGPULoadOp_Clear;
- blit_attach.storeOp = WGPUStoreOp_Store;
- blit_attach.clearValue = {0.0, 0.0, 0.0, 1.0};
+ gpu_init_color_attachment(blit_attach, blit_view);
WGPURenderPassDescriptor blit_desc = {};
blit_desc.colorAttachmentCount = 1;