Wait for validation readiness without consuming rendered frames - #1890
bkaradzic-microsoft wants to merge 8 commits into
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
Unresolved moderate issues remain in render-pass handling and asynchronous framebuffer evaluation.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
Adds readiness polling for native validation without consuming rendered frames, preserving deterministic state and adding standalone regression coverage.
Changes:
- Waits for scene, GUI, material, effect, and utility-scene readiness.
- Preserves render budgets, render-pass state, cleanup, and seeded randomness.
- Adds documentation, Node tests, and CI execution.
File summaries
| File | Summary |
|---|---|
Documentation/AddingNewValidationTests.md |
Documents readiness and deterministic capture behavior. |
Apps/Playground/Tests/validation_native.test.cjs |
Adds standalone host-independent runner regression tests. |
Apps/Playground/Scripts/validation_native.js |
Implements readiness polling and lifecycle handling; findings remain regarding pass ordering/restoration and stale asynchronous evaluation. |
.github/workflows/ci.yml |
Runs the standalone validation tests in CI. |
Review details
Suppressed comments (1)
Apps/Playground/Scripts/validation_native.js:318
scene.isReady()runs beforecurrentRenderPassIdis switched to the active camera pass. Babylon's readiness path callsmesh.isReady(true), which prepares/checks pass-specific draw wrappers; the latermaterialDefines/effectreads can therefore see an uninitialized camera-pass wrapper and treat the missing values as ready, allowing the first captured frame before that pass's effect is compiled. Select the camera pass before the entire readiness check and keep it inside the existingtry/finally.
if (!scene.isReady()) {
- Files reviewed: 4/4 changed files
- Comments generated: 2
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
There was a problem hiding this comment.
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
There was a problem hiding this comment.
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
Check GUI images and active-pass material readiness, including associated utility scenes, before counting rendered frames. Fail explicitly after 240 waiting ticks and preserve once-only cleanup and capture indices. Stop late readiness/render callbacks after completion or failure. Restore both the seeded random function and its seed between tests. Add full-script host-independent regression coverage and a CI job. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 60c2ec68-6de1-445d-9fc9-b699db737eae
Protect scene and GUI readiness with the render-pass restoring finally block, not only the material inspection. Invalidate queued screenshot evaluation on each failure path before cleaning up the scene. Add regressions for scene and GUI exceptions, delayed screenshots after render/readiness/convergence/initial-timeout failure, and delayed success. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 60c2ec68-6de1-445d-9fc9-b699db737eae
Apply the existing initial readiness wait and timeout to associated utility scenes, not just the main scene. Near Menu can otherwise exhaust 240 unrendered ticks while its utility scene is still loading models. Reproduced on Linux QuickJS/OpenGL with llvmpipe: 240 checks in 114ms, five pending utility-scene loads, and zero rendered frames. The unchanged Near Menu fixture and three GUI controls now pass on Linux and Windows. Add both callback-order regressions and utility-timeout/late-callback coverage. Preserve all frame counts and the 240-check convergence limit. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 60c2ec68-6de1-445d-9fc9-b699db737eae
Track timer identities and due times, support real cancellation, and load synthetic playground snippets through the runner's existing Promise path. Cover immediately and asynchronously resolved scenes, exact render counts, and absence of stale timeout failures. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 60c2ec68-6de1-445d-9fc9-b699db737eae
14c2a71 to
8829ec5
Compare
There was a problem hiding this comment.
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
Match Scene.isReady's nullish pass fallback without treating pass zero as missing. Cover missing/null/undefined camera passes and utility scenes attached during convergence; document why that scene set is recomputed. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 48fa7ec8-0cf6-48a0-b836-10b7ace38c1a
There was a problem hiding this comment.
🟡 Changes recommended
Initial readiness can hang indefinitely when a pending associated utility scene is disposed or detached.
Get a fresh assessment by requesting another Copilot review.
Review details
- Files reviewed: 4/4 changed files
- Comments generated: 1
- Review effort level: Balanced
Reconcile associated scenes while waiting instead of relying on a fixed callback count. Drop removed scenes and enroll new ones, with a runner-owned deadline that remains active when scene disposal clears readiness observers. Cancel readiness timers and ignore late callbacks after the wait ends. Cover disposal, detachment, attachment, independent timeout, and stale callbacks without changing rendered-frame or screenshot budgets. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 48fa7ec8-0cf6-48a0-b836-10b7ace38c1a
There was a problem hiding this comment.
🟡 Changes recommended
Utility layers created before the main camera can bypass both readiness phases.
Get a fresh assessment by requesting another Copilot review.
Review details
- Files reviewed: 4/4 changed files
- Comments generated: 1
- Review effort level: Balanced
Record UtilityLayerRenderer's public scene association during its existing constructor-time camera update. Use that association during readiness instead of requiring the utility scene to have copied the main camera. Keep camera matching for other virtual scenes and cover early utility-layer creation without waiting on unrelated camera-less virtual scenes. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 48fa7ec8-0cf6-48a0-b836-10b7ace38c1a
There was a problem hiding this comment.
🔵 Needs a closer look
The asynchronous lifecycle handling and private utility-layer instrumentation warrant final human validation across supported native engines.
Review details
- Files reviewed: 4/4 changed files
- Comments generated: 0 new
- Review effort level: Balanced
Use the published engine effect-error observable to reject pending scene creation or fail scene processing outside compiler notification callbacks. Cancel readiness and screenshot callbacks, remove observers and timers, and dispose late-loaded scenes without changing the following test. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 60c2ec68-6de1-445d-9fc9-b699db737eae
Summary
renderCount, screenshot indices, and RenderDoc capture/finalization budgets.Math.randomfunction as well as its seed between scenes.Independence
Based on upstream
master. Uses existing published Babylon.js 9.21.2 APIs. No JavaScript engine changes, dependency updates, protocol changes, engine-option changes, fixture/reference changes, capture-count changes, or tolerance changes.Validation
d03cbc56; a delayed successful screenshot remains supported.Native Canvas,setParent, andGUI Gradient Linear with transparencyall pass with unchanged fixtures and gates.Linux CI follow-up
6e48a96bfixes theGUI Near Menutimeout from Linux QuickJS CI. A local Linux/llvmpipe reproduction exhausted 240 convergence checks in 114 ms with five utility-scene loads still pending and zero rendered frames. The initialexecuteWhenReadywait covered only the main scene.The existing initial readiness wait and 10-minute timeout now cover associated utility scenes too. Resource loads therefore complete before bounded convergence polling begins. The 240-check limit, canonical Near Menu render count (60), references, and pixel tolerances are unchanged.
Three new regressions cover both main/utility callback orders and utility timeout with late callbacks; they fail before and pass after. Near Menu, Native Canvas, setParent, and the transparent GUI gradient all pass together on Linux QuickJS/OpenGL/llvmpipe and Windows Chakra/D3D11. Fresh CI is pending.
Terminal shader error follow-up
Added Native-only fail-fast handling for terminal engine effect-error notifications, preserving the newer utility-scene ownership/readiness fixes already on this branch.
All 42 full-script Node cases pass. Running these cases against the previous PR head exposes eight failures fixed here. An actual invalid GLSL ShaderMaterial followed by a black-frame control on stock Windows x64 / D3D11 / Chakra / Release produces
ran=2 passed=1 failed=1 missingRef=0in 2.121 seconds; the expected process exit is -1.This does not claim unsupported WGSL preprocessing now reports an error on stock Babylon.js. Early WGSL rejection and asynchronous shader-preparation fixes remain separate Babylon.js changes. This PR consumes terminal errors that the released engine already emits.