Overlay Next: Refactor #107734

Merged
Miguel Pozo merged 39 commits from pragma37/blender:pull-overlay-next-refactor into main 2023-05-23 15:00:46 +02:00
Member

Refactor of #107045, replacing templates with construction time booleans.

Additionally:

  • Use the overlay_next prefix for files.
  • Splits the cold code paths into header/implementation files.
  • Replaces the RAII wrappers for GPUShader and GPUBatch with unique_ptr.
Refactor of #107045, replacing templates with construction time booleans. Additionally: - Use the `overlay_next` prefix for files. - Splits the cold code paths into header/implementation files. - Replaces the RAII wrappers for `GPUShader` and `GPUBatch` with `unique_ptr`.
Miguel Pozo added the
Module
EEVEE & Viewport
label 2023-05-08 12:47:41 +02:00
Miguel Pozo added 35 commits 2023-05-08 12:47:56 +02:00
f0514484f5 DRW: Wrappers: Add TextureRef to wrap around GPUTexture pointers
This adds the possibility to use the C++ API for other GPUTexture.
968f5748c6 Merge branch 'main' into overlay-next
# Conflicts:
#	release/scripts/startup/bl_ui/space_userpref.py
#	source/blender/makesdna/DNA_userdef_types.h
#	source/blender/makesrna/intern/rna_userdef.c
cdb9b6a041 Overlay-Next: Add support for empties
Also added a shape cache and move the color selection to `Resources`.
ef0126f3a7 Merge branch 'main' into overlay-next
# Conflicts:
#	source/blender/makesdna/DNA_userdef_types.h
84ff44769f Overlay-Next: Add high level separation of selection code
This makes it possible to reuse the overlay engine code for selection
purpose, but without any overhead for the viewport drawing.

The separation is made clear by having a dummy selection implementation for
viewport drawing and an object implementation for object selection.
Other impementation might come later (like for depth picking).
78ae27bab3 Overlay-Next: Add depth Prepass basics
The depth prepass is supposed to replace the Basic engine:
- Draw object depth when the engine doesn't give correct depth buffer
- Used for object selection
16cc2446f5 Overlay-Next: Add shader module
This allows cleaner declarations of shaders as well as allowing easier
swapping of the whole shader module for selection & clipping.

This also allow to easier toggle between the old overlay engine and
overlay-next as they don't share the same shaders anymore.
ea66898bbe Select-Next: Introduce shader level patching to output selection ids
This leverage imageLoad/Store operations to remove the use of cumbersome
visibility queries.

Patching shaders should only require 4 lines of code (2 for includes, 2 for
the id passthrough).
3ac54f67bf Select-Next: Add result buffer injection
This allow compatibility with the old system.
7676b627c2 Merge branch 'main' into overlay-next
# Conflicts:
#	source/blender/draw/engines/select/select_engine.c
#	source/blender/draw/engines/select/shaders/infos/select_id_info.hh
Miguel Pozo added this to the EEVEE & Viewport project 2023-05-08 12:48:24 +02:00
Miguel Pozo requested review from Jeroen Bakker 2023-05-08 12:48:38 +02:00
Miguel Pozo requested review from Clément Foucault 2023-05-08 12:48:48 +02:00
Miguel Pozo added 1 commit 2023-05-08 17:03:40 +02:00
96b8a8cbba Move the hot path back to header files
Revert a 5% performance decrease caused by the hh/cc split.
Clément Foucault requested changes 2023-05-15 17:43:36 +02:00
Clément Foucault left a comment
Member

There is still quite a lot of TODOs in the code. Some are rather low hanging fruits that would improve code quality (like in overlay_next_instance.cc).

But the core of the code is good to go.

Will test it on Metal too.

There is still quite a lot of TODOs in the code. Some are rather low hanging fruits that would improve code quality (like in overlay_next_instance.cc). But the core of the code is good to go. Will test it on Metal too.
@ -0,0 +29,4 @@
background_type = BG_SOLID;
color_override[3] = 1.0f;
}
/*

Why is this commented?

Why is this commented?
Author
Member

I think it's because the space type is not stored anywhere yet.
You probably just forgot to add the TODO.

Just for reference, I haven't looked into most of the code yet.
This is 99% your patch, just without the templates (so you could provide feedback) and some minimal changes.

I think it's because the space type is not stored anywhere yet. You probably just forgot to add the TODO. Just for reference, I haven't looked into most of the code yet. This is 99% your patch, just without the templates (so you could provide feedback) and some minimal changes.
fclem marked this conversation as resolved
@ -0,0 +1,267 @@
/* SPDX-License-Identifier: GPL-2.0-or-later

What is the reasonning on combining all the headers inside this one? The goal of split headers is also to ease code searchability / readability.

What is the reasonning on combining all the headers inside this one? The goal of split headers is also to ease code searchability / readability.
Author
Member

Initially, when I moved the implementations to their on cc files I moved all declarations to the same header (Workbench Next style).
I personally find it more readable to have all the declarations together, especially if you're looking at the code for the first time.

Then when we moved almost everything back to headers only the shared classes stayed in the private header.

Initially, when I moved the implementations to their on cc files I moved all declarations to the same header (Workbench Next style). I personally find it more readable to have all the declarations together, especially if you're looking at the code for the first time. Then when we moved almost everything back to headers only the shared classes stayed in the private header.
@ -0,0 +24,4 @@
namespace blender::draw::select {
enum class eSelectionType { DISABLED = 0, ENABLED = 1 };

remove e prefix

remove `e` prefix
Author
Member

What's the rule here?
All the enums (at least most of them?) in the code base have the e prefix.

What's the rule here? All the enums (at least most of them?) in the code base have the `e` prefix.

There was a decision (or discussion, I cannot find it at the moment) not so long ago to not use that prefix as it isn't clear and enums are usually called Types or something else that indicates they are enums.

This hasn't been applied to the whole codebase that's why most of them remains.

There was a decision (or discussion, I cannot find it at the moment) not so long ago to not use that prefix as it isn't clear and enums are usually called `Types` or something else that indicates they are enums. This hasn't been applied to the whole codebase that's why most of them remains.
Author
Member

Ok, good to know!

Ok, good to know!
pragma37 marked this conversation as resolved
Clément Foucault reviewed 2023-05-15 18:33:47 +02:00
@ -0,0 +22,4 @@
state.depsgraph = ctx->depsgraph;
state.view_layer = ctx->view_layer;
state.scene = ctx->scene;
state.v3d = ctx->v3d;

The overlay instance can be called for 2D views. This is something that we might want to revisit at some point but that would not be a huge refactor to do. So I would just suggest to check for state.v3d != nullptr and state.rv3d != nullptr for anything that need to access them.

The overlay instance can be called for 2D views. This is something that we might want to revisit at some point but that would not be a huge refactor to do. So I would just suggest to check for `state.v3d != nullptr` and `state.rv3d != nullptr` for anything that need to access them.
pragma37 marked this conversation as resolved
Miguel Pozo added 1 commit 2023-05-17 13:36:33 +02:00
Miguel Pozo added 2 commits 2023-05-17 16:23:50 +02:00
Clément Foucault approved these changes 2023-05-22 10:41:31 +02:00
Miguel Pozo merged commit 9ae2dd577a into main 2023-05-23 15:00:46 +02:00
Miguel Pozo deleted branch pull-overlay-next-refactor 2023-05-23 15:00:47 +02:00
Howard Trickey referenced this issue from a commit 2023-05-29 02:51:37 +02:00
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 Assignees
2 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#107734
No description provided.