Commit Graph

150077 Commits

Author SHA1 Message Date
Miguel Pozo
11390e8f69 Tests: Generate render diffs in parallel
`oiiotool` diff generation is single-threaded and can become a
bottleneck on fast to render tests.

This PR generates diffs in parallel using the `multiprocessing` module.

Overlay tests (local): 90s -> 30s

buildbot +gpu:
macOS: 2020s -> 1808s
Linux: 1901s -> 1327s

Pull Request: https://projects.blender.org/blender/blender/pulls/134938
2025-02-21 19:14:17 +01:00
Brecht Van Lommel
66e150b5f4 Merge branch 'blender-v4.4-release' 2025-02-21 18:50:21 +01:00
Brecht Van Lommel
c988a04802 Fix #134120: Crash evaluating rigid body in animation render
This shared state between original data and depsgraphs was added in
98a0bcd425. Other physics systems also share
the pointcache, but not the simulation state to this extent, which leads
to this kind of crash.

The mutex lock is not a great solution, you don't really want both                                                                                                                                                                                                                                                                                   render and viewport to be filling the same cache in parallel. However
this kind of problem also exists in other physics systems, and solving
that is certainly beyond the scope of 4.4, and probably needs to wait
for a bigger physics rewrite. In general the recommendation is to bake
everything before rendering.

Pull Request: https://projects.blender.org/blender/blender/pulls/134779
2025-02-21 18:48:54 +01:00
Christoph Lendenfeld
9cd9aa40c4 Merge branch 'blender-v4.4-release' 2025-02-21 16:47:10 +01:00
Christoph Lendenfeld
981e06f3bd Fix #134758: renaming a node breaks animation
The issue was that in the macro used, the wrong ID was passed into
the rename function. Since nodetrees are a separate embedded ID,
the rename function couldn't resolve the RNA path and thus failed.

This broke keys and drivers when renaming nodes.
Not only for the compositor, but all node trees.

This was caused by 1c7c1829b6

Pull Request: https://projects.blender.org/blender/blender/pulls/134936
2025-02-21 16:46:14 +01:00
Jeroen Bakker
3e030e3de0 SubDiv: Use shader create info for edge fac shader
This PR migrates the subdiv_vbo_edge_fac.glsl to use
shader create info.

Pull Request: https://projects.blender.org/blender/blender/pulls/134907
2025-02-21 16:26:28 +01:00
Jeroen Bakker
8299b30269 SubDiv: Use shader create info for lnor shader
This PR migrates the subdiv_vbo_lnor_comp.glsl to use
shader create info.

Pull Request: https://projects.blender.org/blender/blender/pulls/134916
2025-02-21 15:43:09 +01:00
Jeroen Bakker
8e72bf937f SubDiv: Use shader create info for triangle indices shader
This PR migrates the subdiv_ibo_tris_comp.glsl to use
shader create info. Due to naming collision shader_data
needs to be accessed directly.

Pull Request: https://projects.blender.org/blender/blender/pulls/134867
2025-02-21 14:55:18 +01:00
Clément Foucault
966a424f00 Fix: GPU: Printf Memory leak
The previous fix 8f00f068ad
doesn't work as the printf buffer gets recreated.

Ensure render boundaries at lower level and do the printf
flush manually.
2025-02-21 14:35:36 +01:00
Jeroen Bakker
c436972b2b SubDiv: Use shader create info for lines shader
This PR migrates the subdiv_ibo_lines_comp.glsl to use
shader create info.

Pull Request: https://projects.blender.org/blender/blender/pulls/134857
2025-02-21 14:16:57 +01:00
Clément Foucault
8f00f068ad Fix: GPU: Memory leak from shader printf buffer
The printf buffer were not flushed in some cases
before the context destruction.
2025-02-21 13:47:28 +01:00
Jeroen Bakker
b34bc67f67 Metal: Add support for packed_float3 as storage buffers
Subdivision shaders currently fail to compile using Metal as it doesn't recognize
packed_float3 as an internal data type. This PR includes packed_float3 as an
internal data type.

Without this `blender --debug-gpu-compile-shaders` will fail as it includes a namespace.
```
ERROR (gpu.shader): subdiv_normals_accumulate Compute Shader:
      |
      | source/blender/gpu/metal/mtl_shader_generator.mm:971:9: Error: no type named 'packed_float3' in 'MTLShaderComputeImpl'; did you mean simply 'packed_float3'?
      |
      |         device MTLShaderComputeImpl::packed_float3* normals[[buffer(MTL_storage_buffer_base_index+4)]],
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |         packed_float3
      |
      | /System/Library/PrivateFrameworks/GPUCompiler.framework/Versions/32023/Libraries/lib/clang/32023.196/include/metal/metal_packed_vector:145:58: Note: 'packed_float3' declared here
      |
      | typedef __attribute__((__packed_vector_type__(3))) float packed_float3;
      |                                                          ^
```

Pull Request: https://projects.blender.org/blender/blender/pulls/134925
2025-02-21 13:46:10 +01:00
Jacques Lucke
8be66a42c9 BLI: add utilities to find first (un)set bit in a bit span
This adds three new functions to find the first 0 or 1 bit in an arbitrarily
long bit span:

```cpp
blender::bits::find_first_0_index(BitSpan) -> std::optional<int64_t>
blender::bits::find_first_1_index(BitSpan) -> std::optional<int64_t>
blender::bits::find_first_1_index_expr(Expr, BitSpans...) -> std::optional<int64_t>
```

The two first ones are implemented in terms of the third. The `*_expr` variant
allows e.g. finding the first set bit when ORing two bit spans together without
computing the entire intermediate result first. Or it can be used to find the
first index where two bit spans are different.

Pull Request: https://projects.blender.org/blender/blender/pulls/134923
2025-02-21 13:36:03 +01:00
Maxime-Cots
251cd8eb10 SVG: Batch import SVG as curves files
Follows the same code as glTF to handle both single and multiple files.

Co-authored-by: Nig3l <nig3lpro@gmail.com>
Pull Request: https://projects.blender.org/blender/blender/pulls/134795
2025-02-21 12:41:27 +01:00
Philipp Oeser
e4b36d677e Merge branch 'blender-v4.4-release' 2025-02-21 12:40:35 +01:00
Philipp Oeser
5cfc7b7c65 Fix #134825: Assert in draw code when enabling "Paint Mask"
This happend for meshes without UVs.
The call to `texpaint_request_active_uv` in
`DRW_mesh_batch_cache_get_surface_edges` is from 9c010c44f4.

Looks like this is not needed (assumed to be copy paste error).

Pull Request: https://projects.blender.org/blender/blender/pulls/134856
2025-02-21 12:40:21 +01:00
Jeroen Bakker
310d103600 SubDiv: Use shader create info for normal accumulation shader
This PR migrates the subdiv_normal_accumulation_comp.glsl to use
shader create info.

Pull Request: https://projects.blender.org/blender/blender/pulls/134837
2025-02-21 12:38:57 +01:00
Sybren A. Stüvel
963f291901 Merge remote-tracking branch 'origin/blender-v4.4-release' 2025-02-21 12:34:32 +01:00
Andy Beers
d6da9710d0 Modeling: Support normalization with locked vertex groups in N-panel
In the Vertex Weights panel of the 3D Viewport sidebar, allow for
normalization of vertex groups when any number of vertex groups are
locked.

As with other normalization operators that handle locked vertex groups,
locked weights are summed, and whatever space is left between that sum
and 1.0 is used to normalize the unlocked weights.

Pull Request: https://projects.blender.org/blender/blender/pulls/134535
2025-02-21 12:33:40 +01:00
Omar Emara
367b6d2b55 Cleanup: Unused warning in release builds 2025-02-21 13:05:47 +02:00
Sybren A. Stüvel
6225c3e667 Refactor: make FCurve and Channelbag 'ensure' functions return a reference
Make `action_channelbag_ensure()` and `action_fcurve_ensure()` return a
reference. Earlier it returned pointer that should never be `nullptr`,
but in certain cases (which would indicate a bug, as the function's
preconditions aren't met) could technically still be a `nullptr`.

Instead, the preconditions are checked with `BLI_assert()`, and a
release build will simply assume that they are met. This simplifies the
code of the functions themselves, as well as the callers.

For reference: this was discussed in !134866.

No functional changes.

Pull Request: https://projects.blender.org/blender/blender/pulls/134918
2025-02-21 11:55:56 +01:00
Sybren A. Stüvel
73bd35e63f Merge remote-tracking branch 'origin/blender-v4.4-release' 2025-02-21 11:22:39 +01:00
Sybren A. Stüvel
f046fa5272 Refactor: pass FCurveDescriptor as const reference instead of value
Over time the `FCurveDescriptor` class has grown, and some concern was
raised (!134866) about the performance impact of passing it by value.
It's now passed by const reference instead.

No functional changes. I did find some non-`const` uses that are now
also `const`.

Pull Request: https://projects.blender.org/blender/blender/pulls/134913
2025-02-21 11:22:13 +01:00
Clément Foucault
c3eba77c2d Mesh Edit Selection: Use last_update for update detection
Rel #134690

Pull Request: https://projects.blender.org/blender/blender/pulls/134881
2025-02-21 10:50:15 +01:00
Bastien Montagne
e0829f9e55 Cleanup: Update comment in MEM_freeN<T> about MSVC and triviality check. 2025-02-21 10:37:13 +01:00
Bastien Montagne
718d4ffe9f Add some type-check to MEM_freeN<T> with MSVC.
Using `DNA_DEFINE_CXX_METHODS` in DNA structs make them non-trivially
copyable for MSVC, so use a narrower check that should still catch most
issues.

Pull Request: https://projects.blender.org/blender/blender/pulls/134875
2025-02-21 10:30:29 +01:00
Jeroen Bakker
3969e30c6f SubDiv: Add base for polygon offset
Subdiv shader library contains an optional part that shaders can include.
As we are migrating each shader at a time there are now multiple PRs doing
the same thing. Best to add the changes to main already so it doesn't add
confusion during review.

Pull Request: https://projects.blender.org/blender/blender/pulls/134906
2025-02-21 10:21:44 +01:00
Pratik Borhade
b17ee902c0 Fix #134898: Grease Pencil: Select Similar doesn't work in stroke mode
Greyed out in UI due to wrong poll function.

Pull Request: https://projects.blender.org/blender/blender/pulls/134899
2025-02-21 10:20:30 +01:00
Omar Emara
d0ade434f7 BKE: Add type conversion rules for float4
This patch adds conversion rules for the float4 type in BKE type
conversion. This is needed for use in the compositor.

Pull Request: https://projects.blender.org/blender/blender/pulls/134862
2025-02-21 07:41:34 +01:00
Alaska
51d7f386f6 Tests: Add render test for light falloff node
This commit adds a test for the light falloff node on many different
objects. Examples include point lights, sun lights, mesh lights,
background lights, and direct visibility to camera.

Ref: blender/blender-test-data!56
2025-02-21 04:48:44 +01:00
Sean Kim
4712f4a75a Cleanup: Various non-functional changes for multires.cc
This commit contains the following changes:
* Reduces scope of variables where possible, joining declaration and
  assignment where necessary.
* Uses const for parameters and local variables where possible.
* Uses static_cast or reinterpret_cast where possible.

Pull Request: https://projects.blender.org/blender/blender/pulls/130487
2025-02-21 01:08:19 +01:00
Sean Kim
6b59fd5c5e Cleanup: Minor tidying up in paint.cc modifier methods
* Reduces scope of variables
* Joins declaration and assignment where possible
* Uses static_cast and reinterpret_cast instead of C-style cast
* Uses const where possible
* Uses reference instead of pointer where possible

Pull Request: https://projects.blender.org/blender/blender/pulls/134816
2025-02-21 00:31:58 +01:00
Campbell Barton
4fab3b04b3 Cleanup: avoid duplicate calls to WM_keyconfig_active
Reuse the result of WM_keyconfig_active instead of calling it for
every keymap while reconfiguring keymaps.
2025-02-21 10:15:01 +11:00
Lukas Stockner
8cb5e05c48 Cleanup: Cycles: Deduplicate kernel attribute code using templating
The attribute handling code in the kernel is currently highly duplicated since
it needs to handle five different data types and we couldn't use templates
back then.
We can now, so might as well make use of it and get rid of ~1000 lines.

There are also some small fixes for the GPU OSL code:
- Wrong derivative for .w component when converting float2/float3->float4
- Different conversion for float2->float (CPU averages, GPU used to take .x)
- Removed useless code for converting to float2, not used by OSL

Pull Request: https://projects.blender.org/blender/blender/pulls/134694
2025-02-20 19:28:45 +01:00
Brecht Van Lommel
83874e6ce5 Merge branch 'blender-v4.4-release' 2025-02-20 19:21:33 +01:00
Brecht Van Lommel
878e5dc0c5 Fix #134596: Crash baking light probe while rendering animation
Pull Request: https://projects.blender.org/blender/blender/pulls/134874
2025-02-20 19:20:19 +01:00
Sergey Sharybin
c114ac97be Merge branch 'blender-v4.4-release' 2025-02-20 17:36:37 +01:00
Sahar A. Kashi
6363181af9 Cycles: HIP-RT 2.5 integration and gfx12 support
This change brings the following improvements on the user level
- Support of GPUs with gfx12 architecture
- New HIP-RT library which in addition to the gfx12 support brings
  various bug-fixes.

The known limitation of gfx12 is that OpenImageDenoiser does not yet
support this GPU architecture. This means that while Cycles will use the
full advantage of the gfx12 (including hardware accelerated ray-tracing),
denoising will only be possible on CPU, or secondary gfx11 or below GPU.
This is something that requires a change in OIDN and it is to late to do
it for Blender 4.4, but it is something to look forward for Blender 4.5.

The gfx12 changes for the pre-compiled kernels is rather trivial,
so it comes together (in the same PR) as the bigger HIP-RT change.

On the development side this change brings the following improvements:
- One step compile and link (much simpler CMake rules)
- Embedding BVH binaries in hiprt dll (which makes it easier to package
  and load, without relying on special path configuration)

Co-authored-by: Sahar Kashi <sahar.kashi@amd.com>
Co-authored-by: Sergey Sharybin <sergey@blender.org>
Co-authored-by: Brecht Van Lommel <brecht@blender.org>

Pull Request: https://projects.blender.org/blender/blender/pulls/133129
2025-02-20 17:34:14 +01:00
Miguel Pozo
9f003ee722 Merge branch 'blender-v4.4-release' 2025-02-20 17:21:53 +01:00
Miguel Pozo
ba3749ad47 Overlay: Add tests
This adds support for Overlay tests.

There are some differences with how we handle tests for other engines:
- The renders are captured using `bpy.ops.render.opengl()`, but this
  won't work on our GPU build bots.
- A single blend file can run multiple tests by outputting a txt list
  with the test names.
- Each overlay test blend file requires a matching script file with
  the same name inside `tests/python/overlay/`.
- To reproduce a specific test state you can run
  `blender "(...)/tests/data/overlay/<test>.blend" -P "(...)/tests/python/overlay/<test>.py" -- --test <test-number>`.

Note:
The current test permutations are WIP, so reference images are not
committed to the data repo for now.

Pull Request: https://projects.blender.org/blender/blender/pulls/133879
2025-02-20 17:18:59 +01:00
Sybren A. Stüvel
3473680f39 Merge remote-tracking branch 'origin/blender-v4.4-release' 2025-02-20 17:07:03 +01:00
Sybren A. Stüvel
94563dedca Refactor: rename BKE_fcurve_bezt_shrink to ..._resize and allow growing
The `BKE_fcurve_bezt_shrink()` function had an artificial limitation to
only allow shrinking the `bezt` array. That limitation is now removed,
and therefore the function renamed to `BKE_fcurve_bezt_resize()`.

A note was added to the documentation that newly added array elements
should be initialized by the caller.

Pull Request: https://projects.blender.org/blender/blender/pulls/134864
2025-02-20 17:04:27 +01:00
Sybren A. Stüvel
2185143fc2 Refactor: split animrig::action_fcurve_ensure() into two components
Split the majority of `animrig::action_fcurve_ensure()` into a new
function `action_channelbag_ensure()`. This ensures that the Action has
a layer, keyframe strip, action slot, and channelbag for the given ID.

`animrig::action_fcurve_ensure()` now just calls into that function, and
then ensures that there is an F-Curve in that channelbag.

No functional changes.

Pull Request: https://projects.blender.org/blender/blender/pulls/134864
2025-02-20 17:04:23 +01:00
Bastien Montagne
318ae49f1e Cleanup: Remove void * handling from MEM_freen<T>.
Followup to 48e26c3afe, and discussions in !134771 about keeping
'C-style' and 'C++ template type-safe style' implementations of our
guardedalloc separated. And it makes `MEM_freeN<T>` code simpler.

Also skip type-checking in `MEM_freeN<T>` only with MSVC, as clang-cl on
windows-arm64 does work fine with DNA structs using
`DNA_DEFINE_CXX_METHODS`.

Pull Request: https://projects.blender.org/blender/blender/pulls/134861
2025-02-20 16:42:22 +01:00
Brecht Van Lommel
4b10c63617 Merge branch 'blender-v4.4-release' 2025-02-20 16:34:00 +01:00
Brecht Van Lommel
b0fcd55aed Fix: Cycles OSL random texture issue on macOS ARM
Shader compilation is multithreaded, this needs to be atomic.

Pull Request: https://projects.blender.org/blender/blender/pulls/134854
2025-02-20 16:32:44 +01:00
Gracjan Jeżewski
4b348453db Fix: Hydra: Make final render run render loop
Hydra's viewport and final engines conflict on whether the rendering loop
is internal or external. The old approach works for Hydra Delegates that
converge with a single sample (hdStorm) but causes engines relying on sample
accumulation (hdEmrbee) to become stuck.

This minimal change retains compatibility with delegates like Storm while
replicating the behavior of the viewport engine in the final engine.

Pull Request: https://projects.blender.org/blender/blender/pulls/134804
2025-02-20 16:32:24 +01:00
Janne Nylander
9924ad9baf Fix: Grease Pencil: "Extrude" operator breaks vertex group weights
The Grease Pencil extrusion operator didn't transfer the vertex group names
from the old `CurvesGeometry` to the new one, resulting in the `gather_attributes`
function not transferring the vertex group weights correctly. This PR adds
`BKE_defgroup_copy_list` to the operator to remedy this.

Pull Request: https://projects.blender.org/blender/blender/pulls/134695
2025-02-20 16:27:11 +01:00
Pratik Borhade
695d53f493 Fix #134822: Crash when trying to Join empty PointClouds or Curves
Make sure selected objects are not empty, otherwise cancel the operation
with error message.

Pull Request: https://projects.blender.org/blender/blender/pulls/134831
2025-02-20 16:19:26 +01:00
Torsten Keßler
dc69ff5981 Cycles: Fix library search path for HIPRT
In contrast to libamdhip64, for which blender searches in multiple directories,
libhiprt64 only had limited support for non-standard installation directories.
With this commit, the library lookup for HIPRT is handled in a similar way in
the original HIP/ROCm module. This also fixes issues for downstream Linux
distributions where HIPRT support was enabled during build time but was not
available at runtime.

Co-authored-by: Torsten Keßler <t.kessler@posteo.de>
Pull Request: https://projects.blender.org/blender/blender/pulls/131046
2025-02-20 15:15:36 +01:00