Overlay-Next #102179
Labels
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset System
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
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
5 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#102179
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
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?
Update Overlay engine to leverage the new capabilities of the new draw manager.
The motivations for this are:
Requires #102177 (Draw: Selection Next)
Testing
Overlay Next code can be tested by enabling the associated experimental feature.
For testing selection, restarting after enabling the experimental feature is required. Otherwise it produces a crash because of shader sharing with legacy overlay.
Tasks
Meta:
Optimization
Complex:
Medium:
Easy:
Bug:
Follow up:
Armatures::DrawContext
by renaming them withlegacy_
prefix.select_invalid_id
toselect::ID::invalid()
Added subscriber: @Jeroen-Bakker
Draw: Overlay-Nextto Overlay-NextThe engine design is now complete. Help with the port is welcomed.
Porting requires a bit of work but everything is clearer than the old implementation:
DRWCallBuffer
are replaced byShapeInstanceBuf
with the data type declared inoverlay_shader_shared.hh
.GPUBatch
for each shape (not object geometry) should be ported fromdraw_cache.c
tooverlay_shape.hh
.GPUShader
creation used must be ported tooverlay_shader.cc
tooverlay_shader.hh
.Look
overlay_empty.hh
drawing for a simple example of shape drawing.Look
overlay_prepass.hh
drawing for a simple example of object drawing.I have sorted the list of task by degrees of complexity.
Try to stick to the level of code quality this rewrite is at. Use
float4x4
and the blender vector types instead of blender C vector/matrix API when possible.Note that the Basic engine is going to be merged to the overlay engine for selection purpose. This means the basic engine features (such as conservative raster for selection) need to be ported.
Germano Cavalcante referenced this issue2023-09-23 03:10:14 +02:00
Ah I was looking at doing edit overlay for GPv3 but looks like it is giving me too many shader errors for now 🤔 so maybe not at the moment, but I'll keep an eye on this :D
@ChengduLittleA What shader errors? Related to the current main? or related to your branch? Yesterday I found out there were some GL errors but not shader errors. Please report them in the chat.
@fclem current main.
Reproducible via:
ERROR (gpu.shader): overlay_extra VertShader:
|
1598 | select_id = id;
|
| select_lib.glsl:15:0: Error: C1503: undefined variable "select_id"
|
1683 | select_id_set(in_select_buf[gl_InstanceID]);
|
| overlay_extra_vert.glsl:48:0: Error: C1503: undefined variable "in_select_buf"
ERROR (gpu.shader): overlay_extra FragShader:
|
1565 | if (select_info_buf.mode == SELECT_ALL) {
|
| select_lib.glsl:27:0: Error: C1503: undefined variable "select_info_buf"
| select_lib.glsl:27:0: Error: C1503: undefined variable "SELECT_ALL"
|
1567 | atomicOr(out_select_buf[id / 32u], 1u << (uint(id) % 32u));
|
| select_lib.glsl:29:0: Error: C1503: undefined variable "out_select_buf"
|
1569 | else if (select_info_buf.mode == SELECT_PICK_ALL) {
|
| select_lib.glsl:31:0: Error: C1503: undefined variable "select_info_buf"
| select_lib.glsl:31:0: Error: C1503: undefined variable "SELECT_PICK_ALL"
|
1571 | atomicMin(out_select_buf[id], floatBitsToUint(gl_FragCoord.z));
|
| select_lib.glsl:33:0: Error: C1503: undefined variable "out_select_buf"
|
1573 | else if (select_info_buf.mode == SELECT_PICK_NEAREST) {
|
| select_lib.glsl:35:0: Error: C1503: undefined variable "select_info_buf"
| select_lib.glsl:35:0: Error: C1503: undefined variable "SELECT_PICK_NEAREST"
|
1577 | ivec2 coord = abs(ivec2(gl_FragCoord.xy) - select_info_buf.cursor);
|
| select_lib.glsl:39:0: Error: C1503: undefined variable "select_info_buf"
|
1585 | atomicMin(out_select_buf[id], (depth << 8u) | dist);
|
| select_lib.glsl:47:0: Error: C1503: undefined variable "out_select_buf"
|
1603 | select_id_output(select_id);
|
| overlay_extra_frag.glsl:13:0: Error: C1503: undefined variable "select_id"
ERROR (gpu.shader): overlay_extra_wire VertShader:
|
1601 | select_id = id;
|
| select_lib.glsl:15:0: Error: C1503: undefined variable "select_id"
|
1654 | select_id_set(drw_CustomID);
|
| overlay_extra_wire_vert.glsl:16:0: Error: C1503: undefined variable "drw_CustomID"
ERROR (gpu.shader): overlay_extra_wire FragShader:
|
1570 | if (select_info_buf.mode == SELECT_ALL) {
|
| select_lib.glsl:27:0: Error: C1503: undefined variable "select_info_buf"
| select_lib.glsl:27:0: Error: C1503: undefined variable "SELECT_ALL"
|
1572 | atomicOr(out_select_buf[id / 32u], 1u << (uint(id) % 32u));
|
| select_lib.glsl:29:0: Error: C1503: undefined variable "out_select_buf"
|
1574 | else if (select_info_buf.mode == SELECT_PICK_ALL) {
|
| select_lib.glsl:31:0: Error: C1503: undefined variable "select_info_buf"
| select_lib.glsl:31:0: Error: C1503: undefined variable "SELECT_PICK_ALL"
|
1576 | atomicMin(out_select_buf[id], floatBitsToUint(gl_FragCoord.z));
|
| select_lib.glsl:33:0: Error: C1503: undefined variable "out_select_buf"
|
1578 | else if (select_info_buf.mode == SELECT_PICK_NEAREST) {
|
| select_lib.glsl:35:0: Error: C1503: undefined variable "select_info_buf"
| select_lib.glsl:35:0: Error: C1503: undefined variable "SELECT_PICK_NEAREST"
|
1582 | ivec2 coord = abs(ivec2(gl_FragCoord.xy) - select_info_buf.cursor);
|
| select_lib.glsl:39:0: Error: C1503: undefined variable "select_info_buf"
|
1590 | atomicMin(out_select_buf[id], (depth << 8u) | dist);
|
| select_lib.glsl:47:0: Error: C1503: undefined variable "out_select_buf"
|
1631 | select_id_output(select_id);
|
| overlay_extra_wire_frag.glsl:36:0: Error: C1503: undefined variable "select_id"
ERROR (gpu.shader): overlay_extra_wire VertShader:
|
1355 | select_id = id;
|
| select_lib.glsl:15:0: Error: C1503: undefined variable "select_id"
|
1408 | select_id_set(drw_CustomID);
|
| overlay_extra_wire_vert.glsl:16:0: Error: C1503: undefined variable "drw_CustomID"
ERROR (gpu.shader): overlay_extra_wire FragShader:
|
1321 | if (select_info_buf.mode == SELECT_ALL) {
|
| select_lib.glsl:27:0: Error: C1503: undefined variable "select_info_buf"
| select_lib.glsl:27:0: Error: C1503: undefined variable "SELECT_ALL"
|
1323 | atomicOr(out_select_buf[id / 32u], 1u << (uint(id) % 32u));
|
| select_lib.glsl:29:0: Error: C1503: undefined variable "out_select_buf"
|
1325 | else if (select_info_buf.mode == SELECT_PICK_ALL) {
|
| select_lib.glsl:31:0: Error: C1503: undefined variable "select_info_buf"
| select_lib.glsl:31:0: Error: C1503: undefined variable "SELECT_PICK_ALL"
|
1327 | atomicMin(out_select_buf[id], floatBitsToUint(gl_FragCoord.z));
|
| select_lib.glsl:33:0: Error: C1503: undefined variable "out_select_buf"
|
1329 | else if (select_info_buf.mode == SELECT_PICK_NEAREST) {
|
| select_lib.glsl:35:0: Error: C1503: undefined variable "select_info_buf"
| select_lib.glsl:35:0: Error: C1503: undefined variable "SELECT_PICK_NEAREST"
|
1333 | ivec2 coord = abs(ivec2(gl_FragCoord.xy) - select_info_buf.cursor);
|
| select_lib.glsl:39:0: Error: C1503: undefined variable "select_info_buf"
|
1341 | atomicMin(out_select_buf[id], (depth << 8u) | dist);
|
| select_lib.glsl:47:0: Error: C1503: undefined variable "out_select_buf"
|
1382 | select_id_output(select_id);
|
| overlay_extra_wire_frag.glsl:36:0: Error: C1503: undefined variable "select_id"
ERROR (gpu.shader): overlay_extra_groundline VertShader:
|
1351 | select_id = id;
|
| select_lib.glsl:15:0: Error: C1503: undefined variable "select_id"
|
1399 | select_id_set(in_select_buf[gl_InstanceID]);
|
| overlay_extra_groundline_vert.glsl:11:0: Error: C1503: undefined variable "in_select_buf"
ERROR (gpu.shader): overlay_extra_groundline FragShader:
|
1319 | if (select_info_buf.mode == SELECT_ALL) {
|
| select_lib.glsl:27:0: Error: C1503: undefined variable "select_info_buf"
| select_lib.glsl:27:0: Error: C1503: undefined variable "SELECT_ALL"
|
1321 | atomicOr(out_select_buf[id / 32u], 1u << (uint(id) % 32u));
|
| select_lib.glsl:29:0: Error: C1503: undefined variable "out_select_buf"
|
1323 | else if (select_info_buf.mode == SELECT_PICK_ALL) {
|
| select_lib.glsl:31:0: Error: C1503: undefined variable "select_info_buf"
| select_lib.glsl:31:0: Error: C1503: undefined variable "SELECT_PICK_ALL"
|
1325 | atomicMin(out_select_buf[id], floatBitsToUint(gl_FragCoord.z));
|
| select_lib.glsl:33:0: Error: C1503: undefined variable "out_select_buf"
|
1327 | else if (select_info_buf.mode == SELECT_PICK_NEAREST) {
|
| select_lib.glsl:35:0: Error: C1503: undefined variable "select_info_buf"
| select_lib.glsl:35:0: Error: C1503: undefined variable "SELECT_PICK_NEAREST"
|
1331 | ivec2 coord = abs(ivec2(gl_FragCoord.xy) - select_info_buf.cursor);
|
| select_lib.glsl:39:0: Error: C1503: undefined variable "select_info_buf"
|
1339 | atomicMin(out_select_buf[id], (depth << 8u) | dist);
|
| select_lib.glsl:47:0: Error: C1503: undefined variable "out_select_buf"
|
1357 | select_id_output(select_id);
|
| overlay_extra_frag.glsl:13:0: Error: C1503: undefined variable "select_id"
I was a bit surprised that the drawing performance was worse in very simple scene on a M1 iMac. So I dig into some performance profiling. These insights should also apply to all "Next" engines.
Clear operation
The clear operation on overlay_line_fb at the start is suboptimal. It is better to selectively clear the color on the first framebuffer that uses the overlay color. However, this mean we have to clear the line buffer somewhere else (since it is only used later on). We need to figure out the best framebuffer / draw order. Ideally, we should draw to the line buffer first.
PassMain Compute
The dispatch issued from
PassMain
create bubbles and pipeline stall for some reasons. Best avoid usingPassMain
when possible. Since it is required in some cases, we need to find a system that dispatch all culling and command finalize dispatch at the start of the engine when the passes are known to be finished. Maybe having aManager::warm(PassMain, View)
and calling all that on all passes that needs it.It should be noted that even passes that are empty currently dispatch some compute shader work. That should also be fixed.
GPU debug overhead
When profiling, one must disable
draw::Texture::debug_clear()
. It introduces a lot of clear operations that are not existing in the legacy API (thus, not there in Overlay Legacy).@fclem
What needs to be done for "Curves"? In object mode they are already drawn;
What is meant by "Pose bone select" and "Fade"?
@laurynas
OVERLAY_pose_draw
.OVERLAY_fade_draw
I was investigating crash when switching to shading workspace, and realized this happens with overlay next. Don't see this mentioned here, so in case you are not aware, here is trace:
Trace
draw::overlay::State::rv3d
was null inFeel free to repoen #127477 if this should be reported on tracker already.