diff options
Diffstat (limited to 'src/gpu/sequence.cc')
| -rw-r--r-- | src/gpu/sequence.cc | 16 |
1 files changed, 13 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; |
