Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions Apps/Playground/Scripts/validation_native.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@
"undeclared-name": "declare `name` for the example code",
// Example captures effect-layer output before its render targets were submitted once.
"prime-effect-layers": "render one extra frame before capture when effect layers exist",
// Example leaves scenes, textures, or Draco state behind for later tests.
"leak-cleanup": "dispose leaked scenes and textures and reset Draco after the test",
// Example leaves textures or Draco state behind for later tests.
"leak-cleanup": "release leaked textures and reset Draco after the test",
// Example starts an async model load in createScene without awaiting it.
"wait-for-import": "wait for loader promises started by createScene before rendering",
// Example clears opaque but writes alpha < 1 that the browser would composite.
Expand Down Expand Up @@ -245,13 +245,6 @@
function cleanupLeaks(test) {
let leaked = false;

// Async loads may leave additional scenes registered on the engine.
const strayScenes = engine.scenes.slice();
leaked = leaked || strayScenes.length > 0;
for (let i = 0; i < strayScenes.length; ++i) {
try { strayScenes[i].dispose(); } catch (e) { console.error(e); }
}

// Cache keys omit load-time options; leaked textures can change later tests.
const leakedTextures = engine.getLoadedTexturesCache();
leaked = leaked || leakedTextures.length > 0;
Expand Down Expand Up @@ -287,6 +280,13 @@
return;
}

// Async loads may leave additional scenes registered on the engine, including when a
// failed test never assigned currentScene, so dispose them for every test.
const strayScenes = engine.scenes.slice();
for (let i = 0; i < strayScenes.length; ++i) {
try { strayScenes[i].dispose(); } catch (e) { console.error(e); }
}

if (hasWorkaround(test, "leak-cleanup")) {
cleanupLeaks(test);
}
Expand Down
2 changes: 1 addition & 1 deletion Documentation/AddingNewValidationTests.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ TSV column. When a workaround changes what the runner does for a test, the runne
| `wait-for-readiness` | Renders before utility-layer scenes, GUI images, or material effects are ready | Waits for those as described below |
| `undeclared-name` | Reads the browser-only global `name` (`window.name`) | Declares `var name = ""` for the example code |
| `prime-effect-layers` | Captures effect-layer (glow/highlight) output on the first frame | Renders one extra frame before counting frames |
| `leak-cleanup` | Leaves scenes, textures, or Draco state behind after disposal | Disposes stray scenes, releases leaked textures, and resets Draco after the test |
| `leak-cleanup` | Leaves textures or Draco state behind after disposal | Releases leaked textures and resets Draco after the test (stray scenes are disposed after every test) |
| `wait-for-import` | Starts `ImportMeshAsync`/`AppendSceneAsync`/`LoadAssetContainerAsync` in `createScene` without awaiting it | Waits for loader promises started before the scene is returned |
| `opaque-clear-alpha` | Clears opaque but leaves alpha < 1 in the final image | Skips canvas-background compositing unless the test sets `canvasBackgroundColor`, the scene uses a frame graph, or `clearColor.a < 1` |

Expand Down
Loading