Commit graph

2199 commits

Author SHA1 Message Date
Brecht Van Lommel
40600462e4 Fix: Link errors with ld, lld and lite builds
Restore the workaround that was removed in 0243d0c2fa. While the use of
CMake configs for OpenImageIO and related libraries helps, it does not
solve it for all libraries.

Add wildcards for linkers that give an error when the symbol is not present,
and add additional symbols for memory allocation related exceptions.

Pull Request: https://projects.blender.org/blender/blender/pulls/155278
2026-03-09 12:58:17 +01:00
Campbell Barton
ae5af9ad40 Cleanup: typos in help messages 2026-03-06 13:02:45 +11:00
Campbell Barton
9d302ccb0a Fix #107137: Bundled modules can be overridden by the user-site-directory
It's possible for user modules to conflict with Blender's module
causing Blender to fail to load bundled modules (zstandard in the case
of this report). Don't load the user-site-directory by default,
add a command line argument `--python-use-user-env` which exposes user
modules.

Since [0] Blender has supported the user-site-directory.
At the time the rationale was that it would mainly be used by Python
developers, for non-developers it would most likely be empty.
Some add-ons were installing packages via PIP too which is now
discouraged in favor of bundling wheels with extensions.

[0]: 72c012ab4a

Ref !149382
2026-02-06 23:14:03 +11:00
Ray Molenkamp
18a01ebc6b CMake: Remove ceres and eigen from /extern
This change reduces compile time:

```
before: 648.4 s weighted time (15645.9 s elapsed time sum, 24.1x parallelism)
after : 613.6 s weighted time (14110.1 s elapsed time sum, 23.0x parallelism)
-----------------------------------------------------------------------------
Diff  : -34.8 s                -1535.8
```

We now also bundle less libraries within the Blender code base.
2026-02-05 23:10:02 +01:00
Sebastian Parborg
0243d0c2fa Deps: Fix fragile openexr dependency linking
When working on the 5.1 library updates, I noticed that quite a few places in Blender where OpenEXR (and libraries depending on OpenEXR) didn't really seem to pull in all of the required libraries properly.
While we are working around this currently, I felt like actually doing the proper thing and using the new cmake libraries interfaces would be the best way forward as we then can rely on them pulling in all needed dependencies by themselves.

To be able to use the .cmake files, two patches are needed:

1. `openexr_deflate_cmake.diff`:
This fixes the cmake install targets to not require libdeflate if it has been complied into openexr as a static library.
2. `osl_relative_inc_cmake.diff`:
This makes it so the library targets no longer uses absolute paths for the include directories. They now use relative paths so that they can be relocated properly.

Co-authored-by: Ray Molenkamp <github@lazydodo.com>
Co-authored-by: Jonas Holzman <jonas@blender.org>
Pull Request: https://projects.blender.org/blender/blender/pulls/153424
2026-02-05 23:10:02 +01:00
Neale Swinnerton
2badc42657 NDOF: support SPNAV_SOCKET env var for custom socket path on Unix
- Support SPNAV_SOCKET env var for custom socket path.
- Set the spnav client name to "blender".

Ref !153526
2026-01-30 13:44:48 +11:00
Campbell Barton
5549bc5723 CMake: use set(VAR "") for empty initialization, unset() for cleanup
In CMake, set(VAR) without a value unsets the variable rather than
initializing it to empty. This causes issues with --warn-uninitialized
and can lead to unexpected behavior when the variable is used later.

Use set(VAR "") when initializing variables that will be appended to
or used in expressions. Use unset() to explicitly remove temporary
variables after use.

Ref !153503
2026-01-29 11:48:33 +11:00
Campbell Barton
f2871ca16b Cleanup: various spelling corrections in comments & strings 2026-01-28 14:59:34 +11:00
Jesse Yurkovich
64eae9fabe Cleanup: CMake: Remove last mentions of boost
The last real usage of boost was removed during the leadup to the 4.4
release. These are no longer used and can be removed.

The OpenVDB and OpenUSD minimum versions were bumped in the
`install_linux_packages.py` helper script to reference the versions
where boost was also removed for those deps.

NOTE: The Boost Software License references remain as we still need them.
Pull Request: https://projects.blender.org/blender/blender/pulls/151601
2026-01-27 20:48:13 +01:00
Brecht Van Lommel
b26e16e151 Refactor: Unify memory API to MEM_new and MEM_delete variations
This change removes the need to to carefully pair MEM_mallocN/MEM_new_for_free
with MEM_freeN and MEM_new with MEM_delete. Instead all function are now
variations of MEM_new and MEM_delete.

* MEM_new_for_free -> MEM_new
* MEM_mallocN -> MEM_new_uninitialized
* MEM_callocN -> MEM_new_zeroed
* MEM_freeN -> MEM_delete (for typed pointers)
* MEM_freeN -> MEM_delete_void (for void pointers)
* MEM_reallocN -> MEM_realloc_uninitialized
* MEM_recallocN -> MEM_realloc_zeroed
* MEM_dupallocN -> MEM_new (when possible)
* MEM_dupallocN -> MEM_dupalloc (for typed pointers)
* MEM_dupallocN -> MEM_dupalloc_void (for void pointers)

The MEM_malloc and MEM_calloc functions were renamed to make it clear that
they should be paired with MEM_delete and to clarify what they do.

The compiler will emit an error if MEM_delete or MEM_delete_void is used on
the wrong pointer type. However a remaining risk is casting a MEM_new allocation
with a non-trivial destructor to a void pointer (which is the same as before). This is
why MEM_delete_void and MEM_dupalloc_void exist as a separate functions,
to identify legacy code that has this risk and should be eliminated over time.

Note that MEM_new_array only supports trivially destructible types. This
avoids the need for an equivalent of the delete [] operator and the associated
mistakes that can be made. Instead MEM_delete can be used for everything. For
non-trivial types, data structures like Vector should be used instead.

MEM_dupalloc is now also more type safe. As before it is only supported on
trivially copyable types, and this is now enforced through static asserts to
prevent mistakes. It is also templated to remove the need for casts.

Pull Request: https://projects.blender.org/blender/blender/pulls/151387
2026-01-26 19:20:33 +01:00
Sebastian Parborg
f82c8bf578 Cmake: Do not use the depricated CMAKE_COMPILER_IS_GNUCC variable
We should now use 'CMAKE_C_COMPILER_ID STREQUAL "GNU"' instead:
https://cmake.org/cmake/help/latest/variable/CMAKE_COMPILER_IS_GNUCC.html
2026-01-23 15:10:28 +01:00
Thomas Dinges
f7d920a89b Build: Library changes for Blender 5.1
This commit includes new minimum compiler requirements for Blender 5.1 as well as updated and new libraries.

**New compiler requirements**
* Windows x64: Visual Studio 2022 (17.14.14 or newer)
* Windows arm64: Visual Studio 2022 (17.14.23 or newer)
* Linux x64: gcc 14 (when used with our libraries)

**New libraries**
Abseil 20250814.1
ThorVG 1.0.0-pre31
OpenJPH 0.25.2

**Updated libraries**
AOM 3.13.1
Expat 2.7.2
FFI 3.5.2
HIPRT 606b4886efabce918dd0634ef71c06615a47c83b
Imath 3.2.2
ISPC 1.29.1
libheif 1.20.2
MaterialX 1.39.4
MESON 1.9.0
minizip-ng  4.0.10
Numpy 2.3.4
oneAPI Level Zero 1.21.9
OneTBB 2022.3.0
OpenColorIO 2.5.0
OpenEXR 3.4.3
OpenImageDenoise 2.4.1
OpenImageIO 3.1.7
OpenSubDiv 3.7.0
OpenVDB 13.0.0
OpenXR 1.1.53
PIP 25.2
Python 3.13.9
ShaderC 2025.4
Vulkan 1.4.328
webp 1.6.0
Yaml CPP 0.8.0
ZSTD 1.5.7 (z-standard 0.25.0)

**Library changes**
FMT (moved from /extern to libs)
Ceres (updated version in lib, will be removed from /extern in a later commit)
Eigen (updated version in lib, will be removed from /extern in a later commit))

Ref #147201

Co-authored-by: Nikita Sirgienko <nikita.sirgienko@intel.com>
Co-authored-by: Ray Molenkamp <github@lazydodo.com>
Co-authored-by: Sebastian Parborg <sebastian@blender.org>
Co-authored-by: Anthony Roberts <anthony.roberts@linaro.org>
Co-authored-by: Jonas Holzman <jonas@holzman.fr>
Co-authored-by: Bart van der Braak <bart@blender.org>

Pull Request: https://projects.blender.org/blender/blender/pulls/149852
2026-01-22 18:49:15 +01:00
Campbell Barton
e2fcc92049 Build: fix missing include WITH_TBB_MALLOC_PROXY=ON & WITH_TBB=OFF
Resolve #152933.
2026-01-20 21:35:03 +11:00
Mark van de Ruit
2897dde564 GPU: Add --gpu-debug-no-texture-pool and texture pool selection log
Adds cli debug option `--gpu-debug-no-texture-pool`, which makes the
selected GPU backend default to `TexturePoolImpl`. Further adds log
output on `--gpu-debug` to report the selected pool impementation.

Pull Request: https://projects.blender.org/blender/blender/pulls/153023
2026-01-19 12:29:37 +01:00
Clément Foucault
9c457ddf07 GPU: Shader: Add fast shader source Preprocessor
Preprocess shader source code using a C-style preprocessor and
remove remaining unused functions afterwards.

This gives a 1.2x to 2x improvement in shader compilation speed.

The command line arguments `--debug-gpu-shader-no-preprocessor`
and `--debug-gpu-shader-no-dce` can be used to turn off all preprocessing
or only the dead code elimination phase respectively.

Pull Request: https://projects.blender.org/blender/blender/pulls/152469
2026-01-16 16:51:47 +01:00
Campbell Barton
4dc9c2f35f Cleanup: spelling in comments & strings (make check_spelling_*)
Also wrap some overlong lines.
2026-01-14 16:48:01 +11:00
Campbell Barton
93037b0908 Docs: note that --python-expr supports full multi-line scripts 2026-01-14 16:18:26 +11:00
Campbell Barton
311c7fe9b6 Linux: replace JEMALLOC with TBB_MALLOC_PROXY
JEMALLOC is no longer maintained, use TBB_MALLOC_PROXY instead,
which was already done for WIN32.

Performance testing showed mixed results with neither allocator having a
clear advantage across systems. Variance depends on system-specific
factors (cache size, memory layout), and given JEMALLOC's uncertain
maintenance status - we deem this acceptable.

Co-authored-by: Bastien Montagne <bastien@blender.org>
Co-authored-by: Brecht Van Lommel <brecht@blender.org>

Ref !151524
2026-01-09 00:25:08 +00:00
Brecht Van Lommel
80cec8a08c Fix: Namespace issues in creator.cc after recent changes
Reorder code to avoid include headers inside the Blender namespace and fix
issues with the Python module.

Ref #152329

Pull Request: https://projects.blender.org/blender/blender/pulls/152499
2026-01-06 23:05:02 +01:00
Brecht Van Lommel
41a27b4eed Refactor: Move code in source/ into blender namespace
Previously only a subset of the code was in this namespace. This improves
consistency, and means common types like Vector, StringRef and float3
don't need blender:: prefixes anywhere.

This does not move code into sub-namespaces, but gets us a step closer to
the end goal.

* Add namespace blender {} to almost all files.
* Remove unnecessary blender:: prefixes and using namespace blender;.
* Freestyle was not not moved, it remains in top level namespace freestyle.
* Cycles integration code was modified to use blender:: prefixes.
* bUUID existed both in the top level and blender namespace. To resolve this
  conflict, the wrapper class is now blender::UUID.

Some blender:: prefixes remain primarily because of ambiguous namespaces, for
example animrig:: could refer to both blender::animrig and blender::ed::animrig.

Pull Request: https://projects.blender.org/blender/blender/pulls/152329
2026-01-06 20:00:02 +01:00
Brecht Van Lommel
5cc33f3407 Refactor: Convert many C style casts to C++ style and id_cast
For improved type safety and to follow code style guidelines, this is a
largely automated conversion of code in source/ and intern/cycles/blender.

* Use const_cast and static_cast where possible and reintepret_cast if not.
* For arithmetic and enumeration types, use functional notation.
* Prefer blender::id_cast where possible. This required some small code
  tweaks to avoid doing this cast before the ID type has been checked. There
  are probably a few more like this lurking that will trigger asserts but not
  affect release builds.
* Change Object.data to be ID* rather than void* to take more advantage of
  id_cast checks.

Not all casts where converted, only the ones that were easy to automate.
Various modules in intern/ would also benefit but are not handled as part of
this.

Pull Request: https://projects.blender.org/blender/blender/pulls/152327
2026-01-06 19:53:20 +01:00
Brecht Van Lommel
bacab8511a Refactor: Convert LISTBASE_FOREACH to range based for loops
This step was automated using an LLM generated C++ program using the
Clang libarries to perform this refactoring. In particular, conversion of
pointers to references was done automatically.

Then some manual fixups were done on top of that:
* Adjustments for const of elements
* Fixes for macros that were not automatically updated
* Avoid assignment of item pointer inside loop
* Remove unused loop index variables
* Remove unnecessary loops
* Restructure code to be able to use ListBaseT

Pull Request: https://projects.blender.org/blender/blender/pulls/152054
2026-01-02 18:41:01 +01:00
Campbell Barton
3e60962f8a Cleanup: sort CMake file lists, strip trailing space 2025-12-04 14:40:05 +11:00
Clément Foucault
fd03c95a23 GPU: Centralize and add support for wildcard in shader source debugging
This moves the shader source output to disk implementation
to the top GPU layer.

This also adds the option to add wildcards inside the input
string to match many shaders.

This is useful to have metrics about shader size overtime.

Pull Request: https://projects.blender.org/blender/blender/pulls/150064
2025-11-17 17:42:25 +01:00
Ray Molenkamp
f32e3208e2 CMake: Win: Support stripped pdbs for clang-cl
clang-cl doens't currently support the /PDBSTRIPPED argument
and will silently produce a full pdb only. This change implements
an alternative codepath that uses pdbcopy to generate the stripped
pdb.

Pull Request: https://projects.blender.org/blender/blender/pulls/149357
2025-11-13 20:58:08 +01:00
Guillermo Venegas
deae3086d0 Refactor: Move ShaderFX header files to C++
Required for #149789

Pull Request: https://projects.blender.org/blender/blender/pulls/149793
2025-11-13 15:17:54 +01:00
Aras Pranckevicius
71b1c50562 Cleanup: remove long-unused Sound code, rename .h -> .hh
- Rename BKE_sound.h/BKE_speaker.h -> .hh
- Remove sound code that has been disabled for 16 years. There has
  been disabled code with comment "unused currently" that landed
  in "2.5 sound branch merge" on 2009 (6c5c58e05), and has been
  disabled ever since.

Pull Request: https://projects.blender.org/blender/blender/pulls/149265
2025-11-03 14:42:53 +01:00
Clément Foucault
67a03ea03e Metal: Rewrite shader interface and source generator
This is a full rewrite which reduces the code
complexity and remove a lot of deprecated code paths.

All arguments to the shader MSL wrapper class are now passed
by reference. This avoid having to use accessor defines for
every resources.

The binding slot assignments is also revisited and made much
more straight-forward. See `mtl_shader_generate.hh` for details.

More detail in the pull request.

Pull Request: https://projects.blender.org/blender/blender/pulls/147010
2025-10-29 16:02:37 +01:00
Brecht Van Lommel
fac3326514 Merge branch 'blender-v5.0-release' 2025-10-24 19:13:37 +02:00
Brecht Van Lommel
321e737891 Linux: Preload system TBB if it is compatible and newer
This avoids issues where the Intel GPU ray tracing driver may depend
on the newer system TBB version. In particular, on Ubuntu the TBB
library is no longer statically linked into the driver as it was before.

We think this really should be fixed upstream in distributions, and
that graphics drivers should not pull in TBB as a dynamic library. As
other VFX software will run into the same issue, and this breaks an
implicit convention that graphics drivers avoid such ABI conflicts.
But policies around static and dynamic linking make this difficult.

This fix only affects the Blender Snap package and the blender-launcher
script used for Steam, to reduce the risk for Blender 5.0. For later
versions we may change the Blender executable itself into a shell script,
or use an alternative fix that makes Blender into a shared library.

Ref #140631

Pull Request: https://projects.blender.org/blender/blender/pulls/148154
2025-10-24 19:07:48 +02:00
Brecht Van Lommel
2056cd5201 Merge branch 'blender-v5.0-release' 2025-10-22 18:24:32 +02:00
Brecht Van Lommel
bdf096e583 Fix #148432: blender -E help crashes
This case is a bit unusual as it runs after WM has been initialized but
can still only print and exit.

Pull Request: https://projects.blender.org/blender/blender/pulls/148459
2025-10-22 18:20:26 +02:00
Campbell Barton
5cda4b188c Docs: add missing newline to debug_gpu_shader_source doc-string
Also use term "directory" (as used elsewhere) & minor tweak to warning.
2025-10-14 11:27:01 +11:00
Campbell Barton
eedf15e3b7 X11: add support for --no-window-frame 2025-10-14 11:07:50 +11:00
Clément Foucault
139fa532c1 GPU: Add command line option to output shader source
This command line outputs only shaders whose name
matches the argument string.

Metal is missing as it waits until #147010 lands.

Pull Request: https://projects.blender.org/blender/blender/pulls/147970
2025-10-13 14:37:54 +02:00
Campbell Barton
3349b97987 Core: add --no-window-frame command line option
Add a command line option to load Blender without a window frame.

Currently this is only used on Wayland, enabled for WITH_UI_TESTS since
attempting to load LIBDECOR caused the tests to crash on start on Fedora.
For tests there is no need to use LIBDECOR, so disable the window frame.
This can also be used by users who don't want to use the X11 fallback if
LIBDECOR can't be found.

Ref !147716
2025-10-13 09:47:07 +00:00
Campbell Barton
c4b2c1c19e Cleanup: spelling (check_spelling_*), trailing spaces in comments 2025-10-12 12:12:46 +11:00
Campbell Barton
74bd04e09b Docs: clarify the purpose of the --window-border argument
This read as if it enabled window decorations.

Clarify & update the doc-strings of windowing arguments to be consistent.

Also order their inclusion in --help more logically.
2025-10-10 05:00:26 +00:00
Jesse Yurkovich
8a99ab4463 Fix #145919: Enable BKE_reports to be seen when file is loaded from CLI
There were two issues conspiring to prevent most BKE_reports from
surfacing when loading a file from the command line.

The first is that the "print_level" was left initialized to only
RPT_ERROR which prevents this particular warning from being traced to
the console.

The second is that, in order for us to display reports in the
notification area, we need to give the reports to the window manager.
This is typically all wired up during normal operator execution, but not
when just starting up from the command line.

Pull Request: https://projects.blender.org/blender/blender/pulls/147251
2025-10-07 20:37:15 +02:00
Campbell Barton
3de925589f Cleanup: strip trailing space 2025-10-07 10:19:46 +11:00
Hans Goudey
a68d39e9d9 Cleanup: Formatting
Run `make format` after the library update in the previous commit.
2025-10-02 12:55:42 -04:00
Thomas Dinges
66224d69b0 Deps: Library changes for Blender 5.0
This commit includes the changes to the build system, updated hashes to the actual new libraries as well as a required test update.

* DPC++ 6.2.0 RC
* freetype 2.13.3
* HIP 6.4.5010
* IGC 2.16.0
* ISPC 1.28.0
* libharu  2.4.5
* libpng 1.6.50
* libvpx 1.15.2
* libxml2 2.14.5
* LLVM 20.1.8
* Manifold 3.2.1
* MaterialX 1.39.3
* OpenColorIO 2.4.2
* openexr 3.3.5
* OpenImageIO 3.0.9.1
* openjpeg 2.5.3
* OpenShadingLanguage 1.14.7.0
* openssl 3.5.2
* Python 3.11.13
* Rubber Band 4.0.0
* ShaderC 2025.3
* sqlite 3.50.4
* USD 25.08
* Wayland 1.24.0

Ref #138940

Co-authored-by: Ray Molenkamp <github@lazydodo.com>
Co-authored-by: Jesse Yurkovich <jesse.y@gmail.com>
Co-authored-by: Brecht Van Lommel <brecht@blender.org>
Co-authored-by: Nikita Sirgienko <nikita.sirgienko@intel.com>
Co-authored-by: Sybren A. Stüvel <sybren@blender.org>
Co-authored-by: Kace <lakacey03@gmail.com>
Co-authored-by: Sebastian Parborg <sebastian@blender.org>
Co-authored-by: Anthony Roberts <anthony.roberts@linaro.org>
Co-authored-by: Jonas Holzman <jonas@holzman.fr>

Pull Request: https://projects.blender.org/blender/blender/pulls/144479
2025-10-02 18:34:11 +02:00
Brecht Van Lommel
ea43fa08e1 Cleanup: Improve formating of OCIO environment variable in the manual 2025-09-26 18:06:26 +02:00
Brecht Van Lommel
24ef6a3776 Cleanup: Improve formatting of command line argument in the user manual 2025-09-26 17:52:53 +02:00
Nick Alberelli
f7e7a5d09e Logging: Add argument to list all available categories
New `--log-list-categories` command line argument to list all available
logging categories. This improves documentation of logging, allowing
users to understand what logging categories are available for use. It is
also useful for developers to understand what logging categories already
exist before making a change.

Implemented using static initializers to register all logrefs on startup.

Ref  #141754

Pull Request: https://projects.blender.org/blender/blender/pulls/146456
2025-09-26 17:33:26 +02:00
Jonas Holzman
c08d42aebf macOS: Support Xcode Archiving for distributing application bundles
This is a port of iOS commit f3f8647 to main, for Xcode archiving to
also work for macOS bundles, allowing the bundle to be archived and
later distributed via Testflight, App Store Connect, etc...

Additonal Xcode property also had to be added to the extern draco shared
library target to prevent it from being included in the Xcode archive
(an implicit behavior for `SHARED` CMake libraries), without this,
the archive would get polluted, preventing it from being properly
recognized as a proper app bundle archive.

Pull Request: https://projects.blender.org/blender/blender/pulls/146027
2025-09-23 20:56:18 +02:00
Clément Foucault
680fec144c Cleanup: GPU: Remove prefix 'e' from enum types
_No response_

Pull Request: https://projects.blender.org/blender/blender/pulls/146034
2025-09-15 15:11:02 +02:00
Brecht Van Lommel
9a5ac6d5ec Color Management: Add BLENDER_OCIO environment variable
THis works the same as OCIO, but is Blender specific in case you want to
use a different one than other applications.

Pull Request: https://projects.blender.org/blender/blender/pulls/145882
2025-09-07 21:30:54 +02:00
Falk David
866fcd0a09 VSE: Update Strip Modifier UI
This PR updates the VSE strip modifiers interface.
It now uses the same design as the object modifiers.

Changes:

* Except for the "Mask Input" subpanel, the modifier UIs are unchanged.
* Modifiers can now be rearranged using drag & drop.
* Additionally, there is now an active strip modifier. This is exposed
   though python via `strip.modifiers.active`.

This is in part for !139634 which needs the concept of an active modifier.

Notes:

* The `modifier.cc` file included all the implementation of all modifiers.
   With the addition of a another new callback in this PR, this file was
   getting quite big so I split everything out into individual files for all
  modifiers. The modifiers are getting registered at launch.
* The modifier panels are getting added using a UI template
  (`template_strip_modifiers`) very similar to the object modifiers.

Pull Request: https://projects.blender.org/blender/blender/pulls/145367
2025-09-04 15:01:57 +02:00
Campbell Barton
8def618fd9 Cleanup: quiet unused argument warnings on macOS 2025-09-04 16:49:54 +10:00