Commit Graph

9807 Commits

Author SHA1 Message Date
Miguel Pozo
6d9ad29c2a Merge branch 'blender-v4.5-release' 2025-07-09 15:16:46 +02:00
Miguel Pozo
88f812bf9a Fix #141253: Bring back the global Draw lock
Alternative solution to #141392 / #141564.

As a recap, the DST global lock (which prevented running drawing code
from multiple threads concurrently) was removed for 4.5 (#134690).
One unforeseen issue is that Images (and their GPUTextures) are shared
across dependency graphs (and therefore multiple threads), meaning we
are running into data race issues with them.

@fclem did #141392 and I continued it #141564. However, this is only a
partial solution, parts of the GPUTexture API and the whole BKE_image
API are still unsafe.
Trying to solve all the possible underlying issues seems unrealistic for
4.5 given the time frame and that the extension of the code affected by
this issue is quite large.

So this PR just brings the 4.4 locking behavior instead, which, while
risky on its own, seems much safer to me than the alternative.

This effectively undoes the improvements from #134690 by disabling
concurrent rendering, but instead of reverting all the code, it just
ensures we hold the lock in the same places we did in 4.4.
This means there's some redundant code that is not technically needed
anymore, like the `submission_mutex`, but it's probably best to make as
few modifications as possible, given how close we are to release and
that this is only intended as a temporary measure.

Pull Request: https://projects.blender.org/blender/blender/pulls/141618
2025-07-09 15:11:29 +02:00
Brecht Van Lommel
145b2173bd Merge branch 'blender-v4.5-release' 2025-07-08 18:40:13 +02:00
Brecht Van Lommel
bfacc42651 Fix: EEVEE/Workbench crash rendering without an active object
Regression from 62568d16e5, this was crashing most of the EEVEE
and Workbench render tests.

Pull Request: https://projects.blender.org/blender/blender/pulls/141624
2025-07-08 18:38:41 +02:00
Sean Kim
11a0364495 Merge branch 'blender-v4.5-release' 2025-07-08 06:55:23 -07:00
Sean Kim
62568d16e5 Fix #140621: Multi-object edit mode displays non-active UVs as faded
The feature to display multiple objects in the UV and Image Editor was
added in 24d08e0bae.

This commit did not account the multi-edit mode feature, where there may
be more than one object currently being edited, causing some UVs to
display with a faded opacity.

To fix this, introduce a new `eObjectInfoFlag` flag to indicate this
state, populate it when syncing the object, and use the flag inside the
relevant shaders.

Pull Request: https://projects.blender.org/blender/blender/pulls/141254
2025-07-08 15:51:09 +02:00
Jeroen Bakker
125726cda0 Merge branch 'blender-v4.5-release' 2025-07-08 15:43:37 +02:00
Jeroen Bakker
20bad6e29a Fix #141477: Crash during material selection
Material selection didn't support empty geometries. Geometry list can
have nullptrs, when meshes contain more than 16 materials, but some
materials slots are not actually used in the mesh.

Material selection used to still looped over all the materials and
tried to draw geometry that aren't there.

Regression from !139781

Pull Request: https://projects.blender.org/blender/blender/pulls/141608
2025-07-08 15:42:59 +02:00
Brecht Van Lommel
63cfc32dea Merge branch 'blender-v4.5-release' 2025-07-08 14:56:00 +02:00
Alaska
6cd82784a5 Fix #141519: EEVEE automatic light threshold doesn't work with exposure
Pull Request: https://projects.blender.org/blender/blender/pulls/141526
2025-07-08 14:55:14 +02:00
Campbell Barton
09260bf6c0 Merge branch 'blender-v4.5-release' 2025-07-08 15:38:58 +10:00
Campbell Barton
20ee5c2283 Fix buffer overflow reading the selection buffer
Reading from the top-right of the selection buffer could read
past the buffer bounds. Resolve by ensuring the clamped buffer
isn't empty. Relates to #141591.
2025-07-08 15:38:18 +10:00
Campbell Barton
932d37ba0b Cleanup: sort file lists in CMake 2025-07-05 08:54:18 +10:00
Campbell Barton
389a9197ae Merge branch 'blender-v4.5-release' 2025-07-04 19:51:40 +10:00
Pratik Borhade
27b205f579 Fix #141420: Grease Pencil: Crash enabling material overlay without material
Crashed due to accessing members of nullptr Material. Add extra
condition to avoid this.

Pull Request: https://projects.blender.org/blender/blender/pulls/141431
2025-07-04 10:40:09 +02:00
Hans Goudey
a9e6417e19 Cleanup: Remove unnecessary mutex for draw attribute requests
As noted in [0], locking or atomics are not required for merging
requests for a single mesh, because there is no multithreaded iteration
over objects that will process the same mesh in multiple threads. This
locking was  added preemptively over the years and has made code
needlessly complicated, even while the final design for parallel object
iteration isn't completely clear. This PR removes the locks to simplify
some changes necessary for mesh attribute storage refactors.

[0]: b6764e77ef

Pull Request: https://projects.blender.org/blender/blender/pulls/141405
2025-07-03 19:14:26 +02:00
Miguel Pozo
c32a756e2d Merge branch 'blender-v4.5-release' 2025-07-03 19:01:34 +02:00
Miguel Pozo
dbd9dc8a71 Fix #141398: Overlay: Missing Metaball selection circle
The alpha push constant wasn't set,
so it relied on whatever value it was set in a previous pass.
2025-07-03 19:00:51 +02:00
Miguel Pozo
760b3c5403 Refactor: Draw: ResourceHandle/Index split
Split the `ResourceHandle` class as proposed in
https://projects.blender.org/blender/blender/pulls/140611#issuecomment-1609918

Pull Request: https://projects.blender.org/blender/blender/pulls/140932
2025-07-03 16:04:48 +02:00
Clément Foucault
27b04788e9 Fix #115609: EEVEE: Material Preview gets Solid mode background color if world opacity is set to 0
This was only true when the mode was set to World.
Make it consistent with the Custom backgroubnd option and
fallback to Theme background color for lookdev and render.
2025-07-03 15:02:59 +02:00
Sybren A. Stüvel
282a99d99f Merge remote-tracking branch 'origin/blender-v4.5-release' 2025-07-03 12:07:00 +02:00
Sybren A. Stüvel
d08c4e8cc9 Fix: Overlay: Invalid RGB order in overlay theme colors
Fix an accidental swap of the green & blue channel when drawing theme-
colored elements in the overlay engine.

Thanks @fclem for finding the issue.

Pull Request: https://projects.blender.org/blender/blender/pulls/141382
2025-07-03 11:57:33 +02:00
Clément Foucault
bdad5325a7 Fix #141112: Plane Probe is cut off in camera view if Shift X/Y in certain way
Previous fix 531bc5ca69 broke the tracing part of planar
probe. This is because the code was relying on assumption that
are no longer true. Fix this by passing the correct
projection matrix and inverse proj mat to the tracing code.

Pull Request: https://projects.blender.org/blender/blender/pulls/141349
2025-07-02 17:46:45 +02:00
Clément Foucault
b30938a15f Fix #141112: Plane Probe is cut off in camera view if Shift X/Y in certain way
Previous fix 531bc5ca69 broke the tracing part of planar
probe. This is because the code was relying on assumption that
are no longer true. Fix this by passing the correct
projection matrix and inverse proj mat to the tracing code.

Pull Request: https://projects.blender.org/blender/blender/pulls/141349
2025-07-02 17:45:41 +02:00
Falk David
2b9b6fc5eb Merge branch 'blender-v4.5-release' 2025-07-02 14:52:31 +02:00
Falk David
dd16e5f96d Fix #94253: Grease Pencil: Transparency yellow color shift in viewport
In the viewport, semi-transparent strokes could appear more yellowish.

This was because the `reveal_tx` uses the `GPU_R11F_G11F_B10F` format
(loosing precision in the blue channel).

Now using `GPU_RGB10_A2` for `reveal_tx` to fix the issue.
We don't need to change the format for the `color_tx`.

Pull Request: https://projects.blender.org/blender/blender/pulls/141335
2025-07-02 14:50:59 +02:00
Falk David
4990edd94d Fix #136560: Grease Pencil: Alpha issue with "multiply" layer blending
The alpha channel wasn't properly handled when using "multiply" layer
blending.

The formula in `blend_mode_output` for `MODE_MULTIPLY` was first
multiplying the `color.a` by `opacity`, storing the result back into
`color` but then multiplying by `color.a` again.

Instead, multiply `color.a` and `color` by the `opacity` separately.

Pull Request: https://projects.blender.org/blender/blender/pulls/141337
2025-07-02 14:50:24 +02:00
Falk David
bc70bed850 Cleanup: Grease Pencil: Remove "fast draw" code
This was used by the legacy Grease Pencil system while using the draw
tool to quickly render a stroke buffer.

Nowadays, we don't use this buffer anymore and just rerender
the Grease Pencil object.
2025-07-02 11:12:15 +02:00
Hans Goudey
1f92fd7577 Refactor: Use AttrType instead of CustomData type in attribute API
Change `eCustomDataType` to `bke::AttrType` for uses of the attribute
API (the `AttributeAccessor` one anyway). I didn't touch any values that
might be saved in files; those should be handled on a case by case basis.

Part of #122398

Pull Request: https://projects.blender.org/blender/blender/pulls/141301
2025-07-01 22:14:26 +02:00
YimingWu
d6fcb6d1fe Fix #140934: Compositor: Support Grease Pencil pass in viewport
This patch adds support for viewport compositor for grease pencil pass.
It also comes with an option for viewing grease pencil pass directly
inside the viewport without compositor.

Pull Request: https://projects.blender.org/blender/blender/pulls/140960
2025-07-01 16:39:28 +02:00
Hans Goudey
68759af516 Attributes: Use AttributeStorage for curves and Grease Pencil
This commit moves Curves and Grease Pencil to use `AttributeStorage`
instead of `CustomData`, except for vertex groups. This PR mostly
involves extending the changes from the above commit for point clouds
to generalize to other geometry types.

This is mostly straightforward, though a couple non-trivial places of
note are the joining of Grease Pencil objects (`merge_attributes`), the
"default render fallback" UV for curves objects which was previously
unused at the UI level and just ended up being the first attribute, and
the `update_curve_types()` call in the curves versioning function.

Similar to:
- fa03c53d4a
- f74e304b00

Part of #122398.

Pull Request: https://projects.blender.org/blender/blender/pulls/140936
2025-07-01 16:30:00 +02:00
Miguel Pozo
75bf405647 Merge branch 'blender-v4.5-release' 2025-07-01 15:26:56 +02:00
Miguel Pozo
e2b898fea7 Fix #141132: Crash on background GP render
The crash seems to come from libepoxy GL functions pointing to null.
It seems that libepoxy "Automatically initializes as new GL functions are used."
and that to call a function without a GL context bound, the function
must have been called before with a bound context.

This just modifies the scope of the context binding from
DRW_module_exit to  RE_engines_exit, which seems the safest solution
for 4.5.

Pull Request: https://projects.blender.org/blender/blender/pulls/141233
2025-07-01 15:24:45 +02:00
Clément Foucault
c49e9e1773 Fix: Workbench: Incomplete commit 5231f0c02a
The commit didn't include the other part of the fix and
included an invalid changed line.
2025-07-01 12:44:12 +02:00
Clément Foucault
1c41815c4d Fix: Workbench: Color imprecision for pure black color
The bias for mapping to log color space was wrong and
was assuming `log(2x)` instead of `log2(x)`.

This made pure black colors result in 0.00008 values
after AA resolve.

Using the correct bias ensures 0 stays at 0 during the
AA process and doesn't exhibit any imprecision.
2025-07-01 11:10:18 +02:00
Aras Pranckevicius
293cdac6ab Merge branch 'blender-v4.5-release' 2025-07-01 11:53:30 +03:00
Clément Foucault
1b499bdffb Fix #141112: EEVEE: Plane Probe is cut off in camera view if Shift X/Y
The projection matrix Y offset was not inverted properly to compensate
the view matrix Z axis flip.

Pull Request: https://projects.blender.org/blender/blender/pulls/141227
2025-07-01 10:06:56 +02:00
Clément Foucault
a29be9c5a2 Fix #85015: Selection: Objects with negative and small scale cant be selected
... using Select Box.

This is caused by our hack to make each triangle always output
at least 1 pixel. It stretches the triangle with a specific
winding order that is correct for any geometry even if it is
backfacing as long as it is subpixel. But if the mesh is
negatively scaled, the culling mode is flipped. Which make the
hardcoded offsets winding inverted, and then culled by the rasterizer
(or the fragment shader code).

The fix is to flip the winding order of the offsets depending on
the object matrix negativity.
This is rather expensive so we only do it for the triangles we know
are subpixels.
2025-06-26 18:54:43 +02:00
Sergey Sharybin
1985de790b Merge branch 'blender-v4.5-release' 2025-06-26 17:33:28 +02:00
Hans Goudey
165c344e98 Fix: Assert in barbershop file calculating GPU subdiv orco buffer
For some reason the orco vertex buffer is requested after the position
buffer, but they are computed together. In case that happens, just
discard the position buffer.

Pull Request: https://projects.blender.org/blender/blender/pulls/141043
2025-06-26 17:17:17 +02:00
Clément Foucault
1073abe62f Fix #140152: EEVEE: Crash while playing animation
This happened because the velocity module is referencing
batche to be able to copy them after drawing.

Make sure to call step swap even when shaders are not
ready to ensure we don't dereference these possibly
freed batches on the next draw.

This also fixes the crashing benchmarks.

Pull Request: https://projects.blender.org/blender/blender/pulls/141022
2025-06-26 16:52:50 +02:00
Clément Foucault
ea2284af11 Fix #140762: Overlay: Curve doesn't display Bevel Preview in Edit Mode
This was caused by the retopology visibility check being faulty.

See https://projects.blender.org/blender/blender/issues/140762#issuecomment-1612468
for more detail.

Pull Request: https://projects.blender.org/blender/blender/pulls/141037
2025-06-26 16:40:26 +02:00
Clément Foucault
1e79660a14 Fix: Overlay: Region info not working if gizmos and overlays are disabled
The depth test was not set properly and was relying on the
(now moved) text drawing to always disable it.
2025-06-26 11:42:11 +02:00
Clément Foucault
1a5f29cb07 Overlay: Move text cache managment to the Overlay::Instance
This avoid legacy code inside the DRWContext.

Note that this change the draw order w.r.t. gizmos. Now the
gizmos will hide the text.

Moreover, streamline the condition for enabling text drawing
in order to fix #78971.
2025-06-25 13:05:06 +02:00
Clément Foucault
6535c999e0 Cleanup: Overlay: Avoid motion path issuing warn about missing uniforms 2025-06-24 22:09:09 +02:00
Clément Foucault
92b93d6d77 Fix #120969: Overlay: Assert when drawing motion paths
Avoid out of bound reads.
2025-06-24 22:09:02 +02:00
Miguel Pozo
7150d0fd1c Refactor: Draw: Use ResourceHandleRange in engine code
Prepare for #140378 by replacing all uses of `ResourceHandle` inside
the engine code with `ResourceHandleRange`.

Aside from the replacement, this changes `ResourceHandleRange` itself
to ensure we use them correctly:
- Prevent direct access to the first handle, to avoid not taking ranges
into account by mistake.
- Add missing functions that are safe to use for ranges
(`has_inverted_handedness` and `is_valid`).
- Add functions that aren't safe to use for ranges, but are required
for the code paths that don't support them yet (these functions assert
that the range points to a single handle, and therefore can be used
safely).

The main change is in `draw_handle.hh`, everything else is just a 1:1
port to use these new functions.

Pull Request: https://projects.blender.org/blender/blender/pulls/140611
2025-06-24 18:15:44 +02:00
Clément Foucault
8e0b920c39 Fix #82238: Drawing size of particles not matching DPI
Remove dependency on UI scaling.
2025-06-24 18:11:54 +02:00
Hans Goudey
98a1456129 Workbench: Avoid CustomData lookup when unnecessary
CustomData lookup is very expensive compared to everything else
happening in this function. Use a slightly ugly approach to avoid it
when the display type isn't "Attribute" or "Texture". This gives a 5%
FPS playback improvement in the Erindale Flower shop demo file.

Pull Request: https://projects.blender.org/blender/blender/pulls/140547
2025-06-24 13:42:38 +02:00
Campbell Barton
a88ff71148 Merge branch 'blender-v4.5-release' 2025-06-24 17:58:50 +10:00