From 61139c8d9d655e07964d63ec1f5a091a7e8ab7d0 Mon Sep 17 00:00:00 2001 From: skal Date: Mon, 2 Feb 2026 09:28:28 +0100 Subject: refactor(platform): Encapsulate state in PlatformState struct - Replaced all global static variables in the platform layer with a single PlatformState struct. - Updated all platform function signatures to accept a pointer to this struct, making the implementation stateless and more modular. - Refactored main.cc, tests, and tools to instantiate and pass the PlatformState struct. - This improves code organization and removes scattered global state. --- src/gpu/gpu.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/gpu/gpu.h') diff --git a/src/gpu/gpu.h b/src/gpu/gpu.h index 9ed1913..a0ab6ba 100644 --- a/src/gpu/gpu.h +++ b/src/gpu/gpu.h @@ -71,7 +71,7 @@ static inline WGPUStringView label_view(const char* str) { #endif /* defined(DEMO_CROSS_COMPILE_WIN32) */ -struct GLFWwindow; +struct PlatformState; // Forward declaration // Basic wrapper for WebGPU buffers struct GpuBuffer { @@ -96,7 +96,7 @@ struct RenderPass { uint32_t instance_count; }; -void gpu_init(GLFWwindow* window, int width, int height); +void gpu_init(PlatformState* platform_state); void gpu_draw(float audio_peak, float aspect_ratio, float time, float beat); #if !defined(STRIP_ALL) void gpu_simulate_until(float time); -- cgit v1.2.3