Commit Graph

8972 Commits

Author SHA1 Message Date
Clément Foucault
4441987e05 Fix #131131: Overlay Next: Clip view crashes Blender
Was simply a missing access to global uniform.
2024-11-29 12:12:53 +01:00
Jeroen Bakker
f5d9f65925 Fix: Overlay: Assert during bone selection in pose mode
Detected when testing `ellie_animation.blend`. When trying to select
bones the select_id_map is empty and would do an invalid resize of
the output buffer.

Pull Request: https://projects.blender.org/blender/blender/pulls/131140
2024-11-29 11:28:04 +01:00
Clément Foucault
5982b5e75c Fix #130751: Overlay Next: Selected Outline highlight vanishes when face orientation enabled
Was caused by different drawing order. Use the legacy drawing order
until we find a better fix.

The better fix would be to render outline with depth.
2024-11-28 19:16:37 +01:00
Clément Foucault
909b74e91f Fix: GPU: Assert due to new GPU requirements regarding wide lines
The formats was not using the correct attribute type.

Fixes assert in graph drawing and potential assert in cursor drawing
Fixes assert in sequencer and file browser
2024-11-28 12:42:17 +01:00
Miguel Pozo
1105f2573e Fix #130846: Workbench: X-Ray incoming vector
Regression from
9396c8f388
2024-11-27 21:26:52 +01:00
Miguel Pozo
a39bec7197 Fix: Overlay-Next: GP Points/Segments in edit modes
The previous code didn't support disabling them.
This is a copy of the Legacy behavior.
2024-11-27 20:52:49 +01:00
Miguel Pozo
6e6b9abf55 Fix: Overlay-Next: GP Vertex paint points 2024-11-27 20:08:28 +01:00
Miguel Pozo
83dca75cdf Fix #130815: Overlay-Next: Disabled overlays still visible 2024-11-27 20:07:15 +01:00
Clément Foucault
f08c2b8aa1 Fix: Overlay-Next: Wireframe display conflicting with edit cage 2024-11-27 18:45:31 +01:00
Clément Foucault
00a8d006fe GPU: Move Polyline shader to primitive expansion
This port is not so straightforward.

This shader is used in different configurations and is
available to python bindings. So we need to keep
compatibility with different attributes configurations.

This is why attributes are loaded per component and a
uniform sets the length of the component.

Since this shader can be used from both the imm and batch
API, we need to inject some workarounds to bind the buffers
correctly.

The end result is still less versatile than the previous
metal workaround (i.e.: more attribute fetch mode supported),
but it is also way less code.

### Limitations:
The new shader has some limitation:
- Both `color` and `pos` attributes need to be `F32`.
- Each attribute needs to be 4byte aligned.
- Fetch type needs to be `GPU_FETCH_FLOAT`.
- Primitive type needs to be `GPU_PRIM_LINES`, `GPU_PRIM_LINE_STRIP` or `GPU_PRIM_LINE_LOOP`.
- If drawing using an index buffer, it must contain no primitive restart.

Rel #127493

Co-authored-by: Jeroen Bakker <jeroen@blender.org>
Pull Request: https://projects.blender.org/blender/blender/pulls/129315
2024-11-27 17:37:04 +01:00
Hans Goudey
953c4f1599 Cleanup: Remove references to legacy Grease Pencil object
These are converted on startup to the new type. There are still
some references left, mostly where it looked like there still needs
to be changes to properly deal with the new object type.
2024-11-27 09:17:16 -05:00
YimingWu
ca78cae828 Fix #130992: Grease Pencil: Edit wire/vertex color usage fix
In legacy overlay the wire/vertex color used to draw grease pencil was
wrong, this means users can't effectively adjust grease pencil specific
wire colors. Currently this shader is used for both legacy and overlay
next, so this fix would be also beneficial down the line.

Pull Request: https://projects.blender.org/blender/blender/pulls/131023
2024-11-27 10:13:20 +01:00
Campbell Barton
b9f055459a Cleanup: ensure trailing space around comment blocks 2024-11-27 19:01:00 +11:00
Clément Foucault
7faec42236 Fix #130867: Overlay-Next: Crash on startup on intel macs
Loading the matrix first to local variable fixes the
internal compiler error.
2024-11-26 22:21:40 +01:00
Clément Foucault
badedb204a Overlay-Next: Move wireframe depth buffer copy before rendering
This avoid renderpass splitting and make overlay follow
the overlay interface.

Also fix the infront wireframe not copying the correct depth
buffer.
2024-11-26 21:32:27 +01:00
Clément Foucault
76a19fd3c5 Cleanup: Overlay: Remove OB_GPENCIL_LEGACY support 2024-11-26 21:32:27 +01:00
Hans Goudey
2dd124b391 Fix #130979: Curve object edit mode crash with evaluated mesh
Currently the text measure stats overlay is written to assume there
is an original edit mesh. It has to be disabled when that isn't the case.
2024-11-26 12:11:19 -05:00
Clément Foucault
f071385315 Cleanup: Overlay-Next: Split flat object sync to its own function
This allow to use the `Overlay` base class as intended.
2024-11-26 17:11:18 +01:00
Clément Foucault
1da9919841 Cleanup: Overlay-Next: Move Resource acquisition and release to class method 2024-11-26 17:11:18 +01:00
Falk David
ed1c262bb3 Cleanup: Remove unused Grease Pencil shader file
This file was completely unused and caused confusion.

Pull Request: https://projects.blender.org/blender/blender/pulls/130982
2024-11-26 17:09:42 +01:00
Clément Foucault
cbc185dbbd Cleanup: Overlay-Next: Move ShapeCache access to Resources 2024-11-26 15:43:01 +01:00
Clément Foucault
c793c1ad38 Fix #130960: Overlay-Next: Curve control points are missing
It was caused by missing UBO.
2024-11-26 15:09:41 +01:00
Clément Foucault
d7d0b72be5 Fix: Overlay-Next: Null batch dereference 2024-11-26 14:51:39 +01:00
Clément Foucault
889ca87048 Fix: Overlay-Next: Null batch dereference 2024-11-26 14:45:15 +01:00
Clément Foucault
0ebfbaa463 Cleanup: Overlay-Next: Remove active_base 2024-11-26 14:36:20 +01:00
Clément Foucault
986e495060 Fix: Overlay-Next: Crash when using volume wireframe
In some cases the volume wireframe batch can be null.
2024-11-26 14:23:08 +01:00
Clément Foucault
2901c4bb19 DRW: Assert non-null batch inside drawcall functions 2024-11-26 14:20:11 +01:00
Clément Foucault
7b75d06154 Fix: Overlay-Next: Broken build 2024-11-26 14:19:16 +01:00
Miguel Pozo
be6f68916a Fix #130906: Overlay: Crash
Use state.object_active directly, since state.active_base can be null.

Pull Request: https://projects.blender.org/blender/blender/pulls/130931
2024-11-26 14:09:54 +01:00
Campbell Barton
5ef9b93d2a Cleanup: avoid variable shadowing 2024-11-26 12:41:29 +11:00
Clément Foucault
328a6aa506 Fix #130687: Grease Pencil: Rendering order broken
`gpModelMatrix` needed to be set by reference.
Reference needed to be float4x4.
float4x4 cannot be inside C allocated struct (alignment).
Move the `object_bound_mat` to the instance struct
to workaround this issue.
2024-11-25 23:30:00 +01:00
Miguel Pozo
fddb9b4857 Fix #130774: Overlay-Next: Edit Mesh Weights
Ensure all framebuffer attachments are written to.

Pull Request: https://projects.blender.org/blender/blender/pulls/130912
2024-11-25 16:39:47 +01:00
Clément Foucault
9f51db041f Overlay-Next: Rename functions not following interface to avoid warnings 2024-11-25 16:07:21 +01:00
Clément Foucault
e42416d067 Fix #130903: Overlay-Next: Crash using asan in Relation drawing
The cast `float4(float3&)` is invalid and was casted to
`float4(float *)` which read past the end of the vector.
2024-11-25 15:33:04 +01:00
Miguel Pozo
e7b7e6007f Cleanup: Overlay-Next: Doc fixes 2024-11-25 13:01:43 +01:00
Clément Foucault
5e263a2772 Fix: Overlay-Next: Legacy curve wire display being on top edit curve
Simple drawing order issue.
2024-11-25 11:18:48 +01:00
Campbell Barton
0de8ae8046 Cleanup: spelling in comments 2024-11-25 13:24:46 +11:00
Clément Foucault
ba074d1670 Overlay-Next: Move grid view specific data sync to draw function
This avoid sync function to be view agnostic (follow the
design principle).
2024-11-24 22:24:21 +01:00
Clément Foucault
7565b90900 Overlay-Next: Introduce ViewOffsetData to not rely on view during sync
This workaround the issue of the sync requiring a view.
This simply stores the rv3d members that are needed for
calling `view_dist_get`.

This is a workaround to avoid any difference in behavior
with legacy overlay while not violating the design principles.
A better fix would be to compute the offset differently
solely based on the `View` itself. But that would change
the display and should be done in another task.
2024-11-24 21:05:48 +01:00
Hans Goudey
b309fe6092 Cleanup: Formatting 2024-11-24 14:02:52 -05:00
Clément Foucault
e55b525c79 Overlay-Next: Remove debug print 2024-11-24 19:41:01 +01:00
Clément Foucault
d8b6b2b1b7 Overlay-Next: Make grease pencil depth plane follow design
This move depth plane computation to right before drawing.
Making sync cycles not rely on view.
2024-11-24 19:35:18 +01:00
Hans Goudey
4587a87b6e Fix: Build error in overlay next from missing include
Switch to using FunctionRef over std::function which is generally
preferrable when the callback doesn't need to be stored for later.
2024-11-24 13:28:45 -05:00
Hans Goudey
fdb1bec6c8 Fix #130811, #130842: Non-mesh object edit mode crash evaluated mesh
The "is edit mode" checks in the draw module have been simplified
to just check the object mode. We need to be a bit more careful to
avoid retrieving the original mesh from a non-mesh object.

This commit improves the "get pre-modified mesh" function with
better comments and checks that reflect the relatively recent cases
where the original and evaluated geometry data types don't match.
It's always called with a mesh object too.

Pull Request: https://projects.blender.org/blender/blender/pulls/130850
2024-11-24 17:43:55 +01:00
Hans Goudey
705972e6af Cleanup: Workbench: Follow style guide for public class variable references
_No response_

Co-authored-by: Clément Foucault <foucault.clem@gmail.com>
Pull Request: https://projects.blender.org/blender/blender/pulls/130819
2024-11-24 17:37:17 +01:00
Clément Foucault
0ec7afff26 Fix #130802: Overlay Next: Crashes when selecting with Intel GPU
The shaders were invalidly marked as selection shaders.

Also fix the selection buffer / pass setup logic.
2024-11-24 15:45:50 +01:00
Clément Foucault
5f9c63963c Overlay-Next: Support selection of flat meshes in orthographic view
This workaround had not been ported over from the legacy overlays.
2024-11-24 15:29:26 +01:00
Clément Foucault
910ad6d031 Overlay-Next: Refactor flat object outline drawing
This workaround was against design and having conditional
sync depending on the view.

Now, the flat objects are put in a list and conditionally
put in a different pass at draw time.
2024-11-24 15:29:26 +01:00
Hans Goudey
21e2fba621 Fix #130808: Crash with GPU subdivision, edit mode, and mirror modifier
Mistake in deedbee971.
We need to take into account original indices in the evaluated mesh to
extract the proper original selection state.
2024-11-23 22:12:10 -05:00
Clément Foucault
23ac825a15 Cleanup: Overlay-Next: Deduplicate global UBO binding
No functional changes.
2024-11-24 01:23:10 +01:00