diff options
| author | skal <pascal.massimino@gmail.com> | 2026-01-31 17:23:13 +0100 |
|---|---|---|
| committer | skal <pascal.massimino@gmail.com> | 2026-01-31 17:23:13 +0100 |
| commit | 32d26371627638570b74d678ab73deb7b87af8e4 (patch) | |
| tree | 3097b3678086ddaed7930a02e5c88464f1c7d03e /src/gpu/gpu.h | |
| parent | 7ec28a3f1d417cd5b5adead895a25e42035ef037 (diff) | |
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).
Diffstat (limited to 'src/gpu/gpu.h')
| -rw-r--r-- | src/gpu/gpu.h | 25 |
1 files changed, 17 insertions, 8 deletions
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 <webgpu/webgpu.h> #include <webgpu/wgpu.h> 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 <webgpu.h> #include <wgpu.h> 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); |
