summaryrefslogtreecommitdiff
path: root/src/gpu
diff options
context:
space:
mode:
Diffstat (limited to 'src/gpu')
-rw-r--r--src/gpu/gpu.cc10
-rw-r--r--src/gpu/gpu.h4
2 files changed, 7 insertions, 7 deletions
diff --git a/src/gpu/gpu.cc b/src/gpu/gpu.cc
index 17d32ee..cecf018 100644
--- a/src/gpu/gpu.cc
+++ b/src/gpu/gpu.cc
@@ -310,9 +310,9 @@ static void handle_request_device(WGPURequestDeviceStatus status,
#endif /* defined(DEMO_CROSS_COMPILE_WIN32) */
#endif /* !defined(STRIP_ALL) */
-void gpu_init(GLFWwindow* window, int width, int height) {
+void gpu_init(PlatformState* platform_state) {
g_instance = wgpuCreateInstance(nullptr);
- g_surface = platform_create_wgpu_surface(g_instance);
+ g_surface = platform_create_wgpu_surface(g_instance, platform_state);
WGPURequestAdapterOptions adapter_opts = {};
adapter_opts.compatibleSurface = g_surface;
@@ -364,13 +364,13 @@ void gpu_init(GLFWwindow* window, int width, int height) {
g_config.device = g_device;
g_config.format = swap_chain_format;
g_config.usage = WGPUTextureUsage_RenderAttachment;
- g_config.width = width;
- g_config.height = height;
+ g_config.width = platform_state->width;
+ g_config.height = platform_state->height;
g_config.presentMode = WGPUPresentMode_Fifo;
g_config.alphaMode = WGPUCompositeAlphaMode_Opaque;
wgpuSurfaceConfigure(g_surface, &g_config);
- g_main_sequence.init(g_device, g_queue, g_config.format, width, height);
+ g_main_sequence.init(g_device, g_queue, g_config.format, platform_state->width, platform_state->height);
LoadTimeline(g_main_sequence, g_device, g_queue, g_config.format);
}
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);