Commit Graph

8987 Commits

Author SHA1 Message Date
Jeroen Bakker
53eadcc533 ImageEngine: Migrate to new draw manager
Converts the image engine to the new draw manager.
This is an as is migration without just a few tweaks to improve the code.

Pull Request: https://projects.blender.org/blender/blender/pulls/131142
2024-12-02 16:10:02 +01:00
Jeroen Bakker
e0252ae6de Overlay: View not set for overlay_clipbound shader
overlay_clipbound wasn't working in the Vulkan backend as the draw_view
was never uploaded. In vulkan this lead to a crash as it is more strict.

Detected when researching #131111

Pull Request: https://projects.blender.org/blender/blender/pulls/131247
2024-12-02 15:22:35 +01:00
Jeroen Bakker
cd57a17698 Overlay: Incorrect framebuffer bound in image editor
When the overlays of the image editor is drawn an incorrect framebuffer
is bound. The faulty framebuffer contains a depth texture which is also bound
as an attachment.

Pull Request: https://projects.blender.org/blender/blender/pulls/131244
2024-12-02 14:35:58 +01:00
Clément Foucault
9ebce2ce95 Fix #131235: Grease pencil: Final rendering not working
The `draw::Manager` needs to be manually synced in render.
2024-12-02 13:43:51 +01:00
Clément Foucault
eb6de2d4fc Fix #131239: Grease Pencil: Last stroke in drawing uses wrong layer opacity
Flush was being done on the wrong pass. It was also creating errors.
2024-12-02 13:21:12 +01:00
Clément Foucault
e3625410e3 Fix: Grease Pencil: Error caused by non-matching texture type with sampler
Depth sample are special on Metal and need correct input.
2024-12-02 13:21:12 +01:00
Clément Foucault
a15a4c9c9a GPU: GLSL compilation as C++ for grease pencil shaders
Rel #127983
2024-12-02 13:21:12 +01:00
Jeroen Bakker
796959c205 Cleanup: ImageEngine: Code-style (enum casing) 2024-12-02 11:25:32 +01:00
Jeroen Bakker
e0a0bdcf01 Cleanup: Make format 2024-12-02 11:18:52 +01:00
Jeroen Bakker
3351a6e94e Cleanup: Image engine: Use ShaderModule
Replace old C-Style API with a ShaderModule class for managing shader lifetimes

Pull Request: https://projects.blender.org/blender/blender/pulls/131229
2024-12-02 11:04:32 +01:00
Jeroen Bakker
e93ea62d2b Cleanup: ImageEngine: Shader interface naming
Pull Request: https://projects.blender.org/blender/blender/pulls/131228
2024-12-02 11:03:04 +01:00
Clément Foucault
b0c0c2708d Refactor: Grease Pencil: Port rendering to new draw manager
Pull Request: https://projects.blender.org/blender/blender/pulls/130337
2024-11-30 22:42:43 +01:00
Clément Foucault
67bf545b61 Fix: Overlay-Next: Missing selection binding for object centers 2024-11-29 18:46:17 +01:00
Clément Foucault
54be7ed322 Fix: Overlay-Next: Broken selection on first click
This was caused by querying on the selection state
before it is setup. It is only setup just before
the draw function.

To fix this, we sync the `info_buf` just before
drawing the overlays.

Also add some safety to avoid uninitialized memory.
2024-11-29 18:46:17 +01:00
Jeroen Bakker
9a4b232bd5 Cleanup: Image Engine
Before we start porting image engine to the new drawing manager
we should do some cleanups.

- Use similar namespace as other draw engines (`blender::image_engine`)
- Switched InstanceData and Instance
- Reduce parameters as drawing mode can access Instance.
- Remove some templates to improve readability.

Pull Request: https://projects.blender.org/blender/blender/pulls/131146
2024-11-29 15:46:44 +01:00
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