diff options
| author | skal <pascal.massimino@gmail.com> | 2026-02-07 17:04:56 +0100 |
|---|---|---|
| committer | skal <pascal.massimino@gmail.com> | 2026-02-07 17:04:56 +0100 |
| commit | bd939acdf750181ef0e1a612b445da4c15077c85 (patch) | |
| tree | 028401c762b0436d9a5de1aa656ab35ba6445674 /src/test_demo.cc | |
| parent | f2963ac821a3af1c54002ba13944552166956d04 (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/test_demo.cc')
| -rw-r--r-- | src/test_demo.cc | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/test_demo.cc b/src/test_demo.cc index 9ae0e3a..69b18cc 100644 --- a/src/test_demo.cc +++ b/src/test_demo.cc @@ -15,14 +15,14 @@ // External declarations from generated files extern float GetDemoDuration(); -extern void LoadTimeline(MainSequence& main_seq, WGPUDevice device, WGPUQueue queue, WGPUTextureFormat format); +extern void LoadTimeline(MainSequence& main_seq, const GpuContext& ctx); // Inline peak meter effect for debugging audio-visual sync #include "gpu/effects/post_process_helper.h" class PeakMeterEffect : public PostProcessEffect { public: - PeakMeterEffect(WGPUDevice device, WGPUQueue queue, WGPUTextureFormat format) - : PostProcessEffect(device, queue) { + PeakMeterEffect(const GpuContext& ctx) + : PostProcessEffect(ctx) { const char* shader_code = R"( struct VertexOutput { @builtin(position) position: vec4<f32>, @@ -82,9 +82,9 @@ class PeakMeterEffect : public PostProcessEffect { } )"; - pipeline_ = create_post_process_pipeline(device, format, shader_code); + pipeline_ = create_post_process_pipeline(device_, format_, shader_code); uniforms_ = gpu_create_buffer( - device, 16, WGPUBufferUsage_Uniform | WGPUBufferUsage_CopyDst); + device_, 16, WGPUBufferUsage_Uniform | WGPUBufferUsage_CopyDst); } void update_bind_group(WGPUTextureView input_view) { @@ -196,7 +196,8 @@ int main(int argc, char** argv) { // Add peak meter visualization effect (renders as final post-process) #if !defined(STRIP_ALL) - auto* peak_meter = new PeakMeterEffect(g_device, g_queue, g_format); + const GpuContext* gpu_ctx = gpu_get_context(); + auto* peak_meter = new PeakMeterEffect(*gpu_ctx); gpu_add_custom_effect(peak_meter, 0.0f, 99999.0f, 999); // High priority = renders last #endif |
