summaryrefslogtreecommitdiff
path: root/src/platform/platform.h
diff options
context:
space:
mode:
authorskal <pascal.massimino@gmail.com>2026-03-26 07:34:54 +0100
committerskal <pascal.massimino@gmail.com>2026-03-26 07:34:54 +0100
commitf7a34b7401695a4a9137889eb4eb322694f8c5c9 (patch)
tree19e165da848a412641312b2d8e6fd4d49266732b /src/platform/platform.h
parentaf70b169c3d65c053ed80dd85e85304dfa78dc35 (diff)
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
Diffstat (limited to 'src/platform/platform.h')
-rw-r--r--src/platform/platform.h38
1 files changed, 3 insertions, 35 deletions
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 <webgpu/webgpu.h>
#include <webgpu/wgpu.h>
-
-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 <webgpu.h>
#include <wgpu.h>
+#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);