Commit Graph

1604 Commits

Author SHA1 Message Date
Campbell Barton 1e4bab4eb5 CMake: always mark CMAKE_BUILD_TYPE_INIT as advanced
When defined this wasn't marked as advanced.
2024-01-23 20:40:00 +11:00
Thomas Dinges 64fc6d7890 Docs: Replace most wiki links with links to new developer docs
Exceptions:
* Links to personal wiki pages
* Pages that are not in the new developer docs yet (like Human Interface Guidelines)
* tools\check_wiki\check_wiki_file_structure.py needs a refactor
2024-01-18 16:49:38 +01:00
Campbell Barton 5afd33d129 PyAPI: drop support for Python 3.10
All platforms have been updated to support 3.11
so supporting 3.10 is no longer needed.
2024-01-09 22:23:41 +11:00
Bastien Montagne fd0ca109b1 Build: Ninja: Enable pooljobs by default.
Using pooljobs with default settings should never have any significant impact
on the build speed, and it makes building full debug with sanitizer builds
safe on (almost) all machines.

Quick test showed no significant difference in Release build time with or
without Ninja pooljobs (on linux, with a 16 cores, 64GBb machine).
2024-01-05 17:09:56 +01:00
Bastien Montagne 7de49d5f80 Build: Ninja: Use similar logic for default heavy and regular jobs amount.
Update the regular jobs amount computation to follow the same logic as
for the heavy ones. the main difference is that it uses a '2Gb of RAM
per job' base value.

This change is mainly targetted at machines with a relatively low
RAM/cores ratio, since even regular compile jobs can end up using quite
a lot of RAM if many are running in parallel, previous defaults would
likely not work well on machines with e.g. 16Gb of RAM and 16 cores.

Also fix a typo in previous commit (6493d0233c), sorry about that.
2024-01-05 12:51:47 +01:00
Bastien Montagne 6493d0233c Build: Ninja: tweak pooljobs default settings.
This commit simplifies and makes more generic the computation of the
maximum number of parallel heavy build jobs. Essentially, it allows 1
heavy job per 8Gb of RAM.

It also systematically sets the amount of heavy jobs, since we are going
to get more of these in the future (like the 'unity build' units), the
previous heuristic had some loose ends (e,g for a 40Gb RAM, 16 threads
machine, it would not set any limit to heavy jobs, yet said machine
would likely not be able to run 16 3.5+Gb heavy jobs in parallel...).

This is some initial step towards a better handling of 'sanitizer' builds
on the Blender buildbot.
2024-01-05 12:22:00 +01:00
Brecht Van Lommel 364beee159 Tests: add option to build one binary per GTest file
Bundling many tests in a single binary reduces build time and disk space
usage, but is less convenient for running individual tests command line
as filter flags need to be used.

This adds WITH_TESTS_SINGLE_BINARY to generate one executable file per
source file. Note that enabling this option requires a significant amount
of disk space.

Due to refactoring, the resulting ctest names are a bit different than
before. The number of tests is also a bit different depending if this
option is used, as one uses gtests discovery and the other is organized
purely by filename, which isn't always 1:1.

Co-authored-by: Sergey Sharybin <sergey@blender.org>
Pull Request: https://projects.blender.org/blender/blender/pulls/114604
2024-01-03 18:35:50 +01:00
Sergey Sharybin f0d6346c9a Fix compilation error with WITH_COMPILER_ASAN=ON on macOS
This change solves the following linker error:

  ld: warning: __eh_frame section too large (max 16MB) to encode dwarf unwind offsets in compact unwind table

Proposed solution is to disable unwind table when building Blender with
address sanitizer enabled.

It is stated in the comment in the code, but to make it explicit there
could some side-effects of code which relies on frame walking:

- backtrace()
- __attribute__((__cleanup__(f)))
- __builtin_return_address(n), for n > 0
- pthread_cleanup_push when it is implemented using
  __attribute__((__cleanup__(f)))

From the local tests it seems that backtrace() provides the same
output as prior to this change (but with classic linker used, as prior
to this change it is not possible to link Blender).

The rest of the possibly functionality is not used by Blender, but
it is a bit hard to tell if it is used by any of the dependent
libraries. However, if the libraries are compiled dynamically, there
will be no affect on them with this change.

I am unable to run the full test suit as some of the tests are
failing prior to this change with classic linker. Overall it seems
to be no unwanted side effects on Blender development.

Note that the change only affects debug builds with ASAN enabled,
so it is a low risk of causing some real problem so might as well
just give it a whirl and see if some unpredicted issue arises.

Pull Request: https://projects.blender.org/blender/blender/pulls/116745
2024-01-03 16:39:05 +01:00
Brecht Van Lommel f63accd3b6 Cleanup: move CMake test utility functions into testing.cmake
Combining functions from macros.cmake and Modules/GTestTesting.cmake.
It was unusual to have Blender specific code in the Modules folder.

Pull Request: https://projects.blender.org/blender/blender/pulls/116719
2024-01-03 14:49:11 +01:00
Brecht Van Lommel 4ce14a639f Revert "Cleanup: move CMake test utility functions into testing.cmake"
This breaks execution of some Windows tests.

This reverts commit 4190a61020.
2024-01-02 19:06:39 +01:00
Brecht Van Lommel 4190a61020 Cleanup: move CMake test utility functions into testing.cmake
Combining functions from macros.cmake and Modules/GTestTesting.cmake.
It was unusual to have Blender specific code in the Modules folder.
2024-01-02 15:34:52 +01:00
Jeroen Bakker c11004579e GPU: Remove the Word OpenGL from Build Scripts
The build scripts are still referring to gpu tests as being opengl.
Although they can also use Metal or Vulkan. This PR only replaces
the work `opengl` with `gpu` for build options.

Special note is that the windows argument `with_opengl_tests` is
also replaced with `with_gpu_tests` for consistency.

Pull Request: https://projects.blender.org/blender/blender/pulls/116030
2023-12-12 16:02:29 +01:00
Campbell Barton 55c5692364 Cleanup: remove unused variable, invalid comment & typo 2023-12-08 23:03:22 +11:00
Campbell Barton 4fd8f6c575 Build: enable mismatched-tags warning for CLANG
Disabled for GCC as this causes a crash which isn't practical to
workaround, details in code-comments.
2023-12-08 16:22:18 +11:00
Ray Molenkamp 44ac2e8a8d CMake: Allow asserts to be enabled for release builds.
Asserts historically only have been on in debug builds, however
running the tests in a debug configuration takes a while especially
if Cycles is enabled.

This adds WITH_ASSERT_RELEASE to enable asserts in release
configurations. It is enabled for "make developer" , and will also
be used for CI.

Co-authored-by: Brecht Van Lommel <brecht@blender.org>
Pull Request: https://projects.blender.org/blender/blender/pulls/115071
2023-12-06 23:49:42 +01:00
Brecht Van Lommel e06561a27a Build: replace Blender specific DEBUG by standard NDEBUG
NDEBUG is part of the C standard and disables asserts. Only this will
now be used to decide if asserts are enabled.

DEBUG was a Blender specific define, that has now been removed.

_DEBUG is a Visual Studio define for builds in Debug configuration.
Blender defines this for all platforms. This is still used in a few
places in the draw code, and in external libraries Bullet and Mantaflow.

Pull Request: https://projects.blender.org/blender/blender/pulls/115774
2023-12-06 16:05:14 +01:00
Harley Acheson 6ae5e1ade8 Core: Allow Optional Use of Harfbuzz and FriBiDi
Harfbuzz and FriBiDi are included in our external libraries for all
platforms. This PR adds the glue to make them available as optional
build components (off by default).

Pull Request: https://projects.blender.org/blender/blender/pulls/114947
2023-11-23 23:35:03 +01:00
Brecht Van Lommel dccbc27eab Tests: add WIITH_TESTS_BATCHED option to execute Blender once per test
Some tests like cycles, sequencer and compositor batch together multiple
tests in a single Blender invocation. This makes them run faster, but
makes debugging harder. This is an option to disable that batching.

Pull Request: https://projects.blender.org/blender/blender/pulls/114603
2023-11-08 18:41:33 +01:00
Campbell Barton 126f3bcfc1 Tests: support running graphical tests as part of CTests
User a Blender wrapper `tests/utils/blender_headless.py` to runs a
graphical instance of Blender within a headless weston compositor.

Currently only WAYLAND is supported as a back-end, support for other
platforms is possible. The tests can run from X11 since the tests don't
depend on existing instances of X11 or WAYLAND.

- Each test runs a separate headless instance of WESTON
  since the overhead is minimal, this allows tests to run in parallel
  without interfering with each other.

- There is a CMake option WESTON_BIN, when left empty the weston
  from LIBDIR is used. Otherwise this can point to the weston binary
  installed on the users system.

- In most cases simulated events are needed to implement these tests
  (running blender with `--enable-event-simulate`).

- This commit adds 14 undo tests - simulating user interaction as well
  as undo/redo actions, ensuring the desired result is reached.
  Other kinds of UI tests could be added in the future.

Ref !114164
2023-11-07 12:40:12 +11:00
Campbell Barton efef0bac5f CMake: remove redundant white-space as part of multi-line strings 2023-11-04 16:41:19 +11:00
Brecht Van Lommel 682bdf3110 Merge branch 'blender-v4.0-release' into main 2023-11-01 18:41:16 +01:00
Brecht Van Lommel 39f7411065 Fix "make bpy" on macOS not install libraries inside bpy module
Default to WITH_PORTABLE_INSTALL behavior for this case, same as on
Windows and Linux.
2023-11-01 18:39:06 +01:00
Campbell Barton 0e8e8fa462 CMake: mark WITH_COMPILER_ASAN_EXTERN as advanced, quiet warning 2023-10-31 10:42:06 +11:00
Brecht Van Lommel 39107b3133 Revert changes from main commits that were merged into blender-v4.0-release
The last good commit was 8474716abb.

After this commits from main were pushed to blender-v4.0-release. These are
being reverted.

Commits a4880576dc from to b26f176d1a that happend afterwards were meant for
4.0, and their contents is preserved.
2023-10-30 21:40:35 +01:00
bsavery d19ad12b45 Cycles: add support for AMD RDNA3 APUs
Pull Request: https://projects.blender.org/blender/blender/pulls/113696
2023-10-19 18:03:31 +02:00
Bastien Montagne ab91c18995 Fix linking errors when doing full debug build with ASAN: Disable ASAN for `extern`.
With current main code, trying to build a full debug build with ASAN
enabled will fail at linking, due to out-of-bound memory references
within the binary file, e.g.:

```
  mold: error: /usr/lib/gcc/x86_64-linux-gnu/13/crtbegin.o:(.text):
        relocation R_X86_64_32S against .tm_clone_table out of range:
        2147741344 is not in [-2147483648, 2147483648)
```

This commit works around the issue by disabling ASAN by default for the
`extern` dependencies. A new `WITH_COMPILER_ASAN_EXTERN` CMake
option is added to enable it if needed - some other components need to be
disabled then.

NOTE: This is more of an emergency band-aid to the general binary size issue,
see #113892 for on-going discussions about better solutions in the long term.

Pull Request: https://projects.blender.org/blender/blender/pulls/113891
2023-10-19 11:07:06 +02:00
Campbell Barton a38a49b073 GHOST/Wayland: IME support using the text-input protocol
Tested with IBUS on GNOME 45.
Added a capabilities flag to GHOST since support for IME works on
Wayland but not on X11, so runtime detection is needed.
2023-10-19 17:29:32 +11:00
Campbell Barton 3e26a1a39c Cleanup: set WITH_INPUT_IME=OFF when unsupported
This avoids having to do platform checks before checking WITH_INPUT_IME.
2023-10-18 22:04:25 +11:00
Xavier Hallade 3faa5db2e9 Cycles: oneAPI: generate binaries for Meteor Lake iGPUs 2023-10-11 18:29:21 +02:00
Xavier Hallade 591951b2f6 Revert "Cycles: oneAPI: generate binaries for Meteor Lake iGPUs"
This reverts commit 82d86cbd8c.
As it's currently failing on linux buildbot.
2023-10-11 15:18:47 +02:00
Xavier Hallade 82d86cbd8c Cycles: oneAPI: generate binaries for Meteor Lake iGPUs
This is already supported by current igc dependency (1.0.13064.7) on
Linux.
Windows needs a newer version of ocloc to make this change effective.

Pull Request: https://projects.blender.org/blender/blender/pulls/112669
2023-10-11 14:59:39 +02:00
Xavier Hallade c4b49aa391 Cycles: oneAPI: rename target intel arch cmake setting
CYCLES_ONEAPI_SPIR64_GEN_DEVICES -> CYCLES_ONEAPI_INTEL_BINARIES_ARCH
so it's more aligned with the name for the other backends, such as
CYCLES_CUDA_BINARIES_ARCH.
2023-10-11 14:59:26 +02:00
Campbell Barton 0c91466785 GHOST/Wayland: remove WITH_GHOST_WAYLAND_DBUS
This was only used for accessing cursor themes which only worked
with gnome and wasn't used in official releases.
Use the default theme or the theme defined by XCURSOR_THEME.

Eventually wp_cursor_shape_manager_v1 can be supported which avoids
having to access the theme.
2023-10-07 21:31:15 +11:00
Campbell Barton f482e5979d CMake: set_and_warn_incompatible now warns if arguments are undefined
Previously this caused an error which can happen on other platforms that
don't define the features being checked.
2023-10-07 21:22:13 +11:00
Campbell Barton 1dafc2786f CMake: fix building on macOS 2023-10-07 20:21:52 +11:00
Campbell Barton 149d80946e Cleanup: CMake formatting 2023-10-07 19:46:38 +11:00
Campbell Barton d2d654407f CMake: use set_and_warn_incompatible macro 2023-10-07 19:28:36 +11:00
Campbell Barton 1054b9721e CMake: allow WITH_GHOST_SDL with X11/WAYLAND backends
Multiple backends at once are now supported.
2023-10-07 19:21:31 +11:00
Campbell Barton 833eddafa3 CMake: add set_and_warn_incompatible macro, use for HEADLESS & GHOST_SDL
When WITH_GHOST_SDL or WITH_HEADLESS were used, the message didn't make
much sense, especially since the features warned about weren't
necessarily enabled or even supported by the platform.

Replace with a `set_and_warn_incompatible` macro which only reports
configuration changes based on incompatible features.
2023-10-07 19:11:51 +11:00
Campbell Barton b434d40dbf CMake: quiet noisy messages on every run
Printing that a library is found every time CMake runs isn't helpful.
Restrict these messages for the first execution so messages are limited
to information developers may need to know such as features being
disabled because of incompatible configurations.
2023-10-07 18:20:30 +11:00
Jeroen Bakker 1aca58cf16 Vulkan: Enable as Experimental Option
This PR enables vulkan backend as experimental option.
It will only be available in alpha builds on Linux and Windows.

This option is highly experimental and enabled to get some insight
on supported platforms. Don't expect a fully working Blender
yet. Also don't expect it to have usable performance.

**What is known to not work?**

* OCIO textures are not supported on Intel and AMD GPUs. sRGB/Standard is supported
  on those platforms.
* AMD Polaris based GPUs on Linux will generate a crash when drawing the 3d cursor as it
  doesn't support the needed vertex format. Comment out `DRW_draw_cursor` in `DRW_draw_region_info`.
* The colors in the node editor and sequencer are of as sRGB viewports aren't detected correctly.
* The image / UV editor isn't working as many texture formats haven't been tested yet. Some
  tweaks are also needed to do correct depth testing.
* 3D Viewport is known to be flickering. Sometimes workbench doesn't display anything.
* 3D Viewport wireframe will crash as it uses a framebuffer with gaps between color attachments,
  which isn't supported yet. (#113141)
* Rotate the view widget is partially drawn due to incompatible depth clipping.
* GPU Selection isn't working. It is expected to be solved when Overlay-Next will become the
  default engine. For now disable GPU depth picking in the preferences.
* Cycles/EEVEE are known to not work with Vulkan yet. Cycles requires Vulkan Pixel Buffer.
   Cuda <-> Vulkan interop might require a different approach than OpenGL as Vulkan doesn't allow
  importing memory from a Cuda context. EEVEE uses features that aren't available yet in the backend
* Workbench is working, except Workbench shadows.
* EEVEE-Next basics are working. Shadows, lights are known to be not working. Materials/Shading
  works in simple scenes. Changes are expected in EEVEE-Next that will break Vulkan compatibility
  in the near future.
* Systems with multiple GPUs is not expected to work.
* Wayland support is in development and requires some iterations. You can start Blender, but
  the protocols are not aligned yet.
* OpenXR hasn't been modified and is expected to fail.
* The backend is very strict when mis-using the GPU module. In debug builds it may crash
  on asserts.
* Older drivers/GPUs might not have all the features that we require. The workarounds
  for the missing features still need to be implemented.

**A word about performance**

In the project planning we focus first on stability and platform support. The performance of Vulkan is
around 20% of what we want to achieve. The reason is that each command sent to the
GPU is done one at a time. The implementation even waits until we have feedback that the GPU
is idle again.

Geometry is currently stored in System RAM. The GPU will read and cache the data when
accessing geometry. This slows down when using objects with much geometry.
Some performance features like MDI (Multi-Draw-Indirect) hasn't been implemented and
falls back to Single Draw Indirect.

**Why enable it is an experimental option?**

* Ensures that new features are being tested with Vulkan
* Ensure that building with Vulkan is possible on supported platforms
* Get feedback from developers if Vulkan can run on their system or that
  there are special cases that we are not aware of. Main development
  environment has been Linux/X11 with occasionally testing using Windows.
* Validate Add-ons that use the `gpu` module.
* Possible to enable GLSL validation on the buildbot. (Needs more work).
* Does it compile on all machines or does it require more changes to cmake
  config. We expect it to be able to compile without installing the Vulkan SDK.
  The Vulkan SDK is a very powerful tool, but only when actually doing GPU
  development. Otherwise it is an overhead which slows down other
  activities.

**How can the backend be enabled?**

Currently the Vulkan backend can be enabled per Blender session by starting
using the command line argument `--gpu-backend vulkan`. In the future, when
the backend is more mature, we will add a user preference to switch between
OpenGL and Vulkan.

Pull Request: https://projects.blender.org/blender/blender/pulls/113057
2023-10-06 15:24:21 +02:00
Sergey Sharybin 2be3e7c16a Cleanup: Suppress strict compiler warning for external code
The new Clang which came with XCode 15 introduced the new
warning: -Wsingle-bit-bitfield-constant-conversion. It is a bit
too noisy in the Bullet code.

Since the warning is in the code which we do not maintain suppress
it similar to other similar warnings.

Pull Request: https://projects.blender.org/blender/blender/pulls/113136
2023-10-02 10:01:10 +02:00
Sergey Sharybin cf8ea05e71 CMake: Rename compositor tests option to WITH_COMPOSITOR_REALTIME_TESTS
It follows the naming convention of other unit-test variables.

Pull Request: https://projects.blender.org/blender/blender/pulls/111437
2023-08-23 16:03:12 +02:00
Habib Gahbiche 9d08be1eec Realtime Compositor: add regression tests
Tests must be enabled manually using the CMake flag `WITH_COMPOSITOR_REALTIME_TEST`. Reasons are F12 for realtime compositor is experimental and buildbots have no GPU. Failing tests are excluded.

Pull Request: https://projects.blender.org/blender/blender/pulls/109878
2023-08-19 15:00:54 +02:00
Ray Molenkamp 0df3aedfa8 CMake/MSVC: Only generate/install stripped PDB for release builds
This renames the WITH_WINDOWS_PDB and WITH_WINDOWS_STRIPPED_PDB cmake
options to WITH_WINDOWS_RELEASE_PDB WITH_WINDOWS_RELEASE_STRIPPED_PDB

The Stripped PDB isn't cost free to generate, and is only needed for
builds that are distributed to end users. There is no benefit in making
one for a debug build as the debugger locally will prefer to use the
bigger un-stripped PDB anyhow.

This also stops the copy/install of the PDB for anything but a release
build, this file is about 1.6G for a debug build, and there is really
no need to do this for local development, as the debugger will find/use
the PDB from its original location.

This brings down the time needed for an incremental link on a debug
build by about 30% (10->7 seconds on my local system)
2023-08-18 10:20:36 -06:00
Brecht Van Lommel a5789eba98 Build: fix Xcode warnings related to integer conversion
Xcode enables additional warning flags by default. Disable some to match
command line build and other platforms more closely.

Ref #111193
2023-08-17 16:23:28 +02:00
Campbell Barton b6c014c731 CMake: enable comma-subscript GCC warning 2023-08-17 23:17:30 +10:00
Campbell Barton c713c70781 CMake: quiet uninitialized warnings 2023-08-17 11:53:56 +10:00
bsavery c6f5915bc8 Cycles: enable HIP for integrated graphics of Ryzen 7000 CPUs
Specifically the gfx1036 architecture, for AMD Zen4 APUs.

Pull Request: https://projects.blender.org/blender/blender/pulls/110907
2023-08-16 14:35:09 +02:00
Campbell Barton e955c94ed3 License Headers: Set copyright to "Blender Authors", add AUTHORS
Listing the "Blender Foundation" as copyright holder implied the Blender
Foundation holds copyright to files which may include work from many
developers.

While keeping copyright on headers makes sense for isolated libraries,
Blender's own code may be refactored or moved between files in a way
that makes the per file copyright holders less meaningful.

Copyright references to the "Blender Foundation" have been replaced with
"Blender Authors", with the exception of `./extern/` since these this
contains libraries which are more isolated, any changed to license
headers there can be handled on a case-by-case basis.

Some directories in `./intern/` have also been excluded:

- `./intern/cycles/` it's own `AUTHORS` file is planned.
- `./intern/opensubdiv/`.

An "AUTHORS" file has been added, using the chromium projects authors
file as a template.

Design task: #110784

Ref !110783.
2023-08-16 00:20:26 +10:00