summaryrefslogtreecommitdiff
path: root/src/gpu
diff options
context:
space:
mode:
Diffstat (limited to 'src/gpu')
-rw-r--r--src/gpu/sequence.cc10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/gpu/sequence.cc b/src/gpu/sequence.cc
index 9de4133..783f3df 100644
--- a/src/gpu/sequence.cc
+++ b/src/gpu/sequence.cc
@@ -30,15 +30,14 @@ NodeRegistry::NodeRegistry(WGPUDevice device, int default_width,
NodeRegistry::~NodeRegistry() {
for (auto& [name, node] : nodes_) {
+ if (node.texture == nullptr) continue; // External view, not owned
if (node.view) {
wgpuTextureViewRelease(node.view);
}
for (auto& mip_view : node.mip_views) {
wgpuTextureViewRelease(mip_view);
}
- if (node.texture) {
- wgpuTextureRelease(node.texture);
- }
+ wgpuTextureRelease(node.texture);
}
}
@@ -108,6 +107,7 @@ void NodeRegistry::resize(int width, int height) {
default_height_ = height;
for (auto& [name, node] : nodes_) {
+ if (node.texture == nullptr) continue; // External view, not owned
// Release old texture
if (node.view) {
wgpuTextureViewRelease(node.view);
@@ -115,9 +115,7 @@ void NodeRegistry::resize(int width, int height) {
for (auto& mip_view : node.mip_views) {
wgpuTextureViewRelease(mip_view);
}
- if (node.texture) {
- wgpuTextureRelease(node.texture);
- }
+ wgpuTextureRelease(node.texture);
// Recreate with new dimensions
node.width = width;