Fix non-deterministic rendering due to background texture loading #765
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.
🦟 Bug fix
No ticket was created for this issue.
Summary
OgreNext 2.2+ has a feature where all textures are asynchronously loaded by default; and a blank texture will be shown until it's ready.
This is great for low latency interactions & most games; but terrible if we want all our simulated frames to be perfect & deterministic results
We don't want placeholder textures to be used; thus wait until all textures being loaded are done.
I found this bug while working on the Heightmap Integration tests for Fortress. The test required to load some PNGs and it failed spectacularly as the first frames rendered used the placeholder textures instead of the final ones.
waitForStreamingCompletion
doesn't have any performance impact if there are no textures waiting to finish loading; and it will obviously affect performance if there are textures still loading andhas to wait. However this is a case of "rendering ASAP vs correctness".Checklist
codecheck
passed (See contributing)Note to maintainers: Remember to use Squash-Merge and edit the commit message to match the pull request summary while retaining
Signed-off-by
messages.