summaryrefslogtreecommitdiff
path: root/src/gpu
diff options
context:
space:
mode:
authorskal <pascal.massimino@gmail.com>2026-02-16 23:33:53 +0100
committerskal <pascal.massimino@gmail.com>2026-02-16 23:33:53 +0100
commit3b2bee705cfe5a250bb6049a90b5d734d3125f73 (patch)
treef6c7151b6b9c6eecdf7a3a750c4c57e5c528cc0e /src/gpu
parent0585a596e2fc77239912bd6437ea76b1af5ad0d5 (diff)
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 <noreply@anthropic.com>
Diffstat (limited to 'src/gpu')
-rw-r--r--src/gpu/sequence.cc16
-rw-r--r--src/gpu/sequence.h3
2 files changed, 16 insertions, 3 deletions
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<std::string>& 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<WGPUTextureView>
get_output_views(const std::vector<std::string>& names);
+ // Retrieve texture (for blits)
+ WGPUTexture get_texture(const std::string& name);
+
// Resize all nodes
void resize(int width, int height);