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/gpu/sequence.cc | 16 +++++++++++++--- src/gpu/sequence.h | 3 +++ 2 files changed, 16 insertions(+), 3 deletions(-) (limited to 'src/gpu') diff --git a/src/gpu/sequence.cc b/src/gpu/sequence.cc index 62c2933..0a0cb1e 100644 --- a/src/gpu/sequence.cc +++ b/src/gpu/sequence.cc @@ -92,6 +92,16 @@ NodeRegistry::get_output_views(const std::vector& names) { return views; } +WGPUTexture NodeRegistry::get_texture(const std::string& name) { + auto alias_it = aliases_.find(name); + if (alias_it != aliases_.end()) { + return get_texture(alias_it->second); + } + auto it = nodes_.find(name); + FATAL_CHECK(it != nodes_.end(), "Node not found: %s\n", name.c_str()); + return it->second.texture; +} + void NodeRegistry::resize(int width, int height) { default_width_ = width; default_height_ = height; @@ -141,15 +151,15 @@ void NodeRegistry::create_texture(Node& node) { switch (node.type) { case NodeType::U8X4_NORM: format = WGPUTextureFormat_RGBA8Unorm; - usage = (WGPUTextureUsage)(WGPUTextureUsage_RenderAttachment | WGPUTextureUsage_TextureBinding); + usage = (WGPUTextureUsage)(WGPUTextureUsage_RenderAttachment | WGPUTextureUsage_TextureBinding | WGPUTextureUsage_CopySrc | WGPUTextureUsage_CopyDst); break; case NodeType::F32X4: format = WGPUTextureFormat_RGBA32Float; - usage = (WGPUTextureUsage)(WGPUTextureUsage_RenderAttachment | WGPUTextureUsage_TextureBinding); + usage = (WGPUTextureUsage)(WGPUTextureUsage_RenderAttachment | WGPUTextureUsage_TextureBinding | WGPUTextureUsage_CopySrc | WGPUTextureUsage_CopyDst); break; case NodeType::F16X8: format = WGPUTextureFormat_RGBA16Float; // WebGPU doesn't have 8-channel, use RGBA16 - usage = (WGPUTextureUsage)(WGPUTextureUsage_RenderAttachment | WGPUTextureUsage_TextureBinding); + usage = (WGPUTextureUsage)(WGPUTextureUsage_RenderAttachment | WGPUTextureUsage_TextureBinding | WGPUTextureUsage_CopySrc | WGPUTextureUsage_CopyDst); break; case NodeType::DEPTH24: format = WGPUTextureFormat_Depth24Plus; diff --git a/src/gpu/sequence.h b/src/gpu/sequence.h index a33dedb..e96e183 100644 --- a/src/gpu/sequence.h +++ b/src/gpu/sequence.h @@ -62,6 +62,9 @@ class NodeRegistry { std::vector get_output_views(const std::vector& names); + // Retrieve texture (for blits) + WGPUTexture get_texture(const std::string& name); + // Resize all nodes void resize(int width, int height); -- cgit v1.2.3