Fix composition render resources invalidation #12146
Merged
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.
What does the pull request do?
This PR ensures that updating a render resource correctly invalidates all the other render elements using it.
What is the current behavior?
In some situations, resources aren't correctly invalidated: see #11673 for more information.
How was the solution implemented?
There were actually two different problems:
Resources collection in
ServerCompositionRenderData
In
RenderDataDrawingContext
exists a stack of lists ofIRenderDataItem
to eventually send to server part of the compositor. InPop()
, current items are added to their parentRenderDataPushNode
if there's one. However, those child items aren't searched for resources by theServerCompositionRenderData
, which is responsible for setting up the resource tracking. The first commit fixes that by searching for the resources recursively insideRenderDataPushNode
items.I didn't add a test as there seem to be no test infrastructure currently regarding the render resource usages and invalidation, and it isn't an easy part easy to plug into.
InlineDictionary
enumerationInlineDictionary
has three backing strategies: single item, array (2 to 6 items) and dictionary (7+ items). In array mode, the enumerator was broken as it stopped at the first hole (null
item) in the array, but all the other methods expect or add holes. This affectedRemove
, which sets the removed item to null. It also affectedAdd
, which was filling the last hole instead of the first, so the enumerator could never return them unless the array was full.The resource usages are tracked using a
RefCountingSmallDictionary
, which uses anInlineDictionary
.The enumeration has been fixed, and
Add()
now takes the first available hole.Two tests have been added.
Fixed issues
Fixes #11673