From f7a34b7401695a4a9137889eb4eb322694f8c5c9 Mon Sep 17 00:00:00 2001 From: skal Date: Thu, 26 Mar 2026 07:34:54 +0100 Subject: fix(src/platform): code review cleanup - platform.h: deduplicate str_view/label_view/platform_wgpu_wait_any (were identical in WIN32 and default branches); remove dead platform_wgpu_set_error_callback and its never-used callback typedefs - platform.cc: remove glfwSetWindowUserPointer(nullptr) + stale comment block; drop if-guard on user pointer fixup in platform_poll; remove redundant aspect_ratio recompute (framebuffer_size_callback owns it) - headless_platform.cc: write g_virtual_time back to state->time in platform_poll; remove never-set g_should_close variable - stub_types.h: remove dead platform_wgpu_set_error_callback and callback typedefs; add comment on non-empty WGPURenderPassColorAttachment handoff(Gemini): platform layer cleaned up, no behaviour change --- src/platform/platform.h | 38 +++----------------------------------- 1 file changed, 3 insertions(+), 35 deletions(-) (limited to 'src/platform/platform.h') diff --git a/src/platform/platform.h b/src/platform/platform.h index 4b31ac3..26f11a5 100644 --- a/src/platform/platform.h +++ b/src/platform/platform.h @@ -9,39 +9,14 @@ // WebGPU specific headers and shims #if defined(STRIP_EXTERNAL_LIBS) #include "stub_types.h" - -#elif defined(DEMO_CROSS_COMPILE_WIN32) +#else +#if defined(DEMO_CROSS_COMPILE_WIN32) #include #include - -static inline WGPUStringView str_view(const char* str) { - if (!str) - return {nullptr, 0}; - return {str, strlen(str)}; -} - -static inline WGPUStringView label_view(const char* str) { -#if !defined(STRIP_ALL) - if (!str) - return {nullptr, 0}; - return {str, strlen(str)}; -#else - (void)str; - return {nullptr, 0}; -#endif -} - -static inline void platform_wgpu_wait_any(WGPUInstance instance) { - wgpuInstanceWaitAny(instance, 0, nullptr, 0); -} -static inline void -platform_wgpu_set_error_callback(WGPUDevice device, - WGPUUncapturedErrorCallback callback) { -} - #else #include #include +#endif static inline WGPUStringView str_view(const char* str) { if (!str) @@ -63,12 +38,6 @@ static inline WGPUStringView label_view(const char* str) { static inline void platform_wgpu_wait_any(WGPUInstance instance) { wgpuInstanceWaitAny(instance, 0, nullptr, 0); } -static inline void -platform_wgpu_set_error_callback(WGPUDevice device, - WGPUUncapturedErrorCallback callback) { - // Handled in descriptor for new API, but provided for compatibility if needed - // elsewhere -} #endif // Forward declare GLFWwindow to avoid including the full header here. @@ -85,7 +54,6 @@ struct PlatformState { int windowed_x = 0, windowed_y = 0, windowed_w = 0, windowed_h = 0; }; -// Refactored platform API PlatformState platform_init(bool fullscreen, int width, int height); void platform_shutdown(PlatformState* state); void platform_poll(PlatformState* state); -- cgit v1.2.3