Fix uninitialized reftype during image state merge #3446
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.
This PR targets an error that can occur if images are referenced by a secondary command buffer before being referenced by a primary command buffer that executes the secondary.
Image states tracked by secondary command buffers are merged into their executing primaries in the hook for VkCmdExecuteCommands. If an image state refers to an image that was not previously referenced by the primary, a new, uninitialized image state is added to the primary. The new image state is initialized with elements of the original, including subresource states, but the frameref type of subresource states is uninitialized. An error is logged when the subresource state reftypes are passed to the reftype composition function.
This PR adds logic to initialize the reftype of the new subresource state with the value of the original if it remains uninitialized before the composition function.