Skip to content
This repository has been archived by the owner on Dec 2, 2024. It is now read-only.

Make tilesheet frame rate independent of render path + fix race condition #163

Merged
merged 1 commit into from
May 16, 2022

Conversation

MoritzBrueckner
Copy link
Contributor

Fixes armory3d/armory#1437.

Previously, Tilesheet.update() was called from MeshObject.render() which could be called multiple times per frame (with different contexts or in case of VR even twice with the same context). Because the tilesheet used the render frame time as a delta time, this could lead to wrong frame rates for example when there was both a "mesh" and a "shadowmap" context rendered in one frame.

Now, all active tilesheets are updated once at the beginning of each frame and if the animation frame rate is higher than the render frame rate, multiple animation frames are now skipped correctly which wasn't the case before. This also fixes a possible race condition that could happen if the tilesheet frame is advanced in between multiple render passes. The centralized update could also improve cache coherency.

I also decided to make Tilesheet.update() private because it assumes that it is called only once per render frame.

…tion

Fixes armory3d/armory#1437.

Previously, `Tilesheet.update()` was called from `MeshObject.render()` which could be called multiple times per frame (with different contexts or in case of VR even twice with the same context). Because the tilesheet used the render frame time as a delta time, this could lead to wrong frame rates for example when there was both a "mesh" and a "shadowmap" context rendered in one frame.

Now, all active tilesheets are updated once at the beginning of each frame and if the animation frame rate is higher than the render frame rate, multiple animation frames are now skipped correctly which wasn't the case before. This also fixes a possible race condition that could happen if the tilesheet frame is advanced in between multiple render passes. The centralized update could also improve cache coherency.

I also decided to make `Tilesheet.update()` private because it assumes that it is called only once per render frame.
@luboslenco luboslenco merged commit 1eaa7cd into armory3d:main May 16, 2022
@luboslenco
Copy link
Member

Thanks!

@MoritzBrueckner MoritzBrueckner deleted the fix-tilesheet-framerate branch May 16, 2022 08:30
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Tilesheet Framerate
2 participants