summaryrefslogtreecommitdiff
path: root/src/gpu/gpu.h
diff options
context:
space:
mode:
authorskal <pascal.massimino@gmail.com>2026-02-07 17:04:56 +0100
committerskal <pascal.massimino@gmail.com>2026-02-07 17:04:56 +0100
commitbd939acdf750181ef0e1a612b445da4c15077c85 (patch)
tree028401c762b0436d9a5de1aa656ab35ba6445674 /src/gpu/gpu.h
parentf2963ac821a3af1c54002ba13944552166956d04 (diff)
refactor: Bundle GPU context into GpuContext struct
- Created GpuContext struct {device, queue, format} - Updated Effect/PostProcessEffect to take const GpuContext& - Updated all 19 effect implementations - Updated MainSequence.init() and LoadTimeline() signatures - Updated generated timeline files - Updated all test files - Added gpu_get_context() accessor and fixture.ctx() helper Fixes test_mesh.cc compilation error from g_device/g_queue/g_format conflicts. All targets build successfully.
Diffstat (limited to 'src/gpu/gpu.h')
-rw-r--r--src/gpu/gpu.h13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/gpu/gpu.h b/src/gpu/gpu.h
index b8f58b2..c4d1993 100644
--- a/src/gpu/gpu.h
+++ b/src/gpu/gpu.h
@@ -9,6 +9,13 @@
struct PlatformState; // Forward declaration
class Effect; // Forward declaration
+// GPU context bundling device, queue, and surface format
+struct GpuContext {
+ WGPUDevice device;
+ WGPUQueue queue;
+ WGPUTextureFormat format;
+};
+
// Basic wrapper for WebGPU buffers
struct GpuBuffer {
WGPUBuffer buffer;
@@ -39,10 +46,8 @@ void gpu_resize(int width, int height);
void gpu_simulate_until(float time);
void gpu_add_custom_effect(Effect* effect, float start_time, float end_time, int priority);
-// Expose WebGPU globals for custom effects (debug builds only)
-extern WGPUDevice g_device;
-extern WGPUQueue g_queue;
-extern WGPUTextureFormat g_format;
+// Get GPU context for custom effects (debug builds only)
+const GpuContext* gpu_get_context();
#endif
void gpu_shutdown();