Commit graph

15861 commits

Author SHA1 Message Date
Brecht Van Lommel
9c285aa0da Fix #155861: Crash rendering CMYK JPEG textures in Cycles
The OpenImageIO version we use has broken CMYK to RGB conversion in
JPEG, this is a temporary workaround until we upgrade to a newer
version. Directly read the CMYK image with libjpeg.

Note that when we upgrade, we can remove the CMYK conversion code
entirely as OpenImageIO supports this natively nowadays.

---

NOTE: This is the backport for 5.1.1.
Pull Request: https://projects.blender.org/blender/blender/pulls/157146
2026-04-10 09:07:36 +02:00
Jonas Holzman
bac15f14bd Fix #155844: Nondeterministic 3D Viewport Trackpad orbiting direction on Windows
The issue was caused by a failing `RegGetValueW()` call in
`getScrollDirectionFromReg()` within GHOST TrackpadWin32 due to
uninitialized output arguments, causing nondeterministic orbiting
direction depending on the environment.

Fixed by properly initializing the`scrollDirectionRegValue` and
`pcbData` variables passed to the function. In addition to this, a
correction was made to the default value returned in the querying
failing case, and comments were added to better detail the meaning of
return values.

Pull Request: https://projects.blender.org/blender/blender/pulls/156986
2026-04-09 09:46:48 +02:00
Jeroen Bakker
d910d3dc33 Fix #155467: Artifacts Wayland + NVIDIA 595
There is an obsolete swapchain configuration being checked.
This configuration was used 2 years ago when wayland color management
wasn’t mature. Nowadays this configuration is not being used until
the latest NVIDIA driver started to use it again. This made some bugs
appear as incorrect code paths is being selected to copy framebuffer
to the swapchain.

Pull Request: https://projects.blender.org/blender/blender/pulls/156741
2026-04-08 14:36:04 +02:00
Christoph Neuhauser
56c1868807 Fix: Vulkan: Disable vertex input dynamic state on legacy Intel iGPUs
Using VK_EXT_vertex_input_dynamic_state on Intel 7th to 10th Gen
Processor iGPUs leads to a black screen at application startup.
The usage of the extension on legacy Intel drivers is disabled to avoid
this issue. The issue was originally reported at
https://projects.blender.org/blender/blender/issues/147721 as a
follow-up of an OpenGL issue with these old iGPUs.

Pull Request: https://projects.blender.org/blender/blender/pulls/156577
2026-04-08 14:34:46 +02:00
Thomas Dinges
3b2e5b4bfb Fix compile error due to missing refactor.
Rather then backporting https://projects.blender.org/blender/blender/pulls/156169 change the line to use the old name.
2026-04-08 10:06:43 +02:00
Brecht Van Lommel
913a9f554f Fix #156290: Adaptive subdivision breaks mesh/object attributes
Implement the missing code for this, which is just copying the attribute
without interpolation.

This issue existed in Blender 5.0 already, however in Blender 5.1
attributes with constant values on other domains can get optimized
to a mesh attribute.

Pull Request: https://projects.blender.org/blender/blender/pulls/156307
2026-04-08 09:28:10 +02:00
Xavier Hallade
14ab24db7f Fix: Cycles: oneAPI: add missing ; after d15d20d51e
Fixing a typo introduced while rebasing when landing the PR.
2026-04-08 09:27:49 +02:00
Nikita Sirgienko
82e75c6316 Cycles: oneAPI: Remove separate context workaround
The minimum supported driver version for Blender 5.1 and
5.2 already includes a fix for the underlying issue, so
there is no need to keep the workaround that isolated each
device into a separate DPC++ context when multiple
descrete GPUs or Level-Zero platforms were detected.
It is now removed.

Ref #138384

Pull Request: https://projects.blender.org/blender/blender/pulls/156249
2026-04-08 09:27:41 +02:00
Nikita Sirgienko
10987816ba Fix #155964: Crash when rendering on Intel dGPU on a system with Intel iGPU
On systems with both an Intel iGPU and dGPU using different
drivers (e.g., legacy 11th-14th Gen driver alongside the
Arc driver), the oneAPI Level-Zero copy optimization extension
can cause crashes during host-to-device memory transfers.

Detect when multiple Level-Zero platforms are present, which
indicates separate Intel drivers in the system, and disable
the copy optimization extension in such configurations to
prevent crashes.

This workaround can be removed once the minimum supported
driver version includes a future fix for the underlying
issue.
2026-04-08 09:27:33 +02:00
Brecht Van Lommel
1cc874cd7b Fix #155982: Cycles denoise animation operator fails for multi-part EXR
Support reading multi-part EXR in this code, and add a test. Also fixes
the denoise_animation test being disabled.

Regression from be1619f4ad.

Pull Request: https://projects.blender.org/blender/blender/pulls/156040
2026-04-08 09:11:14 +02:00
Brecht Van Lommel
b40a427e15 Fix #155897: Cycles crash with object level materials
The object matbits array length is not guaranteed to match the length
of the material slot array in geometry. The RNA code checked for this
but the ported code did not.

Regression from 244b154bb6.

Pull Request: https://projects.blender.org/blender/blender/pulls/156029
2026-04-08 09:10:14 +02:00
Brecht Van Lommel
2fc4670f6e Fix #155851: Cycles crash with background scene
BKE_view_layer_base_find returns null for objects from background scenes
since they have no base in the current view layer. As before, such
objects will not have holdout or indirect-only flags.

Regression from 244b154bb6.

Pull Request: https://projects.blender.org/blender/blender/pulls/155876
2026-04-07 15:00:00 +02:00
Brecht Van Lommel
ee4c0a30ab Fix #155817: Cycles transparent curve shadows disappear on scene update
Match the old is_updated_geometry logic that this code replaced, to avoid
missing or unnecessary updates.

Also fix ITER_END placement so the adaptive subdivision code runs once
after the depsgraph ID iteration rather than on every iteration.

Regression from 49d34491b8.

Pull Request: https://projects.blender.org/blender/blender/pulls/155857
2026-04-07 14:59:50 +02:00
Michael Jones
81a25bf337 Fix #155588: Cycles Metal state allocation OOM issues
This fixes #155588 - an issue introduced by PR #154916.

That PR included a 10% safety margin for the working set calculations to account for certain hidden overheads when shrinking the working set size. This allowed for certain scenes like Junkshop to render on the new RAM-constrained Neo machines. However the same safety margin was also used for the state growth heuristic. This PR applies a much more aggressive threshold when growing the state size. It will only double if doing so leaves us with >= 50% of the max recommended work set available.

Pull Request: https://projects.blender.org/blender/blender/pulls/155635
2026-04-07 11:04:06 +02:00
Brecht Van Lommel
f81ba28365 Revert "Cycles: Improve Metal state allocation logic for RAM-constrained systems"
This reverts commit ffc8d818e4.

It causes increased memory usage on other systems, and it's too close
to the release to try a different fix.

Fix #155588

Pull Request: https://projects.blender.org/blender/blender/pulls/155626
2026-03-13 19:40:20 +01:00
Brecht Van Lommel
db4b36d1b2 Fix #155458: Cycles displacement with flat and smooth normals artifacts
The fix in 2dc2e0b062 to discard flat/smooth flags if there are corner
normals didn't work well for displacement. Then the normals are fully
recomputed from displacement and for this the flat/smooth flag is
needed.

Rather than discarding the flags on conversion from Blender, do it
inside Cycles after displacement.

Pull Request: https://projects.blender.org/blender/blender/pulls/155522
2026-03-11 17:51:04 +01:00
Weizhen Huang
401475c9ed Fix #153488: Cycles OpenVDB renders black on certain Metal machines
Tweak the Metal code slightly to avoid either a subtle bug on our side
or a Metal compiler bug.

Pull Request: https://projects.blender.org/blender/blender/pulls/155476
2026-03-11 15:31:43 +01:00
Sean Stirling
4cbe9ce2fe Fix: Cycles: GPU rendering error with more than 1024 shaders
The local atomic sort kernels initialize shared memory arrays sized
max_shaders, but used if (local_id < max_shaders) to do so, meaning
only one entry per thread was initialized.

With smaller workgroup sizes, further entries were left uninitialized
and caused out of bounds writes.

Replace the single-slot if-guard with a strided for loop so all
max_shaders entries are correctly initialized regardless of
workgroup size.

Pull Request: https://projects.blender.org/blender/blender/pulls/155269
2026-03-06 22:31:21 +01:00
Brecht Van Lommel
2dc2e0b062 Fix #155171: Cycles renders flat faces with custom normals wrong
The convention is that the custom normals override flat shading.
Regression from corner normals support in 6bbdad08fd.

Pull Request: https://projects.blender.org/blender/blender/pulls/155223
2026-03-05 13:33:31 +01:00
Campbell Barton
77551ef2dd Fix: drop fails on Wayland with SMITHAY based compositors
Workaround for SMITHAY where drop would fail if the last accepted
mime type wasn't known.

While the spec should allow for this, it's also not useful to report
mime types as accepted if the compositor doesn't support them.

This should fix dropping on all SMITHAY based compositors
including the Cosmic Desktop.
2026-03-05 10:21:48 +11:00
Brecht Van Lommel
44be56fd49 Cycles: Smoothly blend denoising features to avoid artifacts
Albedo and normal denoising features passes used several hard cutoffs
that lead to discontinuities in the passes and sometimes the denoised
render too. Use smooth transitions instead.

Specular roughness cutoff of 0.075 replaced by a smoothstep from 0.0
to 0.15. Specular and transparent 25% threshold replaced by diffuse to
specular ratio blend from 0.0 to 0.5.

Also stop using sample_weight which is meant for importance sampling
only.

Fix #150391
Fix #85512
Fix #78571

Pull Request: https://projects.blender.org/blender/blender/pulls/154988
2026-03-03 16:45:02 +01:00
Brecht Van Lommel
9bfdced4d0 Fix #144009: Cycles ignores straight and premul alpha override
Pull Request: https://projects.blender.org/blender/blender/pulls/154990
2026-03-02 14:09:36 +01:00
Brecht Van Lommel
8d6ccc8b8a Cleanup: Compiler warnings about struct/class mismatch 2026-03-01 00:51:03 +01:00
Brecht Van Lommel
79ee6b5f9f Cleanup: Fix various incomplete headers and wrong namespace placement
Make sure headers include all the required headers and prototypes so
they can be safely included, and users of clangd don't see errors in
their IDE.

Also fix forward declarations and pragmas that were in the wrong place.

Pull Request: https://projects.blender.org/blender/blender/pulls/154976
2026-02-27 19:17:25 +01:00
Brecht Van Lommel
934346f935 Cycles: Add Normal Map node Base option for displaced surfaces
To choose between:
* The smooth, undisplaced base surface normal and tangents, when you
  have a displacement map and normal map that match.
* The displaced surface normal and tangents, when you want to apply a
  normal map in addition to displacement.

This is Cycles only for now, to fix a regression in 5.0 regarding
adaptive subdivison.  More unified handling with EEVEE is for another
time. This is an alternative solution to replace #122397.

Fix #153670

Pull Request: https://projects.blender.org/blender/blender/pulls/154031
2026-02-27 18:52:50 +01:00
Brecht Van Lommel
3a1ffd512f Fix #154892: Cycles CUDA error when disabling light tree
The check assumed that only enabling a feature could require extra state,
but with 4b34743b4e disabling the light tree actually requires more
state. So just check for equality. I can't find a good reason it didn't
do that before, this should not have significant overhead.

Pull Request: https://projects.blender.org/blender/blender/pulls/154926
2026-02-27 16:57:32 +01:00
Michael Jones
ffc8d818e4 Cycles: Improve Metal state allocation logic for RAM-constrained systems
Refines the state allocation strategy in the Metal device queue to better utilise available RAM. Instead of using MTLDevice's `currentAllocatedSize` (which includes non-Cycles resources), use `Stats::mem_used` which more faithfully represents the working set of resources. As before, we double the state count if we can do it safely. Additionally, we reduce the state count in order to render scenes like Junkshop which otherwise wouldn't render on an 8 GiB machine.

Pull Request: https://projects.blender.org/blender/blender/pulls/154916
2026-02-27 14:00:32 +01:00
Miguel Pozo
2cae9ff558 Fix #154681: Raycast hit against Pointcloud/Hair crashes
The Raycast node assumed the hit came from a triangle when computing the
hit normal.

Use `shader_setup_from_ray` to compute the normal instead, since that's
how other paths compute the normal from a hit, and takes all geometry
types into account.

Instead of allocating the whole `ShaderData` struct, we use
`ShaderDataTinyStorage` instead, to avoid excessive register pressure.

Pull Request: https://projects.blender.org/blender/blender/pulls/154818
2026-02-26 16:58:42 +01:00
Nikita Sirgienko
b105a3bc9a Cycles: oneAPI: use ocloc 101.8424 on Windows
This new version of the graphics compiler brings a fix to recently
discovered issue with Ahead-Of-Time binaries, used right now by
Blender for upcoming Intel® Core™ Ultra Series 3 which would
lead to the rejection of the GPU binaries by the future drivers
on this platform. In order to avoid such situation, and spare
users time to recompile the GPU binaries, this upgrade is
necessary.

Previously set minimal driver version 101.8306 was not increased,
and compatibility was manually tested internally at Intel, to
ensure no problems with it.

Pull Request: https://projects.blender.org/blender/blender/pulls/154647
2026-02-24 09:58:44 +01:00
Sergey Sharybin
3a0682c527 Fix: Cycles, missing OSL headers in install
Some headers and precompiled shaders were not properly installed.
This seems to be a regression since !153424: our custom FindOSL
used to define OSL_SHADER_DIR. It is not defined by the CMake
configs from the OSL.

Pull Request: https://projects.blender.org/blender/blender/pulls/154576
2026-02-19 14:45:07 +01:00
Habib Gahbiche
ae04efabb2 Cleanup: fix DeprecationWarning caused by light.use_nodes
Also remove unused parameters in `panel_node_draw()`

Pull Request: https://projects.blender.org/blender/blender/pulls/154556
2026-02-18 20:48:29 +01:00
Weizhen Huang
efab450c9b Fix #154243: Cycles: Performance regression from motion blur on static volumes
In 35f34cd468 an offset was applied to volume object static Transform to
avoid overlap, now also apply this offset for motion blur.

Also make sure this offset is applied when comparing two transforms.

Pull Request: https://projects.blender.org/blender/blender/pulls/154366
2026-02-17 12:12:41 +01:00
Brecht Van Lommel
eb18ce1b5c Fix #154431: Cycles instance attribute crash with Windows / Clang
Unsafe assumption about alignment of attribute data.

Pull Request: https://projects.blender.org/blender/blender/pulls/154469
2026-02-16 18:49:18 +01:00
Brecht Van Lommel
ab0cb89d89 Cleanup: Cycles: Fix various compiler warnings
* Uninitialized variable warning in oneAPI.
* Use std::copy_n instead of memcpy.
* Use simpler bit packing for normal map convention that avoids
  signed/unsigned warning.
* Unnecessary device keyword for default constructor.
* Unused variables in Principled BSDF due to constexpr.
* Hydra function that should be static.

Pull Request: https://projects.blender.org/blender/blender/pulls/154430
2026-02-16 12:57:53 +01:00
Miguel Pozo
254bd0ddf9 Fix: Cycles: Wrong Raycast Hit Normal
The Hit Normal applied the transform of the casting object instead of
the hit object.

Pull Request: https://projects.blender.org/blender/blender/pulls/154380
2026-02-13 21:37:34 +01:00
Brecht Van Lommel
e580ddf160 Fix #146377: Light groups not updating with persistent data enabled
This feature is not used for viewport rendering, so a missing update
is not visible there. But for persistent data the depsgraph tag is required.

Pull Request: https://projects.blender.org/blender/blender/pulls/154271
2026-02-12 15:00:55 +01:00
Brecht Van Lommel
62a604bb54 Fix #151309, #152032: Cycles CUDA error cancelling render with volumes
The problem is that volume guiding denoising was not using the RenderWork
mechanism for scheduling like other steps in the render pipeline. This
meant that it was not affected by render_work_reschedule_on_cancel to
stop path tracing work and only do the remaining work for writing out the
render. And that in turn caused volume denoising to run on a null buffer.

Pull Request: https://projects.blender.org/blender/blender/pulls/154282
2026-02-12 15:00:24 +01:00
Brecht Van Lommel
6955eebd46 Fix #154270: Cycles particle hair sync missing attributes
This issue was introduced in d0233f7593.

Pull Request: https://projects.blender.org/blender/blender/pulls/154266
2026-02-11 18:14:40 +01:00
Brecht Van Lommel
d019ebded1 Fix #153400: Cycles error on NVIDIA Blackwell with emissive principled BSDF
This fails with CUDA 12.8 that we use for official builds, but works with
CUDA 12.9 and with other GPU generations. I could not find a logical
explanation besides a compiler bug. Upgrading would mean increasing the
minimum NVIDIA driver version which is not ideal.

I tweaked the code so the emission-only shader evaluation can optimize out
more of the principled BSDF code, which seems to sidestep the problem
and is more performant anyway. It adds some ugly indentation, but
perhaps it's best to refactor and split up this function later in main.

Pull Request: https://projects.blender.org/blender/blender/pulls/154223
2026-02-11 18:14:08 +01:00
Damien Picard
7abb17176a I18n: Fix Cycles sampling pattern enum items
These enum items are dynamic, generated from a function, so they need
to be manually extracted using `n_()`.

Reported by Paweł Mazur.

Pull Request: https://projects.blender.org/blender/blender/pulls/154225
2026-02-11 11:00:36 +01:00
Hans Goudey
d0233f7593 Fix #154205: Cycles particle hair only copies first UV / VCol
Mistake in dc471eb611

The `vcol_num` and `uv_num` variables were never actually
incremented. Change to gathering attribute names in separate
loops to make that unnecessary.

Pull Request: https://projects.blender.org/blender/blender/pulls/154212
2026-02-10 18:55:20 +01:00
Brecht Van Lommel
680e48669c Fix: Cycles colorspace_interop_id wrong check for unknown colorspace
Did not cause any bugs with current Blender usage.
2026-02-10 17:27:25 +01:00
Brecht Van Lommel
d843110bce Fix: Cycles standalone install path typo
It worked anyway because an empty path was effectively the same.
2026-02-10 17:27:25 +01:00
Brecht Van Lommel
20af403411 Fix: Cycles OutputDriver does not correctly handle tile padding
Pixels retrieved through tile.get_pass_pixels were wrong when using tiled
renders with padding for adaptive sampling. It should only return pixels
within the display window.

This case did not affect Blender, only standalone. It also only affected
CPU rendering, the GPU pass accessor is correct.

Pull Request: https://projects.blender.org/blender/blender/pulls/154171
2026-02-10 12:01:22 +01:00
Brecht Van Lommel
05e2f09fa7 Fix #146642: Memory leak warnings when killing render with Ctrl + C
Use lazy initialization for global variables, so they get destructed before the
guardedalloc leak check and destruction. The same pattern is used elsewhere
in Blender.

There may be more cases, these were the ones I found in testing. These issue
were exposed by f8eec542f4.

Pull Request: https://projects.blender.org/blender/blender/pulls/154173
2026-02-10 12:00:54 +01:00
Brecht Van Lommel
4fc20a6b62 Fix: Cycles half float build error using WITH_CYCLES_NATIVE_ONLY
Now explicitly check for __KERNEL_SSE__ before using float4 constructor
with __m128 type, and make sure it's defined in the host code on x86_64.

Pull Request: https://projects.blender.org/blender/blender/pulls/154154
2026-02-09 23:46:54 +01:00
Brecht Van Lommel
ab4efcf3c0 Fix: Cycles corner normals and displacement + bump wrong results
Vertex normals were recomputed too late to be available to store as undisplaced
normals. Now make sure they exist right before add_undisplaced is called.

Pull Request: https://projects.blender.org/blender/blender/pulls/154102
2026-02-09 23:20:15 +01:00
Brecht Van Lommel
f7bca00032 Fix #154128: Cycles normal map wrong renders after corner normal changes
After refactoring to deduplicate code, the normal for the tangent frame was
no longer properly transform to object space. Revert code to how it was
before and add a more explicit function name and comment.

Pull Request: https://projects.blender.org/blender/blender/pulls/154102
2026-02-09 23:20:15 +01:00
Jesse Yurkovich
0599d0dbbc CMake: Disable vcpkg for msbuild based builds of Cycles
Follow what was done in 23430f4db8 for the Cycles targets.

Pull Request: https://projects.blender.org/blender/blender/pulls/154038
2026-02-09 19:15:57 +01:00
Brecht Van Lommel
6163242dd9 Fix #152893: Cycles OSL multi-device does not render Sky properly
Implement equals to allow deduplicating sky textures so they are shared,
and ensure they get refreshed properly when node sockets are modified.

There is a single OSL texture name to texture handle mapping table, and
while shaders are compiled per device this mapping table is shared.

Pull Request: https://projects.blender.org/blender/blender/pulls/154062
2026-02-09 13:54:46 +01:00