Remove unnecessary mesh position copying #103789

Closed
opened 2023-01-10 18:47:02 +01:00 by Hans Goudey · 21 comments
Member

Before mesh positions were a generic attribute, they were often copied into a separate array.
This has a performance cost and can now be removed.

  • Remove uses of BKE_mesh_vert_coords_alloc
  • Remove uses of BKE_mesh_vert_coords_get
  • Remove uses of BKE_mesh_vert_coords_apply_with_mat4
  • Remove uses of BKE_mesh_vert_coords_apply
Before mesh positions were a generic attribute, they were often copied into a separate array. This has a performance cost and can now be removed. - [ ] Remove uses of `BKE_mesh_vert_coords_alloc` - [x] Remove uses of `BKE_mesh_vert_coords_get` - [ ] Remove uses of `BKE_mesh_vert_coords_apply_with_mat4` - [ ] Remove uses of `BKE_mesh_vert_coords_apply`
Hamza self-assigned this 2023-01-16 20:36:54 +01:00

I want to work on this as someone new to the blender developer community. If someone can provide some more information about this problem please let me know.

More specifically:
any documentation pages related to this issue
files, classes or packages to be modified.

What I plan on doing is to look in the code for usage of BKE_mesh_vert_coords_* and try to understand the context in which these are used.

I want to work on this as someone new to the blender developer community. If someone can provide some more information about this problem please let me know. More specifically: any documentation pages related to this issue files, classes or packages to be modified. What I plan on doing is to look in the code for usage of BKE_mesh_vert_coords_* and try to understand the context in which these are used.

It seems that you should take into account the work already begun in this area D16971: Mesh: Avoid copying positions in object mode modifier stack .
I mean, there are probably so many places that need to be cleaned up, and if you join the work, there will be more than one person doing it.

It seems that you should take into account the work already begun in this area [D16971: Mesh: Avoid copying positions in object mode modifier stack](https://archive.blender.org/developer/D16971) . I mean, there are probably so many places that need to be cleaned up, and if you join the work, there will be more than one person doing it.

So are you suggesting that I should look for a different "good first issue" as two people working on this issue might cause trouble? or are you suggesting two people working on this might be better?

So are you suggesting that I should look for a different "good first issue" as two people working on this issue might cause trouble? or are you suggesting two people working on this might be better?

Not really, it's just that if several people do the task, I'm not sure who will be the claimer.

And also, you can study the previously done work as an example.

Also, it will be convenient if you have questions, ask them in the chat.

Not really, it's just that if several people do the task, I'm not sure who will be the claimer. And also, you can study the previously done work as an example. Also, it will be convenient if you have questions, ask them in the chat.
Hamza removed their assignment 2023-01-16 20:55:52 +01:00

I saw no one was the claimer here so I claimed it. I can release and find something else to work on.

I saw no one was the claimer here so I claimed it. I can release and find something else to work on.

I really don't want to scare you away from this task. Also, I will give an example of another task that required a lot of work. Pay attention, several people did it #95965 (Mesh Struct of Arrays Refactor)

I really don't want to scare you away from this task. Also, I will give an example of another task that required a lot of work. Pay attention, several people did it #95965 (Mesh Struct of Arrays Refactor)

I am new so it will take some time to understand how things work here.

correct me if I am wrong.

https://developer.blender.org/T95965

and

https://developer.blender.org/T103789

are both related to this issue here and are being worked on by @HooglyBoogly with some progress.

I will try to see what work had been done and what still needs to be done and if my contribution is required and then I will create a new task for this issue if required.

I am new so it will take some time to understand how things work here. correct me if I am wrong. https://developer.blender.org/T95965 and https://developer.blender.org/T103789 are both related to this issue here and are being worked on by @HooglyBoogly with some progress. I will try to see what work had been done and what still needs to be done and if my contribution is required and then I will create a new task for this issue if required.

Not really. At the moment, there are many places in blender where mesh processing involves copying positions into an array.
And, in order not to make a commit of several thousand lines, where all places will be affected, there is a task.
It unites all patches in this direction. One of them was the @HooglyBoogly patch. You can study it and look for where else in blender you can do the same job.
Do not do a bunch of things at once, especially for the first time.
Add a patch with the code and select #103789 (Remove unnecessary mesh position copying) as the task. It also seems to be enough to indicate here in the comments if you want to look at a specific area.
Since one person will most likely redo the entire blender with great difficulty.

Not really. At the moment, there are many places in blender where mesh processing involves copying positions into an array. And, in order not to make a commit of several thousand lines, where all places will be affected, there is a task. It unites all patches in this direction. One of them was the @HooglyBoogly patch. You can study it and look for where else in blender you can do the same job. Do not do a bunch of things at once, especially for the first time. Add a patch with the code and select #103789 (Remove unnecessary mesh position copying) as the task. It also seems to be enough to indicate here in the comments if you want to look at a specific area. Since one person will most likely redo the entire blender with great difficulty.

Also, for questions with the code, in the process of execution, you can go to https://blender.chat/channel/blender-coders

Also, for questions with the code, in the process of execution, you can go to https://blender.chat/channel/blender-coders

This issue was referenced by d20f992322

This issue was referenced by d20f9923224d2637374dd4390ae84c5041e3f9d3
Philipp Oeser removed the
Interest
Modeling
label 2023-02-09 15:27:05 +01:00

@allprogrammers Hey, hello. How's the progress?

@allprogrammers Hey, hello. How's the progress?
Contributor

If this task is not actively pursued anymore by anyone, I'd be more than willing to take it up :)

If this task is not actively pursued anymore by anyone, I'd be more than willing to take it up :)

As I wrote above, it is very wide. So any help is welcome.

As I wrote above, it is very wide. So any help is welcome.
Contributor

There is code where a copy of the vertex positions is actually neccessary and for which BKE_mesh_vert_coords_alloc is used. How are we handling this? Do we have another function for this or do we leave it as it is?

There is code where a copy of the vertex positions is actually neccessary and for which `BKE_mesh_vert_coords_alloc` is used. How are we handling this? Do we have another function for this or do we leave it as it is?
Contributor

Hi @mod_moder @HooglyBoogly. I've found another unnecessary copying and created a PR. Please take a look. Thank you.

Hi @mod_moder @HooglyBoogly. I've found another unnecessary copying and created a PR. Please take a look. Thank you.
Author
Member

There is code where a copy of the vertex positions is actually neccessary and for which BKE_mesh_vert_coords_alloc is used. How are we handling this? Do we have another function for this or do we leave it as it is?

Sorry for missing this question! Eventually it would be nice to copy the data into an Array<float3> or something like that. But it's okay to leave as is too.

> There is code where a copy of the vertex positions is actually neccessary and for which `BKE_mesh_vert_coords_alloc` is used. How are we handling this? Do we have another function for this or do we leave it as it is? Sorry for missing this question! Eventually it would be nice to copy the data into an `Array<float3>` or something like that. But it's okay to leave as is too.

can I help?

can I help?

hey i used grep on linux on the entire source code and i could not find a single instance of "BKE_mesh_vert_coords_get" that should be marked off

hey i used grep on linux on the entire source code and i could not find a single instance of "BKE_mesh_vert_coords_get" that should be marked off

hey i am trying to work on "BKE_mesh_vert_coords_alloc", i put a debug print somewhere i was gonna remove it but nothing, then i tried somewhere else, nothing, not even inside the function, what exactly is this function used for and how do i trigger it?

hey i am trying to work on "BKE_mesh_vert_coords_alloc", i put a debug print somewhere i was gonna remove it but nothing, then i tried somewhere else, nothing, not even inside the function, what exactly is this function used for and how do i trigger it?

it is working now, (dont know what happened)

it is working now, (dont know what happened)

it stopped again?! also i found out that BKE_mesh_vert_coords_apply_with_mat4 is much easier to remove since it is only called once in the entire code, i am going to work on that

it stopped again?! also i found out that BKE_mesh_vert_coords_apply_with_mat4 is much easier to remove since it is only called once in the entire code, i am going to work on that
Sign in to join this conversation.
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
8 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#103789
No description provided.