Skip to content

The decal manager reads the trees' decal counts only after the decal store changed, not on every editor frame (#273) - #359

Merged
LogicalError merged 1 commit into
mainfrom
feature-decal-manager-counts
Nov 19, 2026
Merged

LogicalError merged 1 commit into
mainfrom
feature-decal-manager-counts

Conversation

@LogicalError

Copy link
Copy Markdown
Member

Part of #273.

ChiselDecalManager.Update runs on every editor frame. Even with nothing changed it asked every model's tree whether it was still valid and how many decals it had (GetDecalCount: another validity check and two lookups), about 2.6-3.2 us per model. On bm_c0a0a (41 models, 233 decals) the idle update cost 0.23-0.36 ms per frame.

Changes

  • ChiselDecalStore.Version goes up whenever a tree's decals can have changed: when they are given (SetDecals), and when they go with their tree (ChiselTreeLookup.ReleaseTree, DisposeAllTrees).
  • The decal manager compares a tree's decal count with what it gave it only after that version moved. Its own SetDecals calls move the version; it takes that as seen, since the trees then have what it gave them.
  • A model with decals sharing an id no longer makes the manager rebuild on every frame: the tree keeps one decal per id, so its count never matched the list given to it.

Timing

Idle ChiselDecalManager.Update on bm_c0a0a, 5 runs of 50 calls: main 0.234-0.361 ms, this branch 0.136-0.225 ms.

Tests

  • ChiselTreeLookupTests.TheDecalStoresVersion_MovesWhenATreesDecalsCanHaveChanged: the version moves when decals are given, when a tree is destroyed and when all trees are released, and not when a count is read. Fails without the ReleaseTree or the DisposeAllTrees bump.

  • ChiselDecalComponentTests.ATreesDecals_AreLookedAtAgain_OnlyWhenTheStoreChanged: a tree's decals removed behind the store's back are not noticed until the store says its decals changed. Fails when the counts are read on every update.

  • Full EditMode suite: 3090 passed, 0 failed, 5 skipped.

@LogicalError
LogicalError merged commit b46fb9e into main Nov 19, 2026
6 checks passed
@LogicalError
LogicalError deleted the feature-decal-manager-counts branch November 19, 2026 13:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant