Fix #129598: Resample curves node missing type alignment handling #129628
No reviewers
Labels
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset System
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Code Documentation
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
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
Viewport & EEVEE
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Asset Browser Project
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
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
Module
Viewport & EEVEE
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Severity
High
Severity
Low
Severity
Normal
Severity
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#129628
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "HooglyBoogly/blender:fix-resample-curves-matrix-alignment"
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 4x4 matrix type has a larger alignment requirement of 16 bytes
than the default, but it was stored in a generic vector of bytes. There
are a few solutions that reduce the memory reuse in this code path--
the chosen solution uses a custom allocator which always allocates
with an alignment that should be large enough for anything.
Generally I think this resampling loop could be rewritten to be a bit
simpler, avoiding these problems in the first place. Some performance
testing would show whether this "fancy" memory use between types
and loop structure is actually worth it. For now though, just correcting
the existing logic seems like the best choice.
@blender-bot build
@blender-bot build
@blender-bot build windows
@blender-bot build
@ -54,0 +57,4 @@
* reusing an allocation between multiple types that have different alignment requirements. The
* default alignment template parameter should be large enough for any type in practice.
*/
template<size_t Alignment = 64ul> class GuardedAlignedAllocator {
I think this can be part of
GuardedAllocator
with compile time switch inallocate()
/(Maybe in 4.4 only...)
@ -284,2 +284,3 @@
selection.foreach_segment(GrainSize(512), [&](const IndexMaskSegment selection_segment) {
Vector<std::byte> evaluated_buffer;
/* Use a default alignment that works for all attribute types. */
Vector<std::byte, 512, GuardedAlignedAllocator<>> evaluated_buffer;
I see fix of heap allocation alignment.
Before there was 4 inline
byte
's so matrix never fit into inline buffere.But now there is large inline buffere and i do not see how its aligment is ensured for matrix.
Hmm, good point! I'll split the inline buffer to a separate
std::array
and use the vector just for when it doesn't fit+1 to something like
bke::attribute_math::least_aligment
instead of hardcoded constant/@blender-bot build
@ -246,0 +247,4 @@
* Buffer for temporary evaluated curve data, used for memory reuse between multiple attributes of
* different types.
*/
struct EvalDataBuffer {
Seems to be something that could be abstracted further for use in other files. For now this is fine though.
Yeah, agreed. I'd like to try refactoring this code first to see if the abstraction sticks. Feels like a shared abstraction should be on a slightly lower level like
GVector
.@ -246,0 +254,4 @@
Vector<std::byte, 0, AllocatorType> heap_allocated;
alignas(AllocatorType::min_alignment) std::array<std::byte, 1024> inline_buffer;
template<typename T> MutableSpan<T> get_size(const int64_t size)
get_size
seems like a a somewhat bad name. I'd probably call itresize
or so.Much better, thanks.
@blender-bot build