diff options
| author | skal <pascal.massimino@gmail.com> | 2026-02-01 18:56:47 +0100 |
|---|---|---|
| committer | skal <pascal.massimino@gmail.com> | 2026-02-01 18:56:47 +0100 |
| commit | e3ef115804b46e8bfc594987b04b1059aed5e002 (patch) | |
| tree | 3670f718ee23cf34e94984568900eac23022d1f0 /src/gpu/effect.cc | |
| parent | 7fab8880cca269621cd32610b22f2820567771f2 (diff) | |
feat(gpu/assets): Fix tests, integrate bumpy 3D renderer and procedural assets
- Fixed test_sequence by restoring MainSequence::init_test for mocking.
- Corrected CMakeLists.txt dependencies and source groupings to prevent duplicate symbols.
- standardizing Effect constructor signature for seq_compiler compatibility.
- Implemented Hybrid3DEffect using bumpy Renderer3D and procedural NOISE_TEX.
- Updated MainSequence to support depth buffer for 3D elements.
- Formatted all source files with clang-format.
Diffstat (limited to 'src/gpu/effect.cc')
| -rw-r--r-- | src/gpu/effect.cc | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/gpu/effect.cc b/src/gpu/effect.cc index fdc604c..b2e0c4e 100644 --- a/src/gpu/effect.cc +++ b/src/gpu/effect.cc @@ -131,6 +131,14 @@ void MainSequence::create_framebuffers(int width, int height) { depth_view_ = wgpuTextureCreateView(depth_texture_, &depth_view_desc); } +void MainSequence::init_test(WGPUDevice d, WGPUQueue q, WGPUTextureFormat f) { + device = d; + queue = q; + format = f; + // No framebuffers or passthrough effect created in test mode. + // Test effects should not rely on these being real. +} + void MainSequence::init(WGPUDevice d, WGPUQueue q, WGPUTextureFormat f, int width, int height) { device = d; @@ -197,7 +205,7 @@ void MainSequence::render_frame(float global_time, float beat, float peak, #if !defined(DEMO_CROSS_COMPILE_WIN32) scene_attachment.depthSlice = WGPU_DEPTH_SLICE_UNDEFINED; #endif /* !defined(DEMO_CROSS_COMPILE_WIN32) */ - + WGPURenderPassDepthStencilAttachment depth_attachment = {}; depth_attachment.view = depth_view_; depth_attachment.depthLoadOp = WGPULoadOp_Clear; @@ -206,7 +214,8 @@ void MainSequence::render_frame(float global_time, float beat, float peak, WGPURenderPassDescriptor scene_desc = {.colorAttachmentCount = 1, .colorAttachments = &scene_attachment, - .depthStencilAttachment = &depth_attachment}; + .depthStencilAttachment = + &depth_attachment}; WGPURenderPassEncoder scene_pass = wgpuCommandEncoderBeginRenderPass(encoder, &scene_desc); for (const SequenceItem* item : scene_effects) { @@ -224,7 +233,8 @@ void MainSequence::render_frame(float global_time, float beat, float peak, final_view = wgpuTextureCreateView(st.texture, nullptr); // Safely cast to PostProcessEffect to call update_bind_group - PostProcessEffect* pp_effect = (PostProcessEffect*)passthrough_effect_.get(); + PostProcessEffect* pp_effect = + (PostProcessEffect*)passthrough_effect_.get(); pp_effect->update_bind_group(framebuffer_view_a_); WGPURenderPassColorAttachment final_attachment = {}; |
