Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move the ResourceAllocator from Engine to Renderer #7993

Merged
merged 2 commits into from
Jul 26, 2024
Merged

Move the ResourceAllocator from Engine to Renderer #7993

merged 2 commits into from
Jul 26, 2024

Conversation

pixelflinger
Copy link
Collaborator

The ResourceAllocator used to be global and owned by the Engine, this was causing some issues when using several Renderers because each one could cause the eviction of cache data for another.

We now have a ResourceAllocator per Renderer, which makes more sense because most resources are allocated by the FrameGraph.

We also introduce a ResourceAllocatorDisposer class, which is used for checking in and out a texture from the cache, and destroy the texture when it's checked-out. That objet is still global.

@pixelflinger pixelflinger added the internal Issue/PR does not affect clients label Jul 23, 2024
filament/include/filament/View.h Outdated Show resolved Hide resolved
filament/src/ResourceAllocator.cpp Outdated Show resolved Hide resolved
filament/test/filament_framegraph_test.cpp Outdated Show resolved Hide resolved
The ResourceAllocator used to be global and owned by the Engine, this
was causing some issues when using several Renderers because each
one could cause the eviction of cache data for another.

We now have a ResourceAllocator per Renderer, which makes more sense
because most resources are allocated by the FrameGraph.

We also introduce a ResourceAllocatorDisposer class, which is used
for checking in and out a texture from the cache, and destroy the
texture when it's checked-out. That objet is still global.
Add Renderer::skipFrame() which should be called when intentionally 
skipping frames, for instance because the screen content hasn't changed,
allowing Filament to performance needed periodic tasks, such as
cache garbage collection and callback dispatches.

We also improve the ResourceAllocator cache eviction policy:
- the cache is aggressively purged when skipping a frame
- we aggressively evict entries older than 3 frames

The default Config is now set to a more agressive setting.
@pixelflinger pixelflinger merged commit e7c96cd into main Jul 26, 2024
11 checks passed
@pixelflinger pixelflinger deleted the ma/gc branch July 26, 2024 00:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
internal Issue/PR does not affect clients
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants