Repository navigation
PLAT-12035: stop Tr2InteriorScene re-creating shadow maps on every li… - #128
Open
JohnGreenFC wants to merge 2 commits into
Open
JohnGreenFC wants to merge 2 commits into
JohnGreenFC wants to merge 2 commits into
Conversation
…ght change Adding or removing a light, loading the lights list, or setting shadowSize or shadowCount each rebuilt every spotlight shadow map and the shared depth stencil immediately. Loading an interior scene with four lights created and discarded the 1024x1024 targets many times before the first frame. Mark the shadow maps dirty instead and rebuild them lazily in RenderShadows. SetupShadowMaps now keeps existing targets that are valid and the right size, trims or appends to reach the wanted count, and only recreates the depth stencil when its size changes.
JohnGreenFC
marked this pull request as ready for review
October 19, 2026 14:35
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.
Summary
Tr2InteriorScene rebuilt every spotlight shadow map and the shared depth stencil on each light add/remove, lights-list load, and shadowSize/shadowCount change. Loading an interior scene with four lights created and discarded the 1024x1024 targets many times before the first frame.
RenderShadows.SetupShadowMapskeeps targets that are valid and the right size, trims or appends to the wanted count, and only recreates the depth stencil when its size changes.Linked issue (optional)
Refs PLAT-12035 (from the Tracy review in PLAT-8958).
Testing
Windows, DX12, trinitydev flavor.
Tr2RenderTarget::Createper popup went from 98 to 18 and ~32 ms to ~5 ms, with no 1024x1024 ShadowMap churn. Shadows render unchanged.AI assistance
Used for testing and validation
Checklist