Repository navigation
fix(📲): unconfigure a canvas surface only while it is configured - #551
Draft
YevheniiKotyrlo wants to merge 4 commits into
Draft
YevheniiKotyrlo wants to merge 4 commits into
YevheniiKotyrlo wants to merge 4 commits into
Conversation
Contributor
Author
|
The three new tests against #550's With the change, the whole C++ suite: |
…dence on the host SurfaceRegistry.h and AnimationReporter had no unit tests: CI built them and the e2e suite on a device was the only check. tests/cpp compiles the registry for the host against FakeWebGPU.cpp, a stand-in for the WebGPU C functions it calls that records every call Dawn would reject, and `yarn test:cpp` builds and runs it with CMake and GoogleTest. AnimationReporter's timing rule moves unchanged into AnimationCadence, which takes the time as an argument, so the same tests drive it. The Android CI job runs them before the Gradle build.
context.unconfigure() called Surface::Unconfigure() whenever a surface was attached, and Dawn rejects that on a surface that is not configured: a second unconfigure(), one on a context that was never configured while its view's surface is attached, or one after device.destroy() recreated the surface on Android. GPUCanvasContext.unconfigure() is valid in each case. SurfaceInfo now tracks whether its surface is configured.
YevheniiKotyrlo
force-pushed
the
fix/unconfigure-configured-surface
branch
from
October 16, 2026 14:05
0d6ba19 to
11920e6
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #550; the diff of its own is the last commit.
Problem
context.unconfigure()callsSurface::Unconfigure()whenever a surface is attached, and Dawn rejects that on a surface that is not configured (Surface::Unconfigure: "is not configured").GPUCanvasContext.unconfigure()is valid in each of these cases, and each one reaches Dawn as a validation error:unconfigure();unconfigure()on a context that was never configured while its view's surface is attached;unconfigure()afterdevice.destroy(), which recreates the canvas's surface unconfigured.Solution
SurfaceInfotracks whether its surface is configured: set when it configures the surface, cleared when it unconfigures it, adopts or recreates a surface, or detaches one.unconfigure()callsSurface::Unconfigure()only while it is.Tests
Three cases in
tests/cpp/SurfaceInfoTest.cpp: unconfigure twice, unconfigure a context that was never configured, and configure again after unconfigure and present. Without the change the first two fail with the fake's record of Dawn's rejection (Surface.Unconfigure on a surface that is not configured); with it all 29 C++ tests pass.Verification
yarn test:cppon Ubuntu 24.04 (g++ 13.3): 29 passed. The Android library's native build (:react-native-webgpu:externalNativeBuildDebug, x86_64) compiles the change, and so does the example's iOS build for the simulator SDK. clang-format and the package'scpplintcommand leave the two files unchanged. CI's Android e2e step (debug build, Metro withCI=true) on an Android 15 emulator: 219 of 221, as onmain; the two failures, the YUV cases ofExternalTextureColorSpaceandNativeBufferWrapper, fail onmainthere too. On devices the whole suite passes, 221 of 221: on a Galaxy S23 (Android 14), and on an iPad Pro 12.9-inch (4th generation, iOS 27.0.1) built and run as CI's iOS job does on a simulator (Debug build, Metro withCI=true).mainpasses 221 of 221 on both.