Commit Graph

120055 Commits

Author SHA1 Message Date
Aras Pranckevicius
a33730dc0d ImBuf: multi-thread IMB_alpha_under_color
IMB_alpha_under_color_[byte/float] functions are used when preparing
the rendered image for image/movie output with RGB channels (i.e. no
transparency). They were single threaded before, multi-thread them.

Time taken by them on 4K resolution image (mix of various transparency
values in source), on Ryzen 5950X/Windows:
- IMB_alpha_under_color_byte: 10.1ms -> 1.9ms
- IMB_alpha_under_color_float: 14.6ms -> 8.8ms (smaller speedup since
  it becomes memory bandwidth limited)

Pull Request: https://projects.blender.org/blender/blender/pulls/135258
2025-02-28 12:18:45 +01:00
Julian Eisel
80d6ad3e9d Fix: UI: Text shortening function off by one character
Noticed while working on #134814 that `BLF_width_to_rstrlen()` would
give one character too much to put into the available space, resulting
in a visual overflow or clipped text when BLF clipping is enabled.

I think the issue was hidden by the code from 9c09998530, which would
remove further characters until the string actually fits. I'm proposing
to disable that code for now, hoping that this properly fixes the issue.

`BLF_width_to_rstrlen()`/`blf_font_width_to_rstrlen()` are supposed to
find the largest part from the end of a string that fits into a given
width. It would iterate the string from the back until a character
doesn't fit into the width anymore. However, it would return the
index of that character, the one that doesn't fit anymore, instead of
the last character known to fit.

Pull Request: https://projects.blender.org/blender/blender/pulls/135239
2025-02-28 11:58:52 +01:00
Sergey Sharybin
21420711b0 Merge branch 'blender-v4.4-release' 2025-02-28 10:33:56 +01:00
Sergey Sharybin
c4e9cc18c5 OpenEXR: Change DWA compression mapping
OpenEXR DWA compression in Blender is derived from a more user-friendly
quality slider which has an intuitive range 0 .. 100.

Initially the mapping was done so that the visually lossless JPEG
quality of 97 was mapped to the default DWA compression 45. A point was
made that we should make it so default quality is mapped to the default
compression, following the intent of DWA for rendering and compositing
the main target.

This change adjusts the mapping so that quality of 90 is mapped to DWA
compression 45.

This change relies on the library update to fully utilize the DWA
compression #135037.

This change leads to the difference in the way proxies of EXR images
are generated:

```
                    DWA compression        Size (bytes)
Before the change   750                    175,208,243
After the change    225                     77,838,827
```

It is worth noting that the DWA compression seemed to be ignored in
the 4.4 branch before this change (this is what the original report is
about, a bit indirectly).

This is measured on the Fabrik Eingang footage converted to EXR. The
absolute value is ptobably not that important, it just shows the
reduction in size. This also leads to a lower quality of the proxy
image, but it is not worse than an actual JPEG proxy: the quality is
set to rather low 50 for the strip proxies.

Ref #134802

Pull Request: https://projects.blender.org/blender/blender/pulls/135103
2025-02-28 10:33:36 +01:00
Jeroen Bakker
e866137cc8 Fix: Compiling shaders without opensubdiv
When blender is compiled with `WITH_OPENSUBDIV=Off` Blender just works
fine. However when compiling all the static shaders the OpenSubDiv
shaders are also compiled and fail as they rely on OpenSubDiv.

This PR fixes this by only adding the shaders when OpenSubDiv is
available.

This issue could be reproduced using the `--debug-gpu-compile-shaders`
option or running GPU test cases.

Pull Request: https://projects.blender.org/blender/blender/pulls/135285
2025-02-28 09:58:08 +01:00
Pratik Borhade
5b17522b70 Merge branch 'blender-v4.4-release' 2025-02-28 14:08:57 +05:30
Pratik Borhade
b69b201e20 Cleanup: Rename LayerTreeNode variable
Function is used by both layers and groups after e51fff61c5.
Keep the name more general.

Pull Request: https://projects.blender.org/blender/blender/pulls/135286
2025-02-28 09:37:00 +01:00
Lukas Tönne
d6e8323190 Merge branch 'blender-v4.4-release' 2025-02-28 09:06:23 +01:00
Lukas Tönne
4437782e00 Fix #135126: Mantaflow crashes when resizing a liquid domain
The `with_smoke` case is handled correctly and checks for reallocation,
but the liquid case was ignored for unknown reasons.

The `with_smoke` distinction was added years ago (c7596cd820)
but for some reason the `with_liquid` case was ignored for reallocation.

Pull Request: https://projects.blender.org/blender/blender/pulls/135247
2025-02-28 09:03:29 +01:00
Campbell Barton
8a78a6dc61 Merge branch 'blender-v4.4-release' 2025-02-28 17:09:51 +11:00
Campbell Barton
bba5b88b29 Fix #135245: Crash passing a dict for OperatorProperties to RNA funcs
The code-path for coercing a dictionary to operator/gizmo properties
was being used RNA functions where it's not supported.

Raise a type exception instead of crashing.
2025-02-28 16:59:53 +11:00
Jesse Yurkovich
6704647c66 Cleanup: IO: Use blender containers for AbstractHierarchyIterator
Use Blender Containers in the AbstractHierarchyIterator system. A future
bug fix in the area is looking like it will require another map so it
seems like a good time to replace the old containers before that lands.

The conversion is complicated due to how the prior code leveraged
`operator[]` to both add and update entries; it was never clear which
operation was being performed. This leads to a somewhat confusing mix
of `add_new`, `add`, and `lookup_or_add` calls. The calls in place now
are what was required based on our existing tests.

Additionally, pointer stability guarantees were a little bit different,
affecting the usage of the `graph_children` function the most.

Pull Request: https://projects.blender.org/blender/blender/pulls/134698
2025-02-28 05:58:46 +01:00
Campbell Barton
21e7a48f2f Merge branch 'blender-v4.4-release' 2025-02-28 13:21:14 +11:00
Padraig-O-Cinneide
f928987216 Fix #130890: Toggle the offset option after snap fails
Regression in [0] caused changing snap options to fail on redo.

Resolve by ensuring the depsgraph is evaluated.

Ref: !135279

[0]: 1c0f374ec3
2025-02-28 13:17:28 +11:00
Jesse Yurkovich
ea5ed269ae Merge branch 'blender-v4.4-release' 2025-02-27 16:48:42 -08:00
Jesse Yurkovich
1833d79231 Fix: USD: Don't attempt to export the special custom_normal attribute
Suppress exporting this attribute as there's no conversion to USD that
supports its data type (2d, 16-bit int) and because mesh normals (from
the `corner_normals` API) are already exported. This causes a rather
annoying UI Warning notification that the attribute isn't convertible
during export.

Pull Request: https://projects.blender.org/blender/blender/pulls/135271
2025-02-28 01:47:37 +01:00
Campbell Barton
322abbd311 Fix file-selector operators performing an undo push on failure
Operators are only expected to perform an undo push when finished.
2025-02-28 11:45:11 +11:00
Sean Kim
3a01eb6dfa Cleanup: Reduce usage of BMLogEntry
`undo::get_bmesh_log_entry()` was only used for determining behavior
based on presence of the value, exposing the type is unnecessary. This
commit changes usages of the function to `undo::has_bmesh_log_entry()`
and removes forward declarations.

Pull Request: https://projects.blender.org/blender/blender/pulls/135274
2025-02-27 23:57:50 +01:00
Ray Molenkamp
1f362c570b Cleanup: Formatting 2025-02-27 12:38:41 -07:00
Harley Acheson
3fbb640418 Fix #134621: Only Update Face Orientation Alpha if Using Old Colors
With 4c67c78452 we changed the default theme color for front faces,
used by the Face Orientation overlay, to have zero alpha so that it
could be used in more cases. But versioning updated this for all old
files, which can overwrite users who made deliberate changes to it.
This PR alters the versioning code to only change the color if it
currently exactly matches the old default.

Pull Request: https://projects.blender.org/blender/blender/pulls/135262
2025-02-27 11:29:07 -08:00
Ray Molenkamp
b6dfad1008 MSVC: Fix build error with MSVC 2019
after 582cdc0cf2 msvc2019 has for unknown reasons issues
deciding the right template to use, help it a bit and nudge
it in the right direction.
2025-02-27 12:26:54 -07:00
Harley Acheson
f9df73b875 Fix #134621: Only Update Face Orientation Alpha if Using Old Colors
With 4c67c78452 we changed the default theme color for front faces,
used by the Face Orientation overlay, to have zero alpha so that it
could be used in more cases. But versioning updated this for all old
files, which can overwrite users who made deliberate changes to it.
This PR alters the versioning code to only change the color if it
currently exactly matches the old default.

Pull Request: https://projects.blender.org/blender/blender/pulls/135262
2025-02-27 20:25:47 +01:00
Julian Eisel
3044009271 Assets: Avoid allocating empty preview when unsupported on Mark as Asset
The preview creation for Mark as Asset didn't check if the data-block
supports automatic previews before requesting it, so the preview storage
would be created but no rendering performed. Not a big issue, but for
example the "Remove Preview" operator would be available even though to
the user it looks like the asset doesn't have a preview. This can be
avoided easily.
2025-02-27 19:34:02 +01:00
Miguel Pozo
f930d71a1e GPU: Threadsafe shader creation and acquisition
Move the `StaticShader` class from Workbench to `GPU_shader` and make
compilation thread-safe (Shader usage is still not thread-safe).
Use `StaticShader`s for all shader caches.

Subdivision shaders are still not ported.

(Part of #134690)

Pull Request: https://projects.blender.org/blender/blender/pulls/134812
2025-02-27 19:20:33 +01:00
Hans Goudey
582cdc0cf2 Cleanup: Use Array for FieldInferencingInterface
There is no need for amortized growth for the field interface.
Array seems slightly better than Vector because it's smaller and
doesn't give the impression that the size might change.

Pull Request: https://projects.blender.org/blender/blender/pulls/135257
2025-02-27 17:32:51 +01:00
Jacques Lucke
b05fb3801e Merge branch 'blender-v4.4-release' 2025-02-27 17:16:47 +01:00
Jacques Lucke
66ba309f6e Fix #135031: data-race in Remove Attribute node 2025-02-27 17:16:17 +01:00
Jeroen Bakker
11325aaff0 Cleanup: Fix typo in subdiv_eval.cc
_No response_

Pull Request: https://projects.blender.org/blender/blender/pulls/135254
2025-02-27 16:47:06 +01:00
Hans Goudey
0c04952a76 Cleanup: Specify backing type for node enums
Otherwise it defaults to int. This change can make a few structs
slightly smaller. Also use a signed integer type for the compositor
enum; that's the convention for non-flag enums.
2025-02-27 10:14:29 -05:00
Hans Goudey
a701e01e5d Cleanup: Use auto after static_cast to avoid repetition 2025-02-27 09:58:03 -05:00
Hans Goudey
4b0cb31d3f Cleanup: Remove "e" prefix for field status enum name 2025-02-27 09:58:03 -05:00
Hans Goudey
aa6eb93015 Cleanup: Typo in comment, argument name consistency 2025-02-27 09:58:03 -05:00
Aras Pranckevicius
02869cc6c8 Color management: Dithering consistency/perf improvements
Float->byte rendered image dithering uses triangle noise algorithm. Keep
the algorithm the same, just make some improvements and fix some issues:

1) The hash function for noise was using "trig" hash from "On generating
random numbers" (Rey 1998), but that is not a great quality hash, plus it
can produce very different results between CPUs/GPUs. Replace it with
"iqint3" (recommended by "Hash Functions for GPU Rendering", JCGT 2020),
which is same performance on GPU, faster on CPU, and much better quality.
This is the same hash as Cycles already uses elsewhere. Also it is purely
integer based, so exactly the same results on all platforms.

2) For the above point, replace `dither_random_value` to take integer
pixel coordinates and adjust calling code accordingly. Some previous
callers were (accidentally?) passing integer coordinates already. Other
places actually get a tiny bit simpler, since they now no longer need an
extra multiplication.

3) The CPU dithering path was wrongly introducing bias, i.e. making the
image lighter. The CPU path also needs dither noise to be in [-1..+1]
range (not [-0.5..+1.5]!) just like GPU path does, since the later
float->byte conversion already does rounding.

4) The CPU dithering path was using thread-slice-local Y coordinate,
meaning the dithering pattern was repeating vertically. The more CPU cores
you use, the worse the repetition.

5) Change the way that uniform noise is converted to triangle noise.
Previous implementation was based on one shadertoy from 2015, change it
to another shadertoy from 2020. The new one fixes issues with the old way,
and it just works on the CPU too, so now both CPU and GPU code paths are
exactly the same.

6) Cleanup: remove DitherContext, just a single float is enough

Performance and image comparisons in the PR.

Pull Request: https://projects.blender.org/blender/blender/pulls/135224
2025-02-27 15:52:45 +01:00
Hans Goudey
3ee75006c3 Cleanup: Use utility function to clear ListBase 2025-02-27 09:43:14 -05:00
Jeroen Bakker
22aad0fde7 SubDiv: Use shader create info for patch evaluation shader
This PR migrates the subdiv_patch_evaluation_comp.glsl to use
shader create info.

The part of OSD that is used is included as a typedef source (osd_patch_basis.glsl).

Pull Request: https://projects.blender.org/blender/blender/pulls/134917
2025-02-27 15:42:08 +01:00
Clément Foucault
583e2b7240 DRW: Move GPU context lock out of the DST variable.
This doesnt remove the locking but isolate the `GPUContext`
lock to oustide the `DrawManager` class.

This has no functional change.

Pull Request: https://projects.blender.org/blender/blender/pulls/135189
2025-02-27 15:39:05 +01:00
Sebastian Parborg
1fc2daf3e2 Merge branch 'blender-v4.4-release' 2025-02-27 15:16:37 +01:00
Omar Emara
fdeda50b5c Cleanup: Nodes: Use common prefix instead of sh_fn
Nodes that are shared between Geometry and Shader nodes use the prefix
sh_fn for their base type and poll functions. The compositor will also
share those nodes very soon, so we generalize the name to use the prefix
"common".
2025-02-27 14:51:24 +02:00
Omar Emara
2833c0f283 Fix: Compositor asserts for unsupported unavailable sockets
The compositor asserts if an unsupported unavailable socket exists. This
assert should not exist, because the GPU material compiler will itself
gracefully handle such sockets when their type is GPU_NONE, which is
already the case. So remove the assert and add a note about the
behavior.
2025-02-27 14:34:23 +02:00
Pratik Borhade
9d12ac29ea Fix: Grease Pencil: Add channel_color RNA prop to layer groups
Property wasn't added to earlier because it was part of tree-node.
But it was moved to tree-node just in main, see: 3ef2ee7c53
Failing right now in 4.4.

Pull Request: https://projects.blender.org/blender/blender/pulls/135225
2025-02-27 13:32:35 +01:00
Jacques Lucke
3af79b1d3b Merge branch 'blender-v4.4-release' 2025-02-27 12:48:57 +01:00
Jacques Lucke
09fd1d48e2 Fix #135164: crash when deleting nodes from node tree after appending
The issue was that changing session ids for a data-block were not handled gracefully enough.

Pull Request: https://projects.blender.org/blender/blender/pulls/135230
2025-02-27 12:47:01 +01:00
Jacques Lucke
9df6e9214e Fix #135152: crash because of missing gizmo update after closed editor
The visibility of Geometry Nodes gizmos sometimes depends on the
selected nodes in a node editor. Therefore, when the editor is closed,
the set of available gizmos has to be refreshed.
2025-02-27 12:44:57 +01:00
Lukas Tönne
dfc7140655 Merge branch 'blender-v4.4-release' 2025-02-27 12:32:37 +01:00
Lukas Tönne
b34c116398 Fix: Geometry Nodes menu socket can leak memory
The enum items propagation mechanism for Menu sockets makes a local copy of item
pointers to propagate between node group inputs and interface definitions.
In case these items are not used (e.g. because they are already shared with the
socket) the local copy must still be released to avoid leaking the memory.

This only happens with more than 4 enum items, because of the internal default
buffer for `Vector`.

Pull Request: https://projects.blender.org/blender/blender/pulls/135226
2025-02-27 12:31:31 +01:00
Jacques Lucke
b632b5c974 Nodes: UI: always draw panels as collapsible in tree view
This changes the drawing in the tree interface panel so that panels always show
the icon to collapse it, even if it is empty. This makes it more obvious when an
item is a panel and not just a socket.

Right now, this is not strictly necessary, because sockets can also be
identified by their socket icon. However, that changes with #133936 where a
panel can also have a (boolean) socket.

Pull Request: https://projects.blender.org/blender/blender/pulls/135207
2025-02-27 12:12:05 +01:00
Anthony Roberts
a08da0c897 Merge branch 'blender-v4.4-release' 2025-02-27 10:03:17 +00:00
Pratik Borhade
255dec2c51 Fix #135136: UI: Shader node template panels can't collapsed on drag
Multiple panels of material in properties tab were not
collapsed/expanded when click-dragged over them. This is because wrong
button type for interface-panel. To support multi-drag, button has to be
of type toggle, see: `ui_do_but_ANY_drag_toggle()->
ui_drag_toggle_but_is_supported`

Pull Request: https://projects.blender.org/blender/blender/pulls/135154
2025-02-27 11:02:35 +01:00
Omar Emara
20897f5f20 Cleanup: Warning about integers of different signs
The SAT shaders in the compositor contain comparisons of different
signed integers, use uint to fix this.
2025-02-27 11:19:24 +02:00
Jeroen Bakker
fcc5681624 SubDiv: Use shader create info for custom data
This PR migrates the custom_data_interp_comp.glsl to use
shader create info.

During development tests have been conducted to use specialization constants,
but due to limitations inside Metal we didn't use them.

Number of ShaderCreateInfos have been reduced by using macros. Variadic macros
have not been used as they don't support CPP compilation.

Pull Request: https://projects.blender.org/blender/blender/pulls/134932
2025-02-27 09:50:36 +01:00