diff options
Diffstat (limited to 'src/gpu/gpu.cc')
| -rw-r--r-- | src/gpu/gpu.cc | 37 |
1 files changed, 6 insertions, 31 deletions
diff --git a/src/gpu/gpu.cc b/src/gpu/gpu.cc index 8342c94..1f71711 100644 --- a/src/gpu/gpu.cc +++ b/src/gpu/gpu.cc @@ -5,15 +5,13 @@ #include "gpu.h" #include "demo_effects.h" #include "effect.h" -#include "platform.h" #include "gpu/effects/shaders.h" +#include "platform.h" -#include <GLFW/glfw3.h> -#include <math.h> - -#include <algorithm> #include <cassert> +#include <cmath> #include <cstdint> +#include <cstdio> #include <cstring> #include <vector> @@ -21,29 +19,6 @@ #include <iostream> #endif /* !defined(STRIP_ALL) */ -// --- WebGPU Headers & Compatibility --- -#if defined(DEMO_CROSS_COMPILE_WIN32) -// Renamed Types/Enums -#define WGPUOptionalBool_False false -#define WGPUSurfaceGetCurrentTextureStatus_SuccessOptimal \ - WGPUSurfaceGetCurrentTextureStatus_Success -#define WGPUSurfaceGetCurrentTextureStatus_SuccessSuboptimal \ - WGPUSurfaceGetCurrentTextureStatus_Success -#define WGPUCallbackMode_WaitAnyOnly 0 -static void wgpuInstanceWaitAny(WGPUInstance instance, size_t, void*, - uint64_t) { - wgpuInstanceProcessEvents(instance); -} -static void set_error_callback(WGPUDevice device, WGPUErrorCallback callback) { - wgpuDeviceSetUncapturedErrorCallback(device, callback, nullptr); -} -#else -static void set_error_callback(WGPUDevice device, - WGPUUncapturedErrorCallback callback) { - // Handled in descriptor for new API. -} -#endif /* defined(DEMO_CROSS_COMPILE_WIN32) */ - static WGPUInstance g_instance = nullptr; static WGPUAdapter g_adapter = nullptr; static WGPUDevice g_device = nullptr; @@ -331,7 +306,7 @@ void gpu_init(PlatformState* platform_state) { wgpuInstanceRequestAdapter(g_instance, &adapter_opts, adapter_cb); #endif /* defined(DEMO_CROSS_COMPILE_WIN32) */ while (!g_adapter) - wgpuInstanceWaitAny(g_instance, 0, nullptr, 0); + platform_wgpu_wait_any(g_instance); WGPUDeviceDescriptor device_desc = {}; #if !defined(STRIP_ALL) @@ -351,10 +326,10 @@ void gpu_init(PlatformState* platform_state) { wgpuAdapterRequestDevice(g_adapter, &device_desc, device_cb); #endif /* defined(DEMO_CROSS_COMPILE_WIN32) */ while (!g_device) - wgpuInstanceWaitAny(g_instance, 0, nullptr, 0); + platform_wgpu_wait_any(g_instance); #if defined(DEMO_CROSS_COMPILE_WIN32) && !defined(STRIP_ALL) - set_error_callback(g_device, handle_device_error); + platform_wgpu_set_error_callback(g_device, handle_device_error); #endif /* defined(DEMO_CROSS_COMPILE_WIN32) && !defined(STRIP_ALL) */ g_queue = wgpuDeviceGetQueue(g_device); |
