Commit Graph

15060 Commits

Author SHA1 Message Date
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
Campbell Barton
60aede77af Fix use after free error rendering in background mode on Wayland
The event handing thread wasn't properly shutdown in background mode.

Resolve by disabling threaded event handling in background mode.
2025-05-30 12:32:06 +10:00
Campbell Barton
fbe28d16bd Cleanup: use a separate logging callback in background in Wayland 2025-05-30 12:07:40 +10:00
Hans Goudey
91803e130f Cleanup: Grammar: Fix uses of "for e.g."
e.g. stands for "exempli gratia" in Latin which means "for example".
The best way to make sure it makes sense when writing is to just expand
it to "for example". In these cases where the text was "for e.g.", that
leaves us with "for for example" which makes no sense. This commit fixes
all 110 cases, mostly just just replacing the words with "for example",
but also restructuring the text a bit more in a few cases, mostly by
moving "e.g." to the beginning of a list in parentheses.

Pull Request: https://projects.blender.org/blender/blender/pulls/139596
2025-05-29 21:21:18 +02:00
Aras Pranckevicius
4a328b5a63 Nodes: Voronoi node CPU optimizations
Several small speedups for Voronoi node (no behavior change). This
affects Cycles and CPU execution of Voronoi node e.g. in Compositor.

- F1 mode: when evaluating distance for Voronoi cells, use a faster
  distance estimation, and only do final distance calculation on the
  resulting closest cell. This is only really relevant for the default
  Euclidian distance, where this saves a square root per evaluated cell
  (in 3D Voronoi case saves 26 square roots; in 4D case saves 80 square
  roots).
- N-Sphere Radius mode: speedup by doing squared distance calculations.
  We only need to find the closest one, so again doing the square root
  per cell is not needed here.

Something like 5%-10% speedup for F1 3D Voronoi; more performance details
in the PR.

Pull Request: https://projects.blender.org/blender/blender/pulls/139490
2025-05-29 15:40:31 +02:00
Campbell Barton
479d1f1d16 Cleanup: use doxygen doc-strings, spelling (make check_spelling_*) 2025-05-29 11:00:53 +10:00
Brecht Van Lommel
0e7a696819 Cleanup: Unused arguments in Cycles kernel
And add back the compiler flag that hid them.

Pull Request: https://projects.blender.org/blender/blender/pulls/139497
2025-05-27 21:30:45 +02:00
Lukas Stockner
507267393e Cleanup: Cycles: Restructure camera viewplane calculation
This started with investigating a render issue that appears to be caused by
GCC 15. From what I can tell, it was caused by
`*viewplane = (*viewplane) * bcam->zoom;`.

I'm not entirely sure what the root cause is (potentially pointer aliasing?),
but the restructured code works fine now.

Pull Request: https://projects.blender.org/blender/blender/pulls/139416
2025-05-26 22:24:20 +02:00
Jeroen Bakker
6b1ef63f4d Fix: Vulkan: Swapchain validation
On selected platforms there were some validation errors. It was caused by
platforms that returned a different number of swapchain images then were
requested. In that case the semaphores can get out of sync.

Current mechanism isn't future proof as the max number of images are
statically defined.

For this change the present semaphores is also separated from the frames
to better support out of order swapchain images.

Pull Request: https://projects.blender.org/blender/blender/pulls/139446
2025-05-26 16:31:02 +02:00
Nikita Sirgienko
def65ee269 Cycles: Update hipSupportsDeviceOIDN after recent OIDN version upgrade
With OIDN extending its support for new AMD devices, Blender source
code needs to be updated accordingly to reflect these OIDN changes
in the hipSupportsDeviceOIDN function. This function represents
OIDN support on AMD, allowing Blender to know this information
beforehand and avoid unnecessary errors due to attempt to denoise
on unsupported devices, as it was before the introduction of
the hipSupportsDeviceOIDN function.

Pull Request: https://projects.blender.org/blender/blender/pulls/139413
2025-05-26 13:38:15 +02:00
Jeroen Bakker
4f76c75da2 Vulkan: Add ghost.vulkan logging
GHOST backend didn't use logging. This PR adds an initial ghost.vulkan
logging and improves the reporting of logging in vulkan.

logging can be enabled by `blender --log "gpu.vulkan,ghost.vulkan" --log-level 2`
it shows the optional extensions that are enabled and information about swap chain
events.

Pull Request: https://projects.blender.org/blender/blender/pulls/139437
2025-05-26 12:55:00 +02:00
Brecht Van Lommel
afad355060 Fix: Properly free Vulkan interop handle for Cycles
Unlike OpenGL and Metal, this handle is not shared, but rather Cycles
has to take ownership of it. This required a fair amount of refactoring
to ensure the handle is closed, ownership is properly transferred, and
the handle is recreated once when the pixel buffer is modified.
2025-05-26 10:59:49 +02:00
Brecht Van Lommel
d2f883d8bc Fix: Cycles Metal graphics interop not working
It needs an MTLBuffer instead of a raw pointer.
2025-05-26 10:59:49 +02:00
Brecht Van Lommel
ef0ccb6854 Build: Cycles fails to build with debug correlation macro 2025-05-26 10:59:49 +02:00