Commit Graph

3756 Commits

Author SHA1 Message Date
Campbell Barton
846f86d1ad Cleanup: spelling in comments 2024-06-06 11:35:00 +10:00
Hans Goudey
84c4ddbbb9 Cleanup: GPU: Use references for some vertex buffer functions
Pull Request: https://projects.blender.org/blender/blender/pulls/122784
2024-06-05 18:47:22 +02:00
Hans Goudey
905ceaeacc Merge branch 'blender-v4.2-release' 2024-06-05 10:33:04 -04:00
Hans Goudey
05142b3ea8 Fix #122523: Crash/missing loose edge drawing with two viewports
With two viewports, and one viewport with overlays turned off, one viewport
first requests positions without calculating loose geometry, then the second
viewport can request the loose geometry index buffer. In that case the
previously-calculated positions VBO has the wrong size.

To fix this, always calculate loose geometry when the positions are requested.
That's required because we no simple way of checking whether the previously
uploaded positions included loose geometry. That was the state before recent
refactors in this area anyway.

This makes it clear that the optimization to not calculate loose geometry is
meaningless, because the positions buffer will always be requested at some
point when drawing a mesh.
2024-06-05 10:32:27 -04:00
Hans Goudey
92bfb754af Cleanup: Use unique_ptr for MeshRenderData
Also slightly simplify the main task graph node creation.

Pull Request: https://projects.blender.org/blender/blender/pulls/122722
2024-06-05 14:20:05 +02:00
Hans Goudey
24055d1837 Cleanup: Remove unused MeshExtract virtual iteration abstraction
Part of #116901.
This has been removed step by step in the previous commits.
2024-06-05 14:20:01 +02:00
Hans Goudey
eb4f3516a6 Mesh: Draw: Replace extractor abstraction for attributes buffers
Part of #116901.
The last extractor removed. This was already written in a data-oriented
manner so only the entry point changes in this commit.
2024-06-05 14:20:01 +02:00
Hans Goudey
deedbee971 Mesh: Draw: Replace extractor abstraction for UV edit index buffers
Part of #116901.
This file contains the creation of four different UV edit index buffers:
triangles, lines, points, and face dots. The main changes are about making
it clearer when faces are skipped. Other than that, changes are faily
extensive but straightfoward. In a few places some parts of existing
loops have been split out and parallelized, but the bulk of the work for
each IBO remains largely single threaded.
2024-06-05 14:20:01 +02:00
Hans Goudey
7292667db6 Mesh: Draw: Replace extractor abstraction for face dots UV edit data buffer
Part of #116901.
2024-06-05 14:20:01 +02:00
Hans Goudey
01b0096b5e Mesh: Draw: Replace extractor abstraction for edit data buffer
Part of #116901.
Due to the BMesh data format, there is less optimization possible here.
2024-06-05 14:20:01 +02:00
Hans Goudey
5931c82238 Mesh: Draw: Replace extractor abstraction for UV angle stretch buffer
Part of #116901.
The algorithm is complicated and isn't tweaked here.
2024-06-05 14:20:01 +02:00
Hans Goudey
4a852cdaa7 Mesh: Draw: Replace extractor abstraction for UV area stretch buffer
Part of #116901.
Besides the typical changes from past similar refactors, the loops are
now multithreaded.
2024-06-05 14:20:01 +02:00
Hans Goudey
498f4ba284 Mesh: Draw: Replace extractor abstraction for mesh analysis buffer
Part of #116901.
The code was already structured to not use the extractor iterators, so I
only changed the entry point.
2024-06-05 14:20:01 +02:00
Hans Goudey
1adb557806 Mesh: Draw: Replace extractor abstraction for ocro buffer
Part of #116901.
A straightforward change like all the others.
2024-06-05 14:20:01 +02:00
Hans Goudey
0edae45d15 Mesh: Draw: Replace extractor abstraction for sculpt overlay buffer
Part of #116901.
Includes a general standardization of the code, removing constant
checks from hot loops, standardizing naming, tweaking BMesh face
iteration. And includes parallelization too.
2024-06-05 14:20:01 +02:00
Hans Goudey
17a3d065f4 Mesh: Draw: Replace extractor abstraction for skin roots buffer
Part of #116901.
To avoid resizing the buffer, the data is added to a temporary vector
first. That should be fine because the number of roots is expected to
be quite small compared to the size of the mesh.
2024-06-05 14:20:01 +02:00
Hans Goudey
f81cfe392d Mesh: Draw: Replace extractor abstraction for UV maps buffer
Part of #116901.
A straightforward change. I did a few smaller changes to make the
copying similar to elsewhere.
2024-06-05 14:20:01 +02:00
Hans Goudey
7d660ef9d1 Mesh: Draw: Replace extractor abstraction for lines adjacency buffer
Part of #116901.
The algorithm is very complicated to I didn't adjust it. The changes are just
removing the data struct and un-sharing some code to make things a bit
simpler. I also changed the loop to iterate over faces rather than triangles
to avoid the reverse triangle to face lookup. This removes the need to
create the `corner_tri_faces` map, saving 4 bytes per triangle.
2024-06-05 14:20:01 +02:00
Hans Goudey
6178ff6c99 Cleanup: Use vector arguments in mesh draw lines adjacency
Also rename variables to use more standard names.
2024-06-05 14:20:01 +02:00
Hans Goudey
6baaf57343 Cleanup: Use references in mesh draw lines adjacency
Also rename a variable.
2024-06-05 14:20:01 +02:00
Hans Goudey
ba45572f04 Cleanup: Reorder mesh draw function in file
Just to make a future diff smaller and easier to read.
2024-06-05 14:20:01 +02:00
Hans Goudey
405a11fb06 Mesh: Draw: Replace extractor abstraction for paint mask lines buffer
Part of #116901.
A straightfoward change this time; the algorithm wasn't adjusted,
it was just put inside of a single loop. I did change some nested if
statements to continue statements to reduce indentation though.
2024-06-05 14:20:01 +02:00
Hans Goudey
d1049f6082 Mesh: Draw: Replace extractor abstraction for edge factor buffer
Part of #116901.
The BMesh version of the algorithm was parallelized because BMesh has
edge to face topology lookup available.

This also allows removing `GPU_vertbuf_steal_data`, by just generating
the correct data type in the first place. Removing that should help dealing
with improvements to VBO data ownership in the future.
2024-06-05 14:20:01 +02:00
Hans Goudey
18e76b5938 Mesh: Draw: Replace extractor abstraction for face dots UV buffer
Part of #116901.
2024-06-05 14:20:01 +02:00
Hans Goudey
4d72eac0ab Mesh: Draw: Replace extractor abstraction for face dots position buffer
Part of #116901.
2024-06-05 14:20:01 +02:00
Hans Goudey
ef91db222e Mesh: Draw: Replace extractor abstraction for face dots index buffer
Part of #116901.
Very similar to 07eac30070.
2024-06-05 14:20:01 +02:00
Hans Goudey
28c41b1d42 Mesh: Draw: Replace extractor abstraction for vertex group buffers
Part of #116901.
For meshes, extract vertex group weights to a temporary vertex-sized
array, then gather them to the final VBO array. This reduces duplicate
work, and eventually the gather step could be done on the GPU too.
2024-06-05 14:20:01 +02:00
Hans Goudey
2f3aacb1ac Mesh: Draw: Replace extractor abstraction for indices buffers
Part of #116901.
Most of these loops were extremely simple, so function call overhead
would have been problematic in the existing code. However, they're
also so simple that they're most likely memory bound, so I wouldn't
expect a large performance change.
2024-06-05 14:20:01 +02:00
Hans Goudey
070ffeea22 Mesh: Draw: Replace extractor abstraction for facedot normals buffer
Part of #116901.
Also allows removing the "extractor overrides" code and deduplicating
the handling of high quality normals with templates.
2024-06-05 14:20:01 +02:00
Hans Goudey
2eaab5bbb0 Mesh: Draw: Replace extractor abstraction for tangents buffer
Part of #116901.
2024-06-05 14:20:01 +02:00
Hans Goudey
a1b6989ddc Mesh: Draw: Replace extractor abstraction for vertex normals buffer
Part of #116901.
2024-06-05 14:20:01 +02:00
Hans Goudey
aa81e2dd4a Fix #122455: Wireframe overlay can crash with loose geometry
The `nor` vertex buffer wasn't large enough for the indices in the lines
index buffer. This is undefined behavior at best AFAIK. On some drivers
it caused crashes when there was only loose geometry.

This commit makes the VBO large enough for all indices, filling the loose
geometry normals with (0,0,0,0), which the overlay wireframe shader
already checks for.

Pull Request: https://projects.blender.org/blender/blender/pulls/122720
2024-06-04 17:43:11 +02:00
Clément Foucault
cc0d12dd20 EEVEE: Remove EEVEE-Legacy
This handles the transition to EEVEE-Next (now EEVEE).

This removes some things that make no sense to keep
even for compatibility.
- Scene.eevee.light_cache_data
- Scene Light cache operators
- Scene Light cache RNA properties

The remaining legacy properties will be removed later
on to avoid python API breakage.

We keep the identifier of EEVEE-Next as `BLENDER_EEVEE_NEXT`
to avoid addons being incorrectly silently made compatible
with the EEVEE-Next where the Python API is different.
This renaming should be done in 5.0 release.

Thank you EEVEE-Legacy, you served us well.

Pull Request: https://projects.blender.org/blender/blender/pulls/122433
2024-06-04 14:17:58 +02:00
Hans Goudey
e2402eb4a9 Cleanup: Use C++ types, references for CCGElem access 2024-06-02 20:36:33 -04:00
Hans Goudey
49b52b35d5 Cleanup: Move BKE_ccg.h to C++ 2024-06-02 20:36:33 -04:00
Hans Goudey
7e5f061851 Fix: Assert in mesh draw edit UV tris extraction
Caused by e916cd5d69.
2024-06-01 11:17:51 -04:00
Clément Foucault
62bfb3623d DRW: Invalid clip data if view is from planar reflection
The plane and corner extraction code was just not correct.

Fix #122067
Pull Request: https://projects.blender.org/blender/blender/pulls/122516
2024-05-31 16:15:52 +02:00
Pratik Borhade
c80e30684c GPv3: Lock material layer property
This ports the `lock_material` layer property to GPv3.
For this, the `layer_index` is also required in `retrieve_editable_points`
and `retrieve_editable_strokes` to choose strokes based on
the `lock_material` property.
In `retrieve_editable_elements` we now pass the `MutableDrawingInfo`
to get both the `drawing` and `layer_index`.

Pull Request: https://projects.blender.org/blender/blender/pulls/119913
2024-05-31 15:13:35 +02:00
Clément Foucault
4ab652256d Fix: EEVEE-Next: Invisible volume without any shader attributes
By removing the check we make it possible to render volume objects
even if the shader doesn't require any volume attribute.

We still check if there is any attribute to not draw empty
volume objects that have no attribute as a unit cube.

Fix #103683
2024-05-29 16:17:53 +02:00
Raul Fernandez
8182ebd4d2 Fix #95419: Sculpt: Invert visible hides all faces with Multires modifier
Fix for sculpt mode: invert visible hides all faces with Multires modifier #95419

Grids face indices should not change on the fly based on hidden state.
It caused the rendering glitches shown on the original bug report and the attached recordings.

* this PR removes the unnecessary check and dependency of grids visibility with the smooth/sharp of faces.
* replaces smooth flag for sharp flag which better express the intent and simplifies the logic.

Pull Request: https://projects.blender.org/blender/blender/pulls/121929
2024-05-29 06:02:54 +02:00
Hans Goudey
5cd06ffe60 Cleanup: Mesh: Modernize vert to corner topology map naming 2024-05-28 23:48:37 +02:00
Hans Goudey
34af347bb5 Cleanup: Remove unused mesh extractor 2024-05-28 13:34:50 -04:00
Hans Goudey
48cc79f52d Mesh: Edit data draw extraction improvement
Part of #116901.

Avoid the "extractor" abstraction for creation of edit mode overlay data
vertex buffers. Use threading::parallel_for loops instead. Also prefer
code duplication over linking things that are unrelated. This is the
last "extractor" loop that runs by default in edit mode so there is a
small performance improvement there. Besides that, the changes is the
same as the other similar refactors.

Pull Request: https://projects.blender.org/blender/blender/pulls/122386
2024-05-28 18:06:08 +02:00
Sean Kim
9d3e2de76e Cleanup: make format 2024-05-28 08:47:58 -07:00
Hans Goudey
b642b516d9 Cleanup: Reorder edit data draw buffer extraction function
Just to make a future diff smaller.
2024-05-28 11:26:22 -04:00
Hans Goudey
ebbb72187a Cleanup: Use references, const, for mesh edit data flag extraction 2024-05-28 11:26:21 -04:00
Hans Goudey
89c13dbb5c Fix: Mesh draw extraction missing wire batch missing normals input
The `overlay_wireframe` shaders uses a `nor` input but it wasn't added
to the GPU batch since the normals were split to a separate vertex buffer.
Adding that input gets closer to the appearance in 4.0. But it still looks a
bit different-- the outline is not as bright overall.

Fixes #120781.

Pull Request: https://projects.blender.org/blender/blender/pulls/120827
2024-05-28 16:58:08 +02:00
Campbell Barton
c110d26c61 Cleanup: use const pointers where possible 2024-05-28 13:47:43 +10:00
Hans Goudey
91c7809640 Fix #122319: GPU subdivision loose geometry positions invalid
Caused by 8d4da6063a
2024-05-27 23:04:07 -04:00
Hans Goudey
0dd61a9dc6 Fix #122293: Hidden edges affect incorrect loose edge indices
The loose edge section of the index buffer was built incorrectly,
essentially assuming that all the hidden edges came at the end of the
loose edge indices. To correct this, we need to track the visibility of
each loose edge index rather than the visibility of each edge itself.
This is driven by the need to combine the loose and non-loose indices
into one IBO with the loose edges in a contiguous section, and the
desire to avoid restart "invisible" indices in the buffer to upload
less data to the GPU.
2024-05-27 16:18:41 -04:00