Core: Add ObjectRuntime::last_update transform, geometry and shading #115196

Merged
Miguel Pozo merged 8 commits from pragma37/blender:pull-recalc-last_updated into main 2023-11-27 12:03:27 +01:00
Member

Implemented following the design from #114112
#114112 (comment)

Implemented following the design from #114112 https://projects.blender.org/blender/blender/issues/114112#issuecomment-1065285
Miguel Pozo added the
Module
Core
label 2023-11-20 17:16:29 +01:00
Miguel Pozo added 3 commits 2023-11-20 17:16:43 +01:00
Clément Foucault requested review from Sergey Sharybin 2023-11-21 16:25:15 +01:00
Miguel Pozo added 1 commit 2023-11-21 16:59:04 +01:00
Miguel Pozo changed title from WIP: Core: Add ObjectRuntime::last_update transform, geometry and shading to Core: Add ObjectRuntime::last_update transform, geometry and shading 2023-11-21 17:00:51 +01:00
Miguel Pozo added a new dependency 2023-11-21 17:08:18 +01:00
Sergey Sharybin requested changes 2023-11-21 17:49:03 +01:00
Sergey Sharybin left a comment
Owner

Materials can be either on object or geometry level. So to cover all cases build_materials should receive an ID of the "owner" of the materials, and the links are to to be added in build_material. Also, a link from geometry's SHADING to object SHADING would need to be added (unless it is already happening).

Materials can be either on object or geometry level. So to cover all cases `build_materials` should receive an `ID` of the "owner" of the materials, and the links are to to be added in `build_material`. Also, a link from geometry's SHADING to object SHADING would need to be added (unless it is already happening).
@ -35,6 +35,7 @@ namespace deg = blender::deg;
static void deg_flush_updates_and_refresh(deg::Depsgraph *deg_graph)
{
deg_graph->update_count++;

Wouldn't it be better (or even more correct) to do this in the deg_evaluate_on_refresh after the check for whether there are actual update tags?

Wouldn't it be better (or even more correct) to do this in the `deg_evaluate_on_refresh` after the check for whether there are actual update tags?
pragma37 marked this conversation as resolved
Miguel Pozo added 2 commits 2023-11-22 18:16:24 +01:00
Author
Member

I couldn't figure out how to get the Geometry Shading -> Object Shading to work without adding a dummy operation_node callback for geometry shading.
Is that the intended way to do it?

Also, something not directly related to this patch, but I've noticed that build_object_data passes the geometry-owned materials to build_materials, while build_object_data_geometry passes the object-owned materials.
I think it doesn't matter in practice, but shouldn't be the other way around?

I couldn't figure out how to get the `Geometry Shading -> Object Shading` to work without adding a dummy `operation_node` callback for geometry shading. Is that the intended way to do it? Also, something not directly related to this patch, but I've noticed that `build_object_data` passes the geometry-owned materials to `build_materials`, while `build_object_data_geometry` passes the object-owned materials. I think it doesn't matter in practice, but shouldn't be the other way around?
Miguel Pozo requested review from Sergey Sharybin 2023-11-24 15:37:09 +01:00

I couldn't figure out how to get the Geometry Shading -> Object Shading to work without adding a dummy operation_node callback for geometry shading.
Is that the intended way to do it?

You indeed need to create operation node, but instead of providing no-op callback you should omit the callback completely. This will give the graph possibility to do some internal optimizations. Something like this should work: add_operation_node((ID *)object->data, NodeType::SHADING, OperationCode::SHADING);

Also, something not directly related to this patch, but I've noticed that build_object_data passes the geometry-owned materials to build_materials, while build_object_data_geometry passes the object-owned materials.
I think it doesn't matter in practice, but shouldn't be the other way around?

The naming seems to be confusing and is to be updated. The build_object_data_geometry builds nodes needed for the object geometry component. While it mentions "data" in the name this seems wrong, as all operations happens on the object level there. The build_object_data builds object->data. So i think what is passed to the build_materials is correct, but indeed it will be nice to have a pass on the naming clarification.

> I couldn't figure out how to get the Geometry Shading -> Object Shading to work without adding a dummy operation_node callback for geometry shading. > Is that the intended way to do it? You indeed need to create operation node, but instead of providing no-op callback you should omit the callback completely. This will give the graph possibility to do some internal optimizations. Something like this should work: `add_operation_node((ID *)object->data, NodeType::SHADING, OperationCode::SHADING);` > Also, something not directly related to this patch, but I've noticed that `build_object_data` passes the geometry-owned materials to `build_materials`, while `build_object_data_geometry` passes the object-owned materials. > I think it doesn't matter in practice, but shouldn't be the other way around? The naming seems to be confusing and is to be updated. The `build_object_data_geometry` builds nodes needed for the object geometry component. While it mentions "data" in the name this seems wrong, as all operations happens on the object level there. The `build_object_data` builds `object->data`. So i think what is passed to the `build_materials` is correct, but indeed it will be nice to have a pass on the naming clarification.
Miguel Pozo added 2 commits 2023-11-24 16:44:49 +01:00

@blender-bot build

@blender-bot build
Sergey Sharybin approved these changes 2023-11-27 11:42:42 +01:00
Sergey Sharybin left a comment
Owner

Tested with Pets animation file, and did not see any issues with the relations or impact on the performance.

Tested with Pets animation file, and did not see any issues with the relations or impact on the performance.
Miguel Pozo merged commit 78de9138e5 into main 2023-11-27 12:03:27 +01:00
Miguel Pozo deleted branch pull-recalc-last_updated 2023-11-27 12:03:29 +01:00

This commit (78de9138e5) broke 18 unittests in Debug builds!

add_operation: Operation already exists - [Shading Component] : (affects_visible_id: false) has SHADING() at 0x612000823278
BLI_assert failed: source/blender/depsgraph/intern/builder/deg_builder_nodes.cc:261, add_operation_node(), at '0'
  Should not happen!

Please build and run debug before committing changes!

This commit (78de9138e593ee0c967e132c45d7c6d5e66e9e96) broke 18 unittests in Debug builds! ``` add_operation: Operation already exists - [Shading Component] : (affects_visible_id: false) has SHADING() at 0x612000823278 BLI_assert failed: source/blender/depsgraph/intern/builder/deg_builder_nodes.cc:261, add_operation_node(), at '0' Should not happen! ``` Please build and run debug before committing changes!

Looks like this is already handled in PR actually: !115615

Looks like this is already handled in PR actually: !115615
Sign in to join this conversation.
No reviewers
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
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Reference: blender/blender#115196
No description provided.