Commit Graph

14602 Commits

Author SHA1 Message Date
Weizhen Huang
b0e3cd14ff Cleanup: Compiler warning
use reference type `BL::ID &` to prevent copying
2025-02-05 16:28:14 +01:00
Nikita Sirgienko
bee534eea5 Build: Upgrade Intel Graphics Compiler to 2.1.14 on Linux
This corresponds the latest rolling 2448.13 release:
https://dgpu-docs.intel.com/releases/packages.html?release=Rolling+2448.13&os=Ubuntu+24.04

Graphics compiler upgrades require increasing the minimum required
driver (compute-runtime) version to the corresponding one to guarantee
compatibility, which is XX.XX.31740.15 in this release, so we bump this
requirement accordingly.

Co-authored-by: Xavier Hallade <me@ph0b.com>
Pull Request: https://projects.blender.org/blender/blender/pulls/134051
2025-02-05 15:00:04 +01:00
Weizhen Huang
d2db9927ed Fix #86648: reduce ray differentials size for bump mapping
Use sub-pixel differentials for bump mapping helps with reducing
artifacts when objects are moving or when textures have high frequency
details.

Currently we scale it by 0.1 because it seems to work good in practice,
we can adjust the value in the future if it turns out to be impractical.

Ref: #122892

Pull Request: https://projects.blender.org/blender/blender/pulls/133991
2025-02-05 13:39:27 +01:00
Weizhen Huang
f4e4f19af2 Cleanup: Cycles: improve comments and variable names of bump-related functions
- Rename dx/dy -> dfdx/dfdy to match the actual computed quantity
- Add template functions to compute dfdx/dfdy on triangles for sharing
  among different data types
- Add documentation to some functions
- Some code shuffling that makes it easier to scale dfdx/dfdy in the
  future
- Some other trivial changes
2025-02-05 13:39:27 +01:00
Campbell Barton
4669e0f1ab Fix UNIX NDOF state being start/finish during continuous motion
Logic to ensure finish events were sent wasn't working properly
because processing the events could run before the SPNAV API had
filled the event queue.

Resolve by adding a delay of 100ms, before generating a "finish" event.

For the user this caused the NDOF Guide to flicker while navigating.
2025-02-05 22:03:02 +11:00
Campbell Barton
613e34b559 Docs: cross reference progress enum for GHOST/WM API's
Note that these enums need to be kept in sync.
2025-02-05 21:53:52 +11:00
Campbell Barton
df3d1bf506 Cleanup: use const arguments & variables where appropriate 2025-02-05 14:38:56 +11:00
Campbell Barton
bc6dc89d50 Cleanup: quiet check_spelling_* warnings, use doxygen doc-strings 2025-02-05 10:29:00 +11:00
Alex
c6d7bee181 Cycles: Burley diffuse closure for MaterialX compatibility
Add Burley diffuse to OSL for MaterialX compatibility. It is OSL only and
isn't a closure that will be looked for in SVM.

Pull Request: https://projects.blender.org/blender/blender/pulls/133845
2025-02-04 19:38:56 +01:00
Brecht Van Lommel
f80f97ca0d Refactor: Cycles: Rename rcp to reciprocal
To avoid symbol conflicts with upcoming HIP changes. Also remove
unused implementations for float4 and float8.

Pull Request: https://projects.blender.org/blender/blender/pulls/134045
2025-02-04 18:59:24 +01:00
Jonas Holzman
ce42d92503 macOS: Colored Titlebar and WM Window Decoration Styles API - GSoC 2024
As part of the GSoC 2024 project "Improvements to the Blender macOS User
Interface Experience" [1], this patch implements colored titlebar window
decorations on macOS, based on the current Blender theme colors.

Additionally, this patch introduces a new WM/GHOST API for implementing
and enabling custom decoration styles on any system/desktop environment
that support customizing window decorations.

[1]: https://devtalk.blender.org/t/gsoc-2024-proposal-improvements-to-the-blender-macos-user-interface-experience/34022)

Pull Request: https://projects.blender.org/blender/blender/pulls/123982
2025-02-04 16:18:19 +01:00
Campbell Barton
6fcd84721c Cleanup: quiet some warnings from check_pep8 target 2025-02-04 14:51:17 +11:00
Campbell Barton
95393726b0 Cleanup: quiet check_spelling_* warnings 2025-02-04 14:43:20 +11:00
Xavier Hallade
e7589f8973 Fix: Cycles: Missing texture transfers in oneAPI backend
Since 2cfe2e0bfe, textures were not being
allocated nor transfered to device.

This fix improves the situation reported in
https://projects.blender.org/blender/blender/issues/133953 but is not
enough to make all unit tests pass.
2025-02-03 20:20:21 +01:00
Weizhen Huang
1b2ed045c1 Fix: Cycles: Wrong differentials of curve attributes
The barycentric coordinates u/v are aligned with the curve, but the
local coordinate system is created from the geometry normal and can
differ from uv.

Pull Request: https://projects.blender.org/blender/blender/pulls/133882
2025-02-03 10:58:25 +01:00
Weizhen Huang
e9c39a6dcd Fix: Cycles: Wrong differentials of Wireframe nodes for bump mapping
Bump map differentials are computed in `svm_node_set_bump()`, other
shader nodes should just evaluate at shifted locations.

Pull Request: https://projects.blender.org/blender/blender/pulls/133876
2025-02-03 10:57:34 +01:00
Campbell Barton
ded798ba28 Fix #133921: Borderless windows on Wayland when run from VSCode
Workaround a problem where Electron overrides XDG_CURRENT_DESKTOP
by checking if an "ORIGINAL_" prefixed version of the variable.
2025-02-03 19:35:11 +11:00
Brecht Van Lommel
0d92a7f57a Cleanup: Various clang-tidy warnings in intern
Pull Request: https://projects.blender.org/blender/blender/pulls/133734
2025-01-31 17:03:18 +01:00
Brecht Van Lommel
38a71fc7d1 Cleanup: Various clang-tidy warnings in iksolver
Pull Request: https://projects.blender.org/blender/blender/pulls/133734
2025-01-31 17:03:18 +01:00
Brecht Van Lommel
478426c937 Cleanup: Various clang-tidy warnings in blenkernel
Pull Request: https://projects.blender.org/blender/blender/pulls/133734
2025-01-31 17:03:17 +01:00
Lukas Stockner
0677e19fa0 Fix: Cycles: Wrong motion transform interpolation when using velocity
The issue here is that originally, the step count for the geometry's
motion and the object transform's motion were tied together, so a
single variable is used to store that step count.
However, when using the velocity attribute, it's possible for the step
counts to differ, which will lead to an incorrect interpolated object
transform in the kernel.

Pull Request: https://projects.blender.org/blender/blender/pulls/133788
2025-01-31 00:47:55 +01:00
Alex
0fdf916de2 Cycles: Sheen BSDF compatibility for MaterialX
Pull Request: https://projects.blender.org/blender/blender/pulls/133797
2025-01-30 11:15:43 +01:00
Alex
4c7129be72 Cycles: OSL subsurface_bssrdf compatibility for MaterialX
Pull Request: https://projects.blender.org/blender/blender/pulls/133612
2025-01-30 08:51:44 +01:00
Lukas Stockner
c997e61414 Cycles: Bump minimum OSL version to 1.13.4
That version has a bunch of API changes, so by dropping support for older
versions we can remove old compatibility code.
Also, that version is required for OptiX support, so building a fully-featured
Cycles wasn't possible with older OSL anyways.

Pull Request: https://projects.blender.org/blender/blender/pulls/133746
2025-01-29 21:17:21 +01:00
Brecht Van Lommel
c4c0c23c5a Fix: Cycles: Always try to alloc MEM_DEVICE_ONLY on device
Regardless of what mem info reports. We can't move this to the host, so
might as well try because the free memory might not be a reliable predictor
of success.

Pull Request: https://projects.blender.org/blender/blender/pulls/132912
2025-01-29 14:12:25 +01:00
Brecht Van Lommel
e8ebcb3ee3 Fix: Cycles: Check if memory is host mapped without access to device_mem_map
This avoids concurrency issues.

Pull Request: https://projects.blender.org/blender/blender/pulls/132912
2025-01-29 14:12:23 +01:00
Brecht Van Lommel
8b7fce492e Refactor: Cycles: Change API so host and device memory are freed together
With host mapped memory these can be shared, and we can't get back the
original host pointer unless we make a copy which is inefficient.

Also add asserts to verify this doesn't happen.

Pull Request: https://projects.blender.org/blender/blender/pulls/132912
2025-01-29 14:12:19 +01:00
Brecht Van Lommel
c0ba800f64 Refactor: Cycles: Avoid double host alloc in HIP-RT
This code should be changed to not modify host pointers directly. But as
long as we are going to do it, avoid unnecessary alloc and immediate free.

Pull Request: https://projects.blender.org/blender/blender/pulls/132912
2025-01-29 14:12:16 +01:00
Brecht Van Lommel
b06def6b3e Refactor: Cycles: Remove confusing test for condition that should not happen
Device shouldn't have to allocate host pointer.

Pull Request: https://projects.blender.org/blender/blender/pulls/132912
2025-01-29 14:12:12 +01:00
Brecht Van Lommel
1ec04e0eec Fix: Cycles: Only move textures to host on one device at a time
This was not thread safe. And it's better to do them one by one to avoid
moving more than is needed, when another thread already freed up enough.

Thanks to Jorn Visser for investigating and finding this problem.

Pull Request: https://projects.blender.org/blender/blender/pulls/132912
2025-01-29 14:12:09 +01:00
Brecht Van Lommel
cd3d3b2646 Refactor: Cycles: Delay load_texture_info() to enqueue
Doing it immediately after moving textures to the host is less efficient, and
interacts in confusing ways.

Pull Request: https://projects.blender.org/blender/blender/pulls/132912
2025-01-29 14:12:06 +01:00
Brecht Van Lommel
fec593ec3b Fix: Cycles: Avoid unnecessary move to host with multi-device
If one of the devices already used host happed memory but another not,
it would previously realloc both.

Thanks to Jorn Visser for investigating and finding this problem.

Pull Request: https://projects.blender.org/blender/blender/pulls/132912
2025-01-29 14:12:02 +01:00
Brecht Van Lommel
2cfe2e0bfe Fix: Cycles: Re-copy memory from host to device without realloc
Should be a bit more efficient, and it fixes host memory fallback bugs,
where host memory was incorrectly freed during re-copy. For the case
where memory should get reallocated on the host, a new mem_move_to_host
was added.

Thanks to Jorn Visser for investigating and finding this problem.

Pull Request: https://projects.blender.org/blender/blender/pulls/132912
2025-01-29 14:11:50 +01:00
Brecht Van Lommel
0e8a7c751a Refactor: Cycles: Simplify util_guarded_mem_alloc/free calls
Pull Request: https://projects.blender.org/blender/blender/pulls/132912
2025-01-29 14:11:47 +01:00
Brecht Van Lommel
1fc73188e3 Cleanup: Code style 2025-01-29 14:10:13 +01:00
Campbell Barton
bd1ded952b Cleanup: spelling in comments 2025-01-29 12:31:19 +11:00
Lukas Stockner
ace85d3338 Fix #131218: Cycles: Race condition when syncing motion blur
The issue here is that motion_steps handling is a bit complex, and the
parallel synchronization of geometry does not play well with it.

The obvious result of this was a crash related to the main thread
checking attributes while the geometry sync was changing them, but
there was also another race condition that could result in ending up
with the wrong motion_steps.

Specific changes:
- Change place where `motion_steps` is set to avoid concurrent access
- Change the default `motion_steps` to zero, since they won't be
  explicitly set if there's no motion now
- Don't skip `motion_steps` copy in `sync_X` since it's no longer set
  in `sync_object` and we need to transfer the value in case it was set
  to 3 by the velocity code since that's no longer the default

Pull Request: https://projects.blender.org/blender/blender/pulls/133669
2025-01-29 01:59:38 +01:00
Lukas Stockner
a6e7bf2095 Cycles: Support Ray Depth attributes for OptiX OSL
Following the ShaderGlobals refactor, we can now easily pass IntegratorState
along on the GPU side as well, so let's implement these missing attributes.

Pull Request: https://projects.blender.org/blender/blender/pulls/133689
2025-01-29 01:01:08 +01:00
Lukas Stockner
e0d14d3b92 Cycles: Refactor: Store Cycles-specific pointers in our own ShaderGlobals
OSL has OSL::ShaderGlobals, which contains all the state for OSL shader
execution. The renderer fills it out and hands a pointer to OSL, and any
callbacks (e.g. for querying attributes) get the pointer back.

In order to store renderer-specific data in it, there's a few opaque pointers
in the struct, but using those has led to a mess of reinterpret_cast<> and
pointer indirection in order to carry all the data around.

However, there is a way to do this nicer: Good old C-style struct inheritance.
In short: Unless you're doing pointer arithmetic, you can just add additional
data at the end of a base struct, and the rest of the code won't care.

In this case, this means that we can have our own ShaderGlobals struct and
add more Cycles-specific data at the end. Additionally, we can replace the
generic opaque void pointers with ones of the correct type, which saves us
from needing to cast them back.

Since we have a copy of ShaderGlobals for GPU OSL anyways, it's just a matter
of refactoring the code a bit to make use of that.

The advantages of this are:
- Avoids casts all over the place, just needs one cast to turn our
  ShaderGlobals into the "base" type that OSL expects and one to turn the
  pointer that OSL gives us on callbacks back into our "derived" type.
- Removes indirection, all the relevant stuff (sd, kg, state) is now
  directly in the ShaderGlobals
- Removes some OSL-specific state from ShaderData, which helps to keep
  memory usage down

Pull Request: https://projects.blender.org/blender/blender/pulls/133689
2025-01-29 01:01:08 +01:00
Hans Goudey
7d6e098ca1 Cleanup: Remove unused includes in blenkernel
Pull Request: https://projects.blender.org/blender/blender/pulls/133688
2025-01-28 15:27:34 +01:00
Alex
e39b2ee816 Cycles: OSL oren_nayar_diffuse_bsdf compatibility for MaterialX
The oren_nayar_diffuse_bsdf closure in OSL had two issues:
- It broke when used with roughness of zero
- It only used the provided albedo for energy compensation, so it still
  required the user to multiply with the albedo

Therefore, this handles the zero roughness corner case and includes
the albedo in the closure weight.
This makes no difference when using the closure through the Diffuse
or Principled BSDF nodes, only for custom OSL shaders.

Pull Request: https://projects.blender.org/blender/blender/pulls/133597
2025-01-27 17:58:20 +01:00
Alex
4a4e456e37 Cycles: OSL uniform_edf closure for better MaterialX compatibility
Pull Request: https://projects.blender.org/blender/blender/pulls/133575
2025-01-25 21:17:17 +01:00
Bastien Montagne
9c237af041 Refactor: RNA: add discrete suffix to RNA_pointer_create.
This is a noisy preliminary step to the 'RNA ancestors' change. The
rename helps clearly tell what each `pointer_create` function does.

Pull Request: https://projects.blender.org/blender/blender/pulls/133475
2025-01-24 16:45:32 +01:00
Brecht Van Lommel
82cc0a3eff Fix #124847: Cycles OSL UDIM wrong extrapolation with negative UV
Pull Request: https://projects.blender.org/blender/blender/pulls/133507
2025-01-23 22:20:52 +01:00
Brecht Van Lommel
63e2adaa79 Fix #127875: Cycles renders image with single UDIM tile wrong
Properly support this case instead of assuming it's not a UDIM.

Pull Request: https://projects.blender.org/blender/blender/pulls/133504
2025-01-23 21:20:01 +01:00
Brecht Van Lommel
1367a89c80 Fix: Cycles persistent data + motion blur render bugs
Objects would randomly appear and disappear, or get swapped with other
objects. This was due to a missing recalc tag, due to the object to
geometry instance mapping being incomplete.

Fix #100580
Fix #107624
Fix #132026
Fix #99281
Fix #110905

Pull Request: https://projects.blender.org/blender/blender/pulls/133490
2025-01-23 15:29:49 +01:00
Brecht Van Lommel
bd0cca5d6d Fix: Cycles Metal RT assert with persistent data render
Pull Request: https://projects.blender.org/blender/blender/pulls/133490
2025-01-23 15:29:41 +01:00
Brecht Van Lommel
14facb987e Fix #132367: Cycles tiled render cancel still does slow denoise
Read the tiles back from disk, but don't run denoiser.

Pull Request: https://projects.blender.org/blender/blender/pulls/133443
2025-01-22 15:54:41 +01:00
Brecht Van Lommel
e98b45beb1 Fix: Cycles CPU render wrong with latest OSL 1.14 2025-01-22 10:59:07 +01:00
Brecht Van Lommel
c749f6c376 Cleanup: Remove unnecessary usage of Boost in the build system
* Some libraries like Alembic and OpenColorIO for a long time removed
  header dependencies on Boost.
* No need to have BOOST_LIBRARIES anymore, only BOOST_PYTHON_LIBRARIES
  is a direct dependency through USD headers.
* OpenVDB is no longer a static library, no need to link its dependencies.

Pull Request: https://projects.blender.org/blender/blender/pulls/133424
2025-01-22 10:02:22 +01:00