From 32d26371627638570b74d678ab73deb7b87af8e4 Mon Sep 17 00:00:00 2001 From: skal Date: Sat, 31 Jan 2026 17:23:13 +0100 Subject: fix: Cross-compilation and style compliance Fixes seq_compiler build for Windows cross-compilation. Moves common WebGPU compatibility shims to gpu.h. Applies project-wide coding style via clang-format. Verified on both macOS (native) and Windows (cross-compile). --- src/gpu/gpu.h | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) (limited to 'src/gpu/gpu.h') diff --git a/src/gpu/gpu.h b/src/gpu/gpu.h index dd4fbd7..8aa290a 100644 --- a/src/gpu/gpu.h +++ b/src/gpu/gpu.h @@ -13,19 +13,27 @@ #include #include using WGPUStringView = const char *; -static inline const char *str_view(const char *str) { return str; } -static inline const char *label_view(const char *str) { return str; } +static inline const char *str_view(const char *str) { + return str; +} +static inline const char *label_view(const char *str) { + return str; +} +#define WGPUSType_ShaderSourceWGSL WGPUSType_ShaderModuleWGSLDescriptor +using WGPUShaderSourceWGSL = WGPUShaderModuleWGSLDescriptor; #else // Native (macOS/Linux) using newer wgpu-native #include #include static inline WGPUStringView str_view(const char *str) { - if (!str) return {nullptr, 0}; + if (!str) + return {nullptr, 0}; return {str, strlen(str)}; } static inline WGPUStringView label_view(const char *str) { #ifndef STRIP_ALL - if (!str) return {nullptr, 0}; + if (!str) + return {nullptr, 0}; return {str, strlen(str)}; #else (void)str; @@ -78,7 +86,8 @@ GpuBuffer gpu_create_buffer(WGPUDevice device, size_t size, uint32_t usage, ComputePass gpu_create_compute_pass(WGPUDevice device, const char *shader_code, ResourceBinding *bindings, int num_bindings); -RenderPass gpu_create_render_pass(WGPUDevice device, - WGPUTextureFormat format, // Needed for render pipeline - const char *shader_code, - ResourceBinding *bindings, int num_bindings); +RenderPass +gpu_create_render_pass(WGPUDevice device, + WGPUTextureFormat format, // Needed for render pipeline + const char *shader_code, ResourceBinding *bindings, + int num_bindings); -- cgit v1.2.3