From 3b2bee705cfe5a250bb6049a90b5d734d3125f73 Mon Sep 17 00:00:00 2001 From: skal Date: Mon, 16 Feb 2026 23:33:53 +0100 Subject: fix: port Hybrid3D effect to sequence v2 architecture Hybrid3D was calling Renderer3D::render() which creates its own command encoder, bypassing the sequence system. Now uses renderer_.draw() with the passed encoder. Also adds texture blit support for RotatingCube compositing. Co-Authored-By: Claude Sonnet 4.5 --- src/effects/rotating_cube_effect.cc | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'src/effects/rotating_cube_effect.cc') diff --git a/src/effects/rotating_cube_effect.cc b/src/effects/rotating_cube_effect.cc index 1f56b8b..a91bc78 100644 --- a/src/effects/rotating_cube_effect.cc +++ b/src/effects/rotating_cube_effect.cc @@ -156,6 +156,21 @@ void RotatingCube::render(WGPUCommandEncoder encoder, wgpuQueueWriteBuffer(ctx_.queue, object_buffer_.buffer, 0, &obj_data, sizeof(ObjectData)); + // Blit input to output if compositing (not reading from source) + if (!input_nodes_.empty() && input_nodes_[0] != "source") { + WGPUTexture input_tex = nodes.get_texture(input_nodes_[0]); + WGPUTexture output_tex = nodes.get_texture(output_nodes_[0]); + if (input_tex && output_tex) { + WGPUTexelCopyTextureInfo src = { + .texture = input_tex, .mipLevel = 0, .aspect = WGPUTextureAspect_All}; + WGPUTexelCopyTextureInfo dst = { + .texture = output_tex, .mipLevel = 0, .aspect = WGPUTextureAspect_All}; + WGPUExtent3D copy_size = {(uint32_t)params.resolution.x, + (uint32_t)params.resolution.y, 1}; + wgpuCommandEncoderCopyTextureToTexture(encoder, &src, &dst, ©_size); + } + } + // Get output views WGPUTextureView color_view = nodes.get_view(output_nodes_[0]); WGPUTextureView depth_view = nodes.get_view(depth_node_); @@ -164,9 +179,10 @@ void RotatingCube::render(WGPUCommandEncoder encoder, WGPURenderPassColorAttachment color_attachment = { .view = color_view, .depthSlice = WGPU_DEPTH_SLICE_UNDEFINED, - .loadOp = WGPULoadOp_Clear, +// .loadOp = WGPULoadOp_Clear, + .loadOp = WGPULoadOp_Load, .storeOp = WGPUStoreOp_Store, - .clearValue = {0.0, 0.0, 0.0, 1.0}}; + .clearValue = {0.0, 0.0, 0.0, 0.0}}; WGPURenderPassDepthStencilAttachment depth_attachment = { .view = depth_view, -- cgit v1.2.3