Realtime Compositor: Add static cached images #115511
No reviewers
Labels
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
3 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#115511
Loading…
Reference in New Issue
No description provided.
Delete Branch "OmarEmaraDev/blender:compositor-cached-images"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The Realtime compositor currently relies on the GPU cache in image IDs.
That cache only supports single layer images, so multi-layer images will
be acquired without a cache, introducing significant IO bottlenecks for
the GPU compositor.
This patch ignores the image GPU cache and stores the images in the
static cache manager of the compositor. Draw data was introduced to the
image ID for proper cache invalidation, like other IDs such as masks.
The downside is that the cache will no longer be shared between EEVEE
and the compositor. But realistically, images are not typically shared
between materials and compositors.
This is just a temporary solution until we have proper GPU storage
support for image buffers.
WIP: Realtime Compositor: Add static cached imagesto Realtime Compositor: Add static cached imagesDo you have some test file you used to test this?
I was testing with the
boat_wheel-lookdev
file and didn't seem to experience a speedup, even by leaving a single multi-layer image and some math nodes. Not sure if that is already supposed to work, or it has different bottlenecks even in much simplified configuration.@Sergey It is expected that this doesn't work yet, because of the depsgraph issue we discussed before.
@OmarEmaraDev Ah, right!
@brecht To me the change seems to be fine for until we have a deeper re-design in-place. I tested it on the user side and with some extra changes (see later) it works pretty nice. Would you be able to check it from the code side?
For that extra thing case. Currently depsgraph does special tag when ID is "pulled" into the depsgraph .This happens in the
graph_tag_ids_for_visible_update
. Now, the Image datablock is tagged for the flag 0, which kind of mis-communicates the fact that image is changed and cache is no longer to be trusted.I think we can modify the code there in the following way:
I think it is fine, since if the ID is not covered by the "DEG COW" it doesn't have real evlauation, and tagging is not needed. But would be nice to have this idea verified by someone else :)
If this proposal is correct, then this PR and the proposed extra change leads to quite nice performance imrovement.
Omar Emara referenced this pull request2023-12-07 10:47:26 +01:00
This looks fine overall, just one thing I noticed.
@ -339,2 +342,2 @@
/* TODO: implement? */
return IDRecalcFlag(0);
DrawEngineType *owner = (DrawEngineType *)this;
DrawData *draw_data = DRW_drawdata_ensure(id, owner, sizeof(DrawData), nullptr, nullptr);
query_id_recalc_flag
is used for movieclips, masks and textures. I don't think those should get drawdata?No code was added to free such draw data, as was done for images.
@brecht MovieClips, Masks, and Textures got the same code in previous commits. Their BKE free data function have the appropriate
DRW_drawdata_free
, and draw data exist as part of the ID structure.Or do you mean something else?
Ah, I missed that it was already there.
No problem then.
@blender-bot build