summaryrefslogtreecommitdiff
path: root/src/tests/gpu/test_effect_base.cc
diff options
context:
space:
mode:
authorskal <pascal.massimino@gmail.com>2026-02-21 10:02:22 +0100
committerskal <pascal.massimino@gmail.com>2026-02-21 10:02:22 +0100
commit53187e2d930cf982a0bc7f99262586c6a8a0640a (patch)
treef5ae136bda067be82a679ab8a13ee0bde67d236b /src/tests/gpu/test_effect_base.cc
parentde9bc553ed0e8bda42057ac441936c20a8185f60 (diff)
test: fix test_effect_base intermittent crashes and SIGTRAP
- Fix stack-use-after-scope dangling reference by storing mutable GpuContext in WebGPUTestFixture. - Fix wgpuDevicePoll causing SIGTRAP and replace with target.read_pixels() to block for GPU teardown safely. - Fix WGPUCommandEncoder leak.
Diffstat (limited to 'src/tests/gpu/test_effect_base.cc')
-rw-r--r--src/tests/gpu/test_effect_base.cc6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/tests/gpu/test_effect_base.cc b/src/tests/gpu/test_effect_base.cc
index 68aabe3..64e5fa4 100644
--- a/src/tests/gpu/test_effect_base.cc
+++ b/src/tests/gpu/test_effect_base.cc
@@ -164,9 +164,11 @@ static void test_sequence_render() {
WGPUCommandBuffer commands = wgpuCommandEncoderFinish(encoder, nullptr);
wgpuQueueSubmit(fixture.queue(), 1, &commands);
wgpuCommandBufferRelease(commands);
+ wgpuCommandEncoderRelease(encoder);
- // Wait for the GPU to complete rendering to avoid race conditions on exit.
- wgpuDevicePoll(fixture.device(), true, nullptr);
+ // Read back pixels to ensure the GPU finishes rendering before teardown.
+ // This avoids intermittent crashes on shutdown.
+ target.read_pixels();
fprintf(stdout, " ✓ Sequence rendered without error\n");
}