Refactor Render Result to allow implicit buffer sharing #108045
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#108045
Loading…
Reference in New Issue
No description provided.
Delete Branch "Sergey/blender:render_result_implicit_sharing"
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?
Allows to share buffer data between the render result and image buffers.
The storage of the passes and buffers in the render result have been
wrapped into utility structures, with functions to operate on them.
Currently only image buffers which are sharing buffers with the render
results are using the implicit sharing. This allows proper decoupling of
the image buffers from the lifetime of the underlying render result.
Fixes #107248: Compositor ACCESS VIOLATION when updating datablocks from handlers
Additionally, this lowers the memory usage of multi-layer EXR sequences
by avoiding having two copies of render passes in memory.
It is possible to use implicit sharing in more places, but needs
some API to ensure the render result is the only owner of data before
writing to its pixels.
It looks like some of the logic here could be replaced with the helper functions in
BLI_implicit_sharing.hh
:copy_shared_pointer
free_shared_data
info_for_mem_free
Even if things get more specific here in the future (less reusable), for now I think it's better to share whatever part of the logic we can, since it makes the patterns much more recognizable and reduces boilerplate.
@ -173,0 +176,4 @@
* Note on the implicit sharing
* ----------------------------
*
* The buffer allows to implicitly share data with other users of such data. In this case the
Grammar:
allows to implicitly share
->allows implicitly sharing
The implicit sharing stuff seems quite low level and error prone, I feel like this and other places could benefit from a
ImplicitSharingVector
type similar toImplicitSharingPtr
. But that could require all files using image buffers to be C++, so is an idea for later.Just one minor comment on the implementation.
@ -1300,3 +1300,3 @@
* Since we now include paths, I stretched it a bit. Hope this is enough :). */
char str[SDNA_MAX_FILENAME_LENGTH];
sprintf(str, "%s%s", base_directory, includefiles[i]);
snprintf(str, sizeof(str), "%s%s", base_directory, includefiles[i]);
Use
BLI_snprintf
,snprintf
is unsafe.We don't link against bf_blenlib, so would need to add the string.c to the makesdna target. Doable, but this entire change is not related to the implicit sharing. Something I was looking into to fix warning and never finished, and committed to this branch by accident.