From a30a9878fe083240dbd98ae4ca93339cd8a8d667 Mon Sep 17 00:00:00 2001 From: skal Date: Tue, 17 Feb 2026 11:00:51 +0100 Subject: fix(build): Resolve Windows cross-compilation failures This commit fixes several issues that caused the Windows cross-compilation build (`scripts/build_win.sh`) to fail. The root causes were platform-specific API differences in the wgpu-native library and incorrect dependency tracking in the CMake build system for generated code. Changes: - **`tools/seq_compiler.py`**: The timeline generator now wraps `depthSlice` assignments in `#if !defined(DEMO_CROSS_COMPILE_WIN32)` directives to handle API differences in `WGPURenderPassColorAttachment`. - **`src/gpu/gpu.h`**: The `gpu_init_color_attachment` helper is now platform-aware, using a preprocessor guard for the `depthSlice` member. - **`src/effects/*.cc`**: All effects are updated to use the new platform-aware helper or have explicit guards for `depthSlice`. Also, replaced `WGPUTexelCopyTextureInfo` with the cross-platform alias `GpuTextureCopyInfo` in `rotating_cube_effect.cc`. - **`cmake`**: Added `tools/seq_compiler.py` as an explicit dependency to the `generate_timeline` and `generate_test_demo_timeline` custom commands. This ensures that changes to the generator script correctly trigger a rebuild of the generated C++ files. - **`scripts/build_win.sh`**: Removed the erroneous attempt to build the `seq_compiler.py` script as a native executable. With these changes, the Windows cross-compilation build now completes successfully. --- tools/seq_compiler.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'tools/seq_compiler.py') diff --git a/tools/seq_compiler.py b/tools/seq_compiler.py index fc07f84..8c92996 100755 --- a/tools/seq_compiler.py +++ b/tools/seq_compiler.py @@ -640,7 +640,9 @@ 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}; @@ -665,7 +667,9 @@ void RenderTimeline(WGPUSurface surface, float time, int width, int height, blit_attach.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}; -- cgit v1.2.3