-
Notifications
You must be signed in to change notification settings - Fork 238
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix shared depth buffers leaking (#103)
Use a reference count system to track which shared depth buffers are in use, and release those that reach 0 ref count Additionally, added TextureGpu::getSourceType for useful stats tracking Patch originally by SolarPortal. See https://forums.ogre3d.org/viewtopic.php?p=548396#p548396 Modifications by Matias N. Goldberg: - Original patch exposed several functions as public which shouldn't be - Renamed "DepthBuffer" to "SharedDepthBuffer", since RenderSystem doesn't manage all depth buffers. It only manages automatically generated ones - Moved mSourceType so that it takes advantage of preexisting padding - _dereferenceSharedDepthBuffer original version accepted any input (even non-shared depth buffers) thus adding zombie entries to mSharedDepthBufferRefs. It later relied on destroySharedDepthBuffer's mSourceType to avoid destroying these. Fixed by only accepting shared depth buffer as input - Due to these zombie entries, negative ref count was possible. Got rid of this and ref count is now unsigned. Underflow is considered an Ogre bug and will assert - Assert if user tries to call _setDepthBufferDefaults on a shared depth buffer - Original version did not release Stencil-only buffers (at the time only iOS supports this) - Added mSharedDepthBufferZeroRefCandidates so that the cost of _cleanupDepthBuffers (which gets called every frame) is almost always O(1), rather than being O(N) where N is the number of live shared depth buffers. - Ported changes to Metal
- Loading branch information
1 parent
ae48695
commit 33bb1b3
Showing
18 changed files
with
201 additions
and
19 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.