Commit Graph

15073 Commits

Author SHA1 Message Date
Brecht Van Lommel
ba5cf35d2a Fix #141381: Cycles unnecessary re-subdivision with persistent data
Pull Request: https://projects.blender.org/blender/blender/pulls/141605
2025-07-08 14:55:30 +02:00
Lukas Stockner
71cdb55953 Fix #140562: Cycles crash with texture in custom camera with SVM on GPU
After spending way too much time looking into the image handle code
because I assumed the issue is some interaction between OSL code using
a texture and the image system that's in SVM mode (which never happened
before the custom camera) with printf debuggine because OptiX doesn't
work in debug builds, it turns out the issue was something else entirely:
C++ iterator bullshit.

Specifically, when we remove an entry from services->textures, this
invalidates the iterator, so the code restarts from the beginning.
However, the for-loop still increments the iterator *before* checking
the termination criterion.
If we remove the only element of the map, we:
- Set it = map.begin(), which equals map.end() since it's empty now
- Increment it at the end of the loop iteration
- Compare it == map.end(), which is wrong now since we're past the end

No idea how this didn't blow up sooner, none of this seems camera-specific??
Anyways, the fix is simple - only increment if we didn't restart.

Pull Request: https://projects.blender.org/blender/blender/pulls/141580
2025-07-08 11:51:22 +02:00
Pratik Hadawale ~ sake :)
f090572ca8 Fix #141158: Fullscreen startup file causes white flicker with Vulkan backend
When launching Blender via blender-launcher.exe, the window briefly
displays incorrectly on startup when using the Vulkan backend. This is
caused by not properly handling the GHOST_kWindowStateFullScreen case.

Previously, even if the window state was set to fullscreen, nCmdShow
would default to SW_SHOWNORMAL or SW_SHOWNOACTIVATE. With this fix,
nCmdShow is explicitly set to SW_SHOWMAXIMIZED when the window is in
fullscreen state, preventing the flicker.

Pull Request: https://projects.blender.org/blender/blender/pulls/141518
2025-07-07 19:12:59 +02:00
Jeroen Bakker
f40e6e8a60 Fix: Vulkan: Use feature struct
Detected an incorrect structure type. A property struct was used to
store feature data. This could lead to incorrect values for enabling
descriptorBufferPushDescriptor, what isn't used.
2025-07-07 11:14:09 +02:00
Jorn Visser
94f4df8ec4 Fix #141339: Mantaflow: Clear Python errors when grids aren't available
Adding a Flow to a Mantaflow domain could sometimes cause a crash. This
was because the grids are allocated lazily, and as such, getting them
through `PyObject_GetAttrString` will fail when they are not yet
available. As the resulting Python errors were not cleared, Python could
be left in a bad state, leading to crashes. This is avoided by clearing
these errors before returning from `callPythonFunction` when such an
error is raised.

Ref !141364
2025-07-03 23:17:25 +00:00
Jonas Holzman
b0ffd4cb07 Fix: macOS: Support multi-monitor window positioning
This commit brings multi-monitor window positioning support to the macOS
GHOST backend. This fixes a plethora of issues with macOS window
creation and positioning, such as:

 * Windows not being properly restored when loading a file with Load UI
 * Users default startup windows not being properly restored on multiple
   screens
 * Temporary windows (Settings, Render, Playblast, etc..) wrongly
   appearing in unexpected places / other screens
 * Duplicating an area into a new window (AKA popping out an editor) not
   working on non-primary screens.
 * etc..

Internally, this makes all macOS windows coordinates be relative to the
user primary monitor, instead of being local to the currently focused
one. I have tested this to properly work using all sorts of multiple
screen arrangements, and can also confirm that restoring windows from
screens that do not exist anymore / are now out of bounds (due to being
unplugged or re-arranged) also works properly, in which case they get
snapped back to the closest available screen similarly to other backends.

This fixes issue #126410 and implements behavior described in TODO task #69819.

Pull Request: https://projects.blender.org/blender/blender/pulls/141159
2025-07-03 00:05:52 +02:00
Michael Jones
681eed7e4d Fix #135659: Some types of motion are incorrect at low step counts with MetalRT
Following #136253, this PR enables decomposed MetalRT motion
interpolation on macOS 15.6. The bounding box issue is fixed
in the latest macOS 15.6 beta (24G5054d).

Pull Request: https://projects.blender.org/blender/blender/pulls/141207
2025-07-02 10:41:42 +02:00
Thomas Dinges
61d51a5643 Cleanup: Make format 2025-07-01 15:14:37 +02:00
Michael Jones
03183c3328 Fix #135194: Deleting the last object in a scene leaves it visible in the viewport with MetalRT
TLAS wasn't being refreshed when empty.

This PR removes a spurious early-exit during BVH build that was preventing
the TLAS from being recreated when it was empty.

Pull Request: https://projects.blender.org/blender/blender/pulls/141215
2025-07-01 14:25:09 +02:00
Damien Picard
301274f398 I18n: Translate user preferences GPU device tooltips
GPU devices can only be selected in the user preferences if a suitable
device is available. This uses a dynamic enum and the items are not
always defined in RNA, so they need to be extracted manually using
`n_()`.

Also rephrase one message slightly to respect the style guide
("Don't" -> "Do not").

In addition, fix my mistake where an import was mixed up
(`pgettext_tip` was imported as `n_`).

Pull Request: https://projects.blender.org/blender/blender/pulls/141244
2025-07-01 10:47:10 +02:00
Alaska
fe346a32ec Cycles: Disable HIP RT by default in Blender 4.5
At the moment there are two main usability issues that make it hard to
recommend to enable HIP RT by default:
- Dramatically increased memory usage during BVH construction on
  high poly meshes compared to BVH2 (#136174)
  - This issue can be fixed by using the "balanced" HIP RT BVH, but
  it requires a HIP RT update that won't make it into 4.5 (!136622)
- Many Blender and GPU driver crashes when modifying objects in the
  viewport. #140763, #140738, #139013, #138043

Pull Request: https://projects.blender.org/blender/blender/pulls/140794
2025-06-30 18:17:01 +02:00
Xavier Hallade
7691e6520b Fix #141171: oneAPI: Rendering artifacts in barbershop scene
max_shaders was not updated when Embree was disabled.

Pull Request: https://projects.blender.org/blender/blender/pulls/141175
2025-06-30 16:39:53 +02:00
Brecht Van Lommel
9711efece7 Fix #141085: Cycles adaptive subdivision crash with zero length edges
As produced by booleans in the reported blend file.

Pull Request: https://projects.blender.org/blender/blender/pulls/141105
2025-06-28 00:03:45 +02:00
Jeroen Bakker
a74b663bf9 Cleanup: Vulkan: Enable extensions (2)
Missing part of the cleanup done by 225449b96d
2025-06-27 11:26:24 +02:00
Jeroen Bakker
225449b96d Cleanup: Vulkan: Enable extensions
When the list of extensions is constructed for `vkCreateDevice` it
uses a function that retrieves all extensions just to iterate to
check a specific extension is supported. However there is already a
list cached that is that is the subset of the desired extensions that
are supported by the device.

This cleanup will use that list instead of requiring all supported
extensions.

Pull Request: https://projects.blender.org/blender/blender/pulls/141074
2025-06-27 10:50:58 +02:00
Jeroen Bakker
d67b705d1c Fix: Vulkan: Validation error Wayland+NVIDIA
This PR fixes a validation error about the swapchain semaphores. When
swapchain maintenance 1 is supported the semaphores can be reused, but
requires a fence. We didn't implement the fence. This PR doesn't reuse
the semaphores as introducing the fence leads to more changes.

Pull Request: https://projects.blender.org/blender/blender/pulls/141066
2025-06-27 08:58:37 +02:00
Campbell Barton
2a757f469c Fix cursor size being ignored by custom cursors under Wayland
The theme cursor size was ignored when setting custom cursors
such as the knife, only the DPI from GHOST was taken into account.

This meant cursors such as the knife would sometimes display too small.

Now when the theme-size is larger, a larger cursor will be used.

Currently the theme size is read from XCURSOR_SIZE environment variable
however it may be read from the system preferences in the future.

Also fix the software cursor sizes which incorrectly used the UI scale
preference which is ignored by cursor sizes.
2025-06-25 04:39:57 +00:00
weizhen
bf9836da65 Fix: Cycles not building with OptiX 9.0
As suggested by @pmoursnv

Was throwing errors like  `identifier "half" is undefined`.

Pull Request: https://projects.blender.org/blender/blender/pulls/140676
2025-06-20 14:19:43 +02:00
Lukas Stockner
8f00a00283 Fix #138188: camera_shader_random_sample returns zero if DOF is off 2025-06-19 20:03:03 +02:00
Brecht Van Lommel
39e7c2444e Fix #139614: Cycles CUDA + Vulkan interop fails with unknown error on GTX 970
The cause of the error is unknown, but instead of failing only print an error
and continue without graphics interop.

Pull Request: https://projects.blender.org/blender/blender/pulls/140657
2025-06-19 15:21:11 +02:00
Campbell Barton
41bf2f598f Cleanup: spelling in comments (make check_spelling_*) 2025-06-19 00:10:18 +00:00
Brecht Van Lommel
a7f9ad5af6 Fix #140527: Cycles CUDA + Vulkan animation render memory leak
Missing call to free memory for graphics interop.

Pull Request: https://projects.blender.org/blender/blender/pulls/140612
2025-06-18 19:27:44 +02:00
Alaska
353789c559 Fix: Cycles distributed memory toggle could appear on unsupported configurations
The distributed memory access toggle in Cycles preferences would show up
when a user has two GPUs that can access each other's memory, but only one
of them is supported by Cycles.

For example the AMD RX 5700XT and AMD Vega 64 can access each other's
memory, but only the 5700XT is supported by Cycles.

Pull Request: https://projects.blender.org/blender/blender/pulls/140521
2025-06-18 16:02:06 +02:00
Xavier Hallade
2df163a648 Fix: Cycles low performance with scenes with many shaders on Arc B570
The performance of the sorted_paths_array kernel on B570 is problematic.
Relying on local sorting+partitioning instead gives a 25% overall rendering
speedup and no regression in shade_surface when rendering Agent 327 Barbershop scene.
On Arc A770, it still gives a 2% speedup when rendering Barbershop.

Pull Request: https://projects.blender.org/blender/blender/pulls/140308
2025-06-18 08:21:19 +02:00
Brecht Van Lommel
e84fad92ea Fix #139986: Cycles crash on some scene updates, after Embree upgrade
Device::const_copy_to is sometimes called when the Embree BVH has been freed
and not replaced yet. Previously this was a simpler pointer copy, now there is
a function call. Make sure it's just a function copy.

Thanks to Nikita Sirgienko for figuring this out.

Pull Request: https://projects.blender.org/blender/blender/pulls/140457
2025-06-16 17:59:57 +02:00
Brecht Van Lommel
f7ffcfe652 Cleanup: Cycles: Use default initializers in oneAPI device
Ref #140457
2025-06-16 17:59:50 +02:00
Brecht Van Lommel
7f380e0644 Revert "Fix: Cycles: Do not count volume bounds bounce as transparent"
This reverts commit 23c762e388 in the
blender-v4.5-release branch to work around HIP compiler issues. It will
remain in the main branch.

Ref blender/blender#139836
2025-06-11 15:47:07 +02:00
Brecht Van Lommel
45b11a6619 Revert "Fix: Cycles: Inconsistency in transparent bounces for NEE and forward path"
This reverts commit 64dc9cc98c in the
blender-v4.5-release branch to work around HIP compiler issues. It will
remain in the main branch.

Ref blender/blender#139836
2025-06-11 15:47:07 +02:00
Brecht Van Lommel
34838a9531 Revert "Cycles: Fix inconsistency in Ng handling between Microfacets and other closures"
This reverts commit a6015e1411 in the
blender-v4.5-release branch to work around HIP compiler issues. It will
remain in the main branch.

Ref blender/blender#139836
2025-06-11 15:47:07 +02:00
Brecht Van Lommel
04e325029f Revert "Cycles: Guiding cleaning up and refactoring the guiding code"
This reverts commit 5abf42012d in the
blender-v4.5-release branch to work around HIP compiler issues. It will
remain in the main branch.

Ref blender/blender#139836
2025-06-11 15:47:06 +02:00
Brecht Van Lommel
501b4641f6 Revert "Cleanup: Unused arguments in Cycles kernel"
This reverts commit 0e7a696819 in the
blender-v4.5-release branch to work around HIP compiler issues. It will
remain in the main branch.

Ref blender/blender#139836
2025-06-11 15:47:06 +02:00
Campbell Barton
c8e31d34b4 Cleanup: quiet CMake warnings from use of undefined variables 2025-06-11 16:22:18 +10:00
Jeroen Bakker
f23f498864 Fix #139815: Vulkan: Infinite loop when loading minimized windows
e934792169 introduced a workaround for
NVIDIA windows where NVIDIA drivers fail to allocate swapchain images
of minimized windows. The fix was to clamp it to 1,1. With this clamping
AMD driver seems to tell Blender that the created swapchain is suboptimal,
and needs to be recreated. This results in over and over creation of
swapchains as they are all considered sub-optimal.

This PR limits the clamping to NVIDIA drivers only.

Pull Request: https://projects.blender.org/blender/blender/pulls/140112
2025-06-10 14:39:51 +02:00
Jeroen Bakker
4a88c14d95 Fix #139917: Vulkan: Increase number of render frames
The number of render frames influences how long discarded memory will be
kept. There are platforms that require 5 frames to work succesfully.

Pull Request: https://projects.blender.org/blender/blender/pulls/139934
2025-06-06 16:02:47 +02:00
Jeroen Bakker
66d361bd29 Vulkan: Add support for descriptor buffers
Descriptor sets/pools are known to be troublesome as it doesn't match
how GPUs work, or how application want to work, adding more complexity
than needed. This results is quite an overhead allocating and
deallocating descriptor sets.

This PR will use descriptor buffers when they are available. Most platforms
support descriptor buffers. When not available descriptor pools/sets
will be used.

Although this is a feature I would like to land it in 4.5 due to the API changes.
This makes it easier to fix issues when 4.5 is released.
The feature can easily be disabled by setting the feature to false if it has
to many problems.

Pull Request: https://projects.blender.org/blender/blender/pulls/138266
2025-06-06 10:20:36 +02:00
Brecht Van Lommel
a4cfd14f0a Fix #137966: oneAPI crash when max texture size is exceeded
Until the texture cache addresses this properly, show a useful error rather
than crashing.

Pull Request: https://projects.blender.org/blender/blender/pulls/139892
2025-06-05 20:37:25 +02:00
Brecht Van Lommel
0add3f31a2 Cycles: Bump OptiX minimum and release version to 8.0.0
This requires a minimum driver version of 535, however most devices
were already requiring 570 due to the CUDA toolkit version.

The update is required to be able to use an API function for correct
stack size calculation.

Code for older API versions has been removed.

Fix #138185: OSL custom camera errors with OptiX

Pull Request: https://projects.blender.org/blender/blender/pulls/139801
2025-06-04 19:24:21 +02:00
Campbell Barton
6a1fa176ef Cleanup: spelling in comments & duplicate terms (check_spelling.py)
Also minor clarification in doc-string.
2025-06-04 01:51:29 +00:00
Lukas Stockner
39d7576844 Cycles: Switch OptiX OSL to use LLVM bitcode for shadeops
This is required to make ray differentials work correctly for OSL custom
cameras.

But it also lets us simplify the implementation, and makes the OSL
functionality more complete, such as implementing all noise types.

Pull Request: https://projects.blender.org/blender/blender/pulls/138161
2025-06-03 20:12:07 +02:00
Brecht Van Lommel
a3bfd4139e Fix #139791: Crash with HIP-RT and multi GPU BVH after recent fix
Keep around the dummy BVH for lights, even if it serves no purpose for now.
Previously I assumed it was not needed, but there is some device specific
code that assumes it exists, and not much point trying to refactor that now
when in the future we actually want to create a BVH for lights.

Pull Request: https://projects.blender.org/blender/blender/pulls/139798
2025-06-03 20:09:32 +02:00
Nikita Sirgienko
69091c5028 Cycles: Show device optimizations status in preferences for oneAPI
With these changes, we can now mark devices which are expected to work as
performant as possible, and devices which were not optimized for some reason.

For example, because the device was released after the Blender release,
making it impossible for developers to optimize for devices in already
released unchangeable code. This is primarily relevant for the LTS versions,
which are supported for two years and require proper communication about
optimization status for the new devices released during this time.

This is implemented for oneAPI devices. Other device types currently are
marked as optimized for compatibility with old behavior, but may implement
the same in the future.

Pull Request: https://projects.blender.org/blender/blender/pulls/139751
2025-06-03 20:07:52 +02:00
David Murmann
6805385cbe Fix #138509: Cycles: Point clouds do not render properly when using spatial splits
The bounds growth should take the radius of the points into account.

This affect BVH2, so GPU rendering without hardware ray-tracing.

Pull Request: https://projects.blender.org/blender/blender/pulls/139604
2025-06-03 19:28:47 +02:00
Jeroen Bakker
aa8c56935e Refactor: Vulkan: Move code from header to compile unit
!139630 requires the implementation to be part of the compile
unit.
2025-06-03 10:39:47 +02:00
Hans Goudey
77b14f2dcb Cleanup: Grammar: Fallback vs. fall back
The former is a noun or adjective, the latter is a verb.
2025-06-02 17:13:56 -04:00
Hans Goudey
d94ef63cb3 Allocator: Use calloc when alignment is compatible
calloc is generally faster than zeroing separately after a regular
allocation. Our allocator API exposed an allocation call with "calloc"
in the name that didn't actually use "calloc" because it had an
alignment argument (there is no standardized calloc-with-alignment
provided by the OS). However, we can still use calloc internally if
the alignment fits within the default. That just aligns the function
better with performance expectations.

Pull Request: https://projects.blender.org/blender/blender/pulls/139749
2025-06-02 22:18:55 +02:00
Brecht Van Lommel
4c56c2d7b0 Fix: Crash in BVH2 instance packing after recent bugfix in bc543ec531
Previously there was some unintentional empty BVH building happenig for lights.
2025-06-02 15:54:56 +02:00
Brecht Van Lommel
bc543ec531 Fix #139670: Cycles crash with persistent data and light geometry
After refactor in e813e46327. Don't try to rebuild BVH for light geometry
which does not need one.
2025-06-02 13:59:14 +02:00
Brecht Van Lommel
50b554e1aa Cleanup: Unused parameter warning 2025-06-02 13:59:14 +02:00
quackarooni
0a1ff2b2ff Nodes: add "Power" and "Sign" operations to Vector Math node
This adds "Power" and "Sign" as per-element/channel operations to the Vector Math node.

Pull Request: https://projects.blender.org/blender/blender/pulls/139474
2025-06-02 08:53:13 +02:00
Campbell Barton
da339d31cd Fix out-of-bounds write with Wayland compose-key event handling
`xkb_compose_state_get_utf8` may return multiple characters, while
this isn't supported, prevent a buffer overflow & report a warning.

Co-authored-by: Phoenix Katsch <phoenixkatsch@gmail.com>

Ref: !114612
2025-05-30 20:34:50 +10:00