makesdna: Give suggestions for fix #110145
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#110145
Loading…
Reference in New Issue
No description provided.
Delete Branch "LazyDodo/blender:tmp_makesdna"
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?
Give feedback on how many padding bytes are required and where to put
them.
Heads up : The code change is really irrelevant
It's a one liner, it's uncontroversial, it have comfortably landed
without going though the review process. The patch description isn't
very relevant to the problem it fixes but more of a general critique
on the overall state of makesdna. target audience : The Core Module
Background motivation
Someone on chat asked for help , and makesdna was being "unhelpful"
in my opion towards this dev, offering no useful suggestions how to
resolve their problem.
Repro
put an
int oh_no_i_broke_things;
just before thecoba_weight
fieldin the
UesrDef
struct and you'll be met with the following "helpful"information.
The check in question
Oh so little code, so many problems (and this patch will attempt to
fix just one of them, its only goals is to provide a helpful message
to the developer having issues, but feels like makesdna could use some
love)
No attempt is made to offer a solution, while one is clearly known,
kinda mean...
Makesdna is generally architecture agnostic, checks are being done
for both 64 bit and 32 bit. This one is protected by a
sizeof(void *) == 8
check. Which is a little fishyIf you do not know this code very well,
(size_native % 8)
feelslike this is about the size of the struct in question. You'd be wrong
though
size_native
is the offset in the parent structure where itis used. A bit counter intuitive, so even if a dev goes "I don't know
what this means" and goes to lookup the error in makesdna, they are
likely to be mislead, kinda mean...
And then there's the alignment check itself which isn't inline with
what is actually required. The only reason this check works, it checks
for the worst case scenario (8), the actual alignment requirements are
"The largest native size in any of the sub structures" ie if an
embedded struct only has
int16_t
's in it, there is no need to alignthis to 8 bytes, 2 would have done just fine. We're being kinda
wasteful here.
Final score for 4 lines of code :
2x kinda mean
1x kinda fishy
1x kinda wasteful
We should be able to do better than this, no?
Future ?
makesdna is old code, we don't like touching it, and it's starting
to show its age a little bit, it's not very maintainable by
anyone except a few core devs that babysat it all its life. If
we have a list of work we know needs to be done, but that no-one
is going to volunteer for a rewrite of makesdna will be our shining
beacon on top of that list.
Interesting how we both sought to fix this at pretty much the same time. My PR is in #110291 and landed, but I agree that this PR is doing the better thing -- it's clearer for the developer who reads the message what to do about it.
Pull request closed