Commit Graph

1619 Commits

Author SHA1 Message Date
Campbell Barton 18c045a35f Build: show X11 & Wayland options on first run 2022-10-08 13:16:11 +11:00
Brecht Van Lommel 6167a065a5 Build: also list Cycles build options on first cmake config 2022-10-04 20:13:58 +02:00
Campbell Barton 0c282c068f Cleanup: cmake indentation 2022-09-29 13:32:16 +10:00
Ray Molenkamp 1f493125e3 MSVC: promote C4033 to an error
C4033 'function' must return a value

is a MSVC level-1 warning, clang and GCC
treat this as an error however, this
change promotes it to an error as well
for MSVC to mimic the GCC behaviour.
2022-09-28 08:32:56 -06:00
Sebastian Herhoz 75a6d3abf7 Cycles: add Path Guiding on CPU through Intel OpenPGL
This adds path guiding features into Cycles by integrating Intel's Open Path
Guiding Library. It can be enabled in the Sampling > Path Guiding panel in the
render properties.

This feature helps reduce noise in scenes where finding a path to light is
difficult for regular path tracing.

The current implementation supports guiding directional sampling decisions on
surfaces, when the material contains a least one diffuse component, and in
volumes with isotropic and anisotropic Henyey-Greenstein phase functions.

On surfaces, the guided sampling decision is proportional to the product of
the incident radiance and the normal-oriented cosine lobe and in volumes it
is proportional to the product of the incident radiance and the phase function.

The incident radiance field of a scene is learned and updated during rendering
after each per-frame rendering iteration/progression.

At the moment, path guiding is only supported by the CPU backend. Support for
GPU backends will be added in future versions of OpenPGL.

Ref T92571

Differential Revision: https://developer.blender.org/D15286
2022-09-27 15:56:32 +02:00
Campbell Barton bcb7b119ae Cleanup: remove workarounds and version checks for unsupported compilers
Match minimum supported versions from the WIKI [0] by raising them to:

- GCC 9.3.1
- CLANG 8.0
- MVCS 2019 (16.9.16 / 1928)

Details:

- Add CMake checks that ensure supported compiler versions early on.
- Previously GCC per-processor version checks served to exclude
  `__clang__`, in some cases this has been replaced by explicitly
  excluding `__clang__`. This was needed as CLANG treated some of these
  flags differently to GCC, causing the build to fail.
- Remove USE_APPLE_OMP_FIX GCC-4.2 OpenMP workaround.
- Remove linking error workaround for old MSVC versions.

[0]: https://wiki.blender.org/wiki/Building_Blender

Reviewed by: brecht, LazyDodo

Ref D16068
2022-09-27 07:05:13 +10:00
Campbell Barton 998ace3463 Cleanup: use lowercase function calls & macros in for CMake
This is already the case for most CMake usage.
Although some find modules are an exception to this, as they were
originally maintained externally they use some different conventions.

Also corrected bad indentation in: intern/cycles/CMakeLists.txt
2022-09-23 14:33:44 +10:00
Brecht Van Lommel 0ffd288fab Build: fix gtest build flags affecting actual library
Switch to target_ functions to avoid this.
2022-09-18 11:26:34 +02:00
Brecht Van Lommel 6bf5cc62e0 Build: limit Py_ENABLE_SHARED to modules using Python headers
And remove Python flags from nodes, no longer needed.
2022-09-18 11:26:33 +02:00
Brecht Van Lommel 892a5f8176 Build: disable gtests entirely for Python module
To avoid test failure on Windows.
2022-09-18 11:26:23 +02:00
Campbell Barton 5ffa829a0e Cleanup: improve titles for CMake sections, line length
Also use same convention for comments as (space after #).
2022-09-13 13:50:21 +10:00
Brecht Van Lommel 2c23b4e0bf Python: on macOS, stop requiring framework for building bpy module
Build against Python from precompiled libraries by default, instead of
requiring framework from python.org package install. The resulting bpy module
can still be used with any Python install of the same version.

Use the same CMake find module as Linux. This simplifies code, and makes it
possible to manually set PYTHON_* variables in CMake configuration.

Remove WITH_PYTHON_FRAMEWORK option for regular Blender build, as this doesn't
work well due to missing required Python packages. Advanced users can still
set PYTHON_ROOT_DIR=/Library/Frameworks/Python.framework/Versions/3.10 for
the same result.
2022-09-10 13:47:48 +02:00
Campbell Barton 3a01c23a84 Cleanup: cmake line length, wrapping 2022-09-09 11:52:14 +10:00
Brecht Van Lommel 74caf77361 Cycles: add option to specify OptiX runtime root directory
This allows individual users or Linux distributions to specify a directory
Cycles will automatically look for the OptiX include folder, to compile kernels
at runtime.

It is still possible to override this with the OPTIX_ROOT_DIR environment
variable at runtime.

Based on patch by Sebastian Parborg.

Ref D15792
2022-08-29 19:50:20 +02:00
Brecht Van Lommel a87d3edb98 Build: add system for shipping with dynamic libraries on Linux and macOS
PLATFORM_BUNDLED_LIBRARIES gathers shared libraries that will be installed
to the lib/ folder. The Blender executable gets a relative rpath pointing to
this folder as part of the install step.

The build rpath is different and uses absolute paths, so that it works for
executables like tests that are in different locations, and to support the
case where the build and install folders are different.

The system is already used for the OpenMP library on macOS. But on Linux it
will only kick in once we start using shared libraries for dependencies.

This also removes Mesa libraries from the old location, as these would cause
Blender to start with software OpenGL.

Ref T99618
2022-08-23 15:27:16 +02:00
listout f197b1a1f1 CMake: support building with musl libc
Instead of using macros like GLIBC we can use the CMake build
systems internal functions to check if some header or functions are
present on the running system's libc.

Add ./build_files/cmake/have_features.cmake to add checks for
platform features which can be used to set defines for source
files that require them.

Reviewed By: campbellbarton

Ref D15696
2022-08-18 08:12:56 +10:00
Sebastian Parborg 3195a38120 Introduce headless OpenGL rendering on Linux
With this patch true headless OpenGL rendering is now possible on Linux.
It changes the logic of the WITH_HEADLESS build flag.

The headless backend is now always available with regular builds and
Blender will try to fall back to it if it fails to initialize other
backends while in background mode.

The headless backend only works on Linux as EGL is not used on Mac or Windows.
libepoxy does support windows and mac, so this can perhaps be remedied in the future.

Reviewed By: Brecht, Jeroen, Campbell

Differential Revision: http://developer.blender.org/D15555
2022-08-15 16:54:29 +02:00
Sebastian Parborg 8ffc11dbcb Cleanup OpenGL linking and related code after libepoxy merge
This cleans up the OpenGL build flags and linking.
It additionally also removes some dead code.

One of these dead code paths is WITH_X11_ALPHA which actually never was
active even with the build flag on. The call to use this was never
called because the default initializer for GHOST was set to have it off
per default. Nothing called this function with a boolean value to enable it.

These cleanups are needed to support true headless OpenGL rendering.
Without these cleanups libepoxy will fail to load the correct OpenGL
Libraries as we have already linked them to the blender binary.

Reviewed By: Brecht, Campbell, Jeroen

Differential Revision: http://developer.blender.org/D15554
2022-08-15 16:47:20 +02:00
Christian Rauch a296b8f694 GPU: replace GLEW with libepoxy
With libepoxy we can choose between EGL and GLX at runtime, as well as
dynamically open EGL and GLX libraries without linking to them.

This will make it possible to build with Wayland, EGL, GLVND support while
still running on systems that only have X11, GLX and libGL. It also paves
the way for headless rendering through EGL.

libepoxy is a new library dependency, and is included in the precompiled
libraries. GLEW is no longer a dependency, and WITH_SYSTEM_GLEW was removed.

Includes contributions by Brecht Van Lommel, Ray Molenkamp, Campbell Barton
and Sergey Sharybin.

Ref T76428

Differential Revision: https://developer.blender.org/D15291
2022-08-15 16:10:29 +02:00
Omar Emara 9990792e87 Compositor: Rename compositor build option
Currently, the compositor can be disabled using the WITH_COMPOSITOR
build option. Since, we intent to always build the realtime compositor,
we need to make the distinction between both compositors clear.

So this patch renames the option to WITH_COMPOSITOR_CPU. Additionally,
the check for the option was moved inside the compositor modules' own
CMake file in preparation for the realtime compositor code.

Differential Revision: https://developer.blender.org/D15622

Reviewed By: Jeroen Bakker, Ray Molenkamp
2022-08-09 15:59:56 +02:00
Campbell Barton dfbba7c0eb Cleanup: CMake file indentation 2022-08-09 13:37:29 +10:00
Brecht Van Lommel cc12f3e0ba Cleanup: fix various typos
Contributed by luzpaz.

Differential Revision: https://developer.blender.org/D15588
2022-08-03 19:28:05 +02:00
Campbell Barton 00dc747702 Fix T99706: Crash rendering with headless builds
When rendering with headless builds, show an error instead of crashing.

Previously GPU_backend_init was called indirectly from
DRW_opengl_context_create, a new function is now called from the window
manager (GPU_backend_init_once), so it's possible to check if the GPU
has a back-end.

This also disables the `bgl` Python module when building WITH_HEADLESS.

Reviewed By: fclem

Ref D15463
2022-07-15 22:16:44 +10:00
Ray Molenkamp c2715dc416 GPU: Remove USD dependency from shader_builder.
Dependency was added as shader builder depended to blenkernel as an
umbrella, in stead of adding the actual dependencies it required.
2022-07-15 10:54:10 +02:00
Jeroen Bakker 8ca09e6c5e GPU: add BUIDTIME to WITH_GPU_SHADER_BUILDER
Adds a better name that describes when it is used.
The GPU_SHADER_BUILDER is a buildtime tool for developers
to pre-validate GLSL (and in the overseen future pre-compile to
SpirV). We don't see that this needs to become a required
step in the future so WITH_GPU_BUILDTIME_SHADER_BUILDER
is more descriptive name.
2022-07-11 16:45:07 +02:00
Jeroen Bakker 76d8614236 GPU: Do not allow GPU Shader builder when USD is enabled.
Linking GPU shader builder requires stubs for many functions of the USD library.
We don't want to rely on other modules to update the stubs for a tool that
is only used by GPU developers.

This patch raises an error when both WITH_GPU_SHADER_BUILDER and WITH_USD are
enabled. This reduces the maintenance of updating the stubs when USD API changes.

Reviewed By: LazyDodo

Differential Revision: https://developer.blender.org/D15422
2022-07-11 16:12:36 +02:00
Campbell Barton e58e023e1a GHOST/Wayland: support dynamic loading libraries for Wayland
Add intern/wayland_dynload which is used when WITH_GHOST_WAYLAND_DYNLOAD
is enabled (off by default). When enabled, systems without Wayland
installed will fall back to X11.

This allows Blender to dynamically load:
- libwayland-client
- libwayland-cursor
- libwayland-egl
- libdecor-0 (when WITH_GHOST_WAYLAND_LIBDECOR is enabled).
2022-07-06 15:30:47 +10:00
Xavier Hallade a02992f131 Cycles: Add support for rendering on Intel GPUs using oneAPI
This patch adds a new Cycles device with similar functionality to the
existing GPU devices.  Kernel compilation and runtime interaction happen
via oneAPI DPC++ compiler and SYCL API.

This implementation is primarly focusing on Intel® Arc™ GPUs and other
future Intel GPUs.  The first supported drivers are 101.1660 on Windows
and 22.10.22597 on Linux.

The necessary tools for compilation are:
- A SYCL compiler such as oneAPI DPC++ compiler or
  https://github.com/intel/llvm
- Intel® oneAPI Level Zero which is used for low level device queries:
  https://github.com/oneapi-src/level-zero
- To optionally generate prebuilt graphics binaries: Intel® Graphics
  Compiler All are included in Linux precompiled libraries on svn:
  https://svn.blender.org/svnroot/bf-blender/trunk/lib The same goes for
  Windows precompiled binaries but for the graphics compiler, available
  as "Intel® Graphics Offline Compiler for OpenCL™ Code" from
  https://www.intel.com/content/www/us/en/developer/articles/tool/oneapi-standalone-components.html,
  for which path can be set as OCLOC_INSTALL_DIR.

Being based on the open SYCL standard, this implementation could also be
extended to run on other compatible non-Intel hardware in the future.

Reviewed By: sergey, brecht

Differential Revision: https://developer.blender.org/D15254

Co-authored-by: Nikita Sirgienko <nikita.sirgienko@intel.com>
Co-authored-by: Stefan Werner <stefan.werner@intel.com>
2022-06-29 12:58:04 +02:00
Sayak Biswas abfa09752f Cycles: enable Vega GPU/APU support
Enables Vega and Vega II GPUs as well as Vega APU, using changes in HIP code
to support 64-bit waves and a new HIP SDK version.

Tested with Radeon WX9100, Radeon VII GPUs and Ryzen 7 PRO 5850U with Radeon
Graphics APU.

Ref T96740, T91571

Differential Revision: https://developer.blender.org/D15242
2022-06-28 18:35:43 +02:00
Christian Rauch bd6912930f Build: when using Wayland, always enable EGL and disable system GLEW
GLEW does not support GLX and EGL at the same time, and the distribution version
is likely to have GLX.

This also refactors the code so all OpenGL related CMake options are together.

Differential Revision: https://developer.blender.org/D12034
2022-06-28 16:54:45 +02:00
Campbell Barton 3a8fa77c1f GHOST/Wayland: Add a build time option for DBUS, disable by default
Add WITH_GHOST_WAYLAND_DBUS option, so Blender can be built without
DBUS support. Currently it's only used to access the cursor theme.
Without this the "default" cursors are used instead.

Disabling this since it adds an additional dependency for a minor gain
in functionality, with the benefit of removing a library requirement.

There is also a problem where Blender hangs on startup for ~5 seconds
when DBUS isn't running. Eventually it would be good to be able to avoid
this problem without a build option.
2022-06-27 16:49:21 +10:00
Christian Rauch 29755e1df8 GHOST/Wayland: support client-side window decorations
This implements client-side window decorations for moving and resizing
windows and HiDPI support.

This functionality depends on the external project 'libdecor' that is
currently a build option: WITH_GHOST_WAYLAND_LIBDECOR.

Reviewed by: brecht, campbellbarton

Ref D7989
2022-06-25 00:10:39 +10:00
Campbell Barton 8edd1d8aa5 CMake: optionally disable OBJ, STL & GPencil SVG support
The following CMake options have been added (enabled by default),
except for the lite build configuration.

- WITH_IO_STL
- WITH_IO_WAVEFRONT_OBJ
- WITH_IO_GPENCIL (for grease pencil SVG importing).
  Note that it was already possible to disable grease pencil export
  by disabling WITH_PUGIXML & WITH_HARU.

This is intended to keep the lite builds fast and small for building,
linking & execution.

Reviewed By: iyadahmed2001, aras_p, antoniov, mont29

Ref D15141
2022-06-08 13:29:32 +10:00
Brecht Van Lommel bd2f9a16fb Merge branch 'blender-v3.2-release' 2022-05-27 17:06:58 +02:00
Jagannadhan Ravi 74cf22c42c Fix T96397: Cycles missing HIP support for gfx1035 devices
Such as AMD Radeon RX 6700S.

Differential Revision: https://developer.blender.org/D13495
2022-05-27 16:59:40 +02:00
Jacques Lucke a337e7738f BLI: use no_unique_address attribute
Even though the `no_unique_address` attribute has only been standardized
in C++20, compilers seem to support it with C++17 already. This attribute
allows reducing the memory footprint of structs which have empty types as
data members (usually that is an allocator or inline buffer in Blender).
Previously, one had to use the empty base optimization to achieve the same
effect, which requires a lot of boilerplate code.

The types that benefit from this the most are `Vector` and `Array`, which
usually become 8 bytes smaller. All types which use these core data structures
get smaller as well of course.

Differential Revision: https://developer.blender.org/D14993
2022-05-25 16:28:07 +02:00
Campbell Barton c1dcc64750 CMake: disable WITH_MOD_FLUID when WITH_PYTHON=OFF 2022-05-20 11:17:32 +10:00
Campbell Barton 41feaa17f3 Cleanup: suppress 'address' warnings for ./extern/glew
Also add comments noting why some warnings shouldn't be added to
strict-flags.
2022-05-19 11:17:01 +10:00
Sergey Sharybin be9800e8da Update Ceres to latest upstream version 2.1.0
This release deprecated the Parameterization API and the new Manifolds
API is to be used instead. This is what was done in the Libmv as part
of this change.

Additionally, remove the bundling scripts. Nowadays those are only
leading to a duplicated work to maintain.

No measurable changes on user side is expected.
2022-05-11 09:33:45 +02:00
Ray Molenkamp 1bb7fda600 CMake: Fix noisy PUGIXML warning.
When doing a lite build, a warning is displayed
that due to PUGIXML being off WITH_CYCLES_OSL
is being disabled as well.

If WITH_CYCLES is off this is just useless
noise.

this diff changes the warning to only emit when
WITH_CYCLES is on.
2022-05-10 16:38:20 -06:00
Sebastian Parborg 82060c1697 Remove unused compile flag on linux x86 GCC platforms
The "cast-align" warning is only triggered on Arm CPUs when using GCC.
Currently the only officialy supported ARM platform is the Mac platform
where we use Clang. So this warning never triggers.
2022-05-09 14:30:57 +02:00
Brecht Van Lommel b5b6ae06f9 Build: update outdated description of WITH_TBB option 2022-05-04 17:07:39 +02:00
Sybren A. Stüvel 91bd63a196 CMake: Reduce dependencies of USD
`PXR_ENABLE_OSL_SUPPORT=OFF`: OpenShadingLanguage is an optional
dependency of the Imaging module. However, since that module was
included for its support for converting primitive shapes (sphere, cube,
etc.) to geometry, OSL is not necessary. Disabling it will make it
simpler to build Blender; currently only Cycles uses OSL.

`PXR_ENABLE_GL_SUPPORT=OFF`: GL support on Linux also links to X11
libraries. Enabling it would break headless or Wayland-only builds.
OpenGL support would be useful if someone wants to work on a Hydra
viewport in Blender; when that's actually being worked on, we could
patch in a new PXR_ENABLE_X11_SUPPORT option (to separate OpenGL from
X11) and contribute it upstream.

`PXR_BUILD_OPENIMAGEIO_PLUGIN=OFF`: It's used for loading image textures
in Hydra Storm / Embree renderers which we don't use.

Reviewed By: LazyDodo, brecht, makowalski

Differential Revision: https://developer.blender.org/D14792
2022-04-28 17:16:04 +02:00
Brecht Van Lommel 179100c021 Cycles: enable AMD RDNA GPU support on Linux
This enables building of HIP binaries for AMD RDNA and RDNA2 GPUs.

This requires the 22.10 / ROCm 5.1 driver.

Ref T91571

Differential Revision: https://developer.blender.org/D14360
2022-04-22 00:11:55 +02:00
Brecht Van Lommel 604c33e694 Build: updates for Blender to build against new 3.2 libraries
Building against the existing 3.1 libraries should continue to work, until
the precompiled libraries are committed for all platforms.

* Enable WebP by default.
* Update Windows for new library file names.
* Automatically clear outdated CMake cache variables when upgrading to new
  libraries.
* Fix static library linking order issues on Linux for OpenEXR and OpenVDB.

Implemented by Ray Molenkamp, Sybren Stüvel and Brecht Van Lommel.

Ref T95206
2022-04-20 16:42:16 +02:00
Brecht Van Lommel 2d472b70e5 Revert "Cycles: enable HIP for Vega and Vega II (Radeon 7) GPUs on Windows"
This is not currently working, reverting until the driver/compiler has a fix.

This reverts commit c46e58817c.
2022-04-12 19:18:58 +02:00
Ray Molenkamp 6bf51ab03a CMake: Give some extra space to info_cfg_option
WITH_PYTHON_INSTALL_ZSTANDARD was too long and
didn't align very well compared to the other
items in the list.
2022-03-25 14:33:39 -06:00
Aaron Carlisle 4fd0a69d7b ImBuf: Add support for WebP image format
Currently only supports single image frames (no animation possible).

If quality slider is set to 100 then lossless compression will be used,
otherwise lossy compression is used.

Gives about 35% reduction of filesize  save when re-saving splash screens with lossless
compression.
Also saves much faster, up to 15x faster than PNG with a better compression ratio as a plus.

Note, this is currently left disabled until we have WebP libs (see T95206)

For testing precompiled libs can be downloaded from Google:
https://storage.googleapis.com/downloads.webmproject.org/releases/webp/index.html

Differential Revision: https://developer.blender.org/D1598
2022-03-24 18:24:06 -04:00
Brian Savery c46e58817c Cycles: enable HIP for Vega and Vega II (Radeon 7) GPUs on Windows
Basic testing on windows only so far. Will need some testing on Linux as well
when the Linux enablement patch is ready.

Does not enable Vega APUs yet (which would be gfx902 or gfx90c).

Differential Revision: https://developer.blender.org/D14432
2022-03-24 01:12:45 +01:00
Patrick Mours d350976ba0 Cycles: Add Hydra render delegate
This patch adds a Hydra render delegate to Cycles, allowing Cycles to be used for rendering
in applications that provide a Hydra viewport. The implementation was written from scratch
against Cycles X, for integration into the Blender repository to make it possible to continue
developing it in step with the rest of Cycles. For this purpose it follows the style of the rest of
the Cycles code and can be built with a CMake option
(`WITH_CYCLES_HYDRA_RENDER_DELEGATE=1`) similar to the existing standalone version
of Cycles.

Since Hydra render delegates need to be built against the exact USD version and other
dependencies as the target application is using, this is intended to be built separate from
Blender (`WITH_BLENDER=0` CMake option) and with support for library versions different
from what Blender is using. As such the CMake build scripts for Windows had to be modified
slightly, so that the Cycles Hydra render delegate can e.g. be built with MSVC 2017 again
even though Blender requires MSVC 2019 now, and it's possible to specify custom paths to
the USD SDK etc. The codebase supports building against the latest USD release 22.03 and all
the way back to USD 20.08 (with some limitations).

Reviewed By: brecht, LazyDodo

Differential Revision: https://developer.blender.org/D14398
2022-03-23 16:39:05 +01:00
Jason Fielder 309ea31485 Metal: Initial Implementation of Metal Backend for GPU Module.
Adding WITH_METAL option to CMAKE to guard compilation for macOS only. Implemented stub METALBackend to mirror GPUBackend interface and added capabilities initialisation, along with API initialisation paths.

Global rendering coordination commands added to backend with GPU_render_begin and GPU_render_end() commands globally wrapping GPU work. This is required for Metal to ensure temporary resources are generated within an NSAutoReleasePool and freed accordingly.

Authored by Apple: Michael Parkin-White, Vil Harvey, Marco Giordano, Michael Jones, Morteza Mostajabodaveh, Jason Fielder

Ref T96261

Reviewed By: fclem

Maniphest Tasks: T96261

Differential Revision: https://developer.blender.org/D14293
2022-03-22 12:54:34 +01:00
Sergey Sharybin a45108840e CMake: Extra flags to ignore for strict compiler
Solves warnings generated by default build on macOS.
2022-03-16 10:33:04 +01:00
Campbell Barton 6ea1455ce3 Fix mistake in 4c951bfa82
Removed WITH_SYSTEM_GLEW by mistake, thanks to @The_Orb for spotting.
2022-03-14 14:25:31 +11:00
Brecht Van Lommel f130d4f211 Cleanup: fix various typos
Contributed by luzpaz.

Differential Revision: https://developer.blender.org/D14203
2022-03-07 17:28:39 +01:00
Alaska 165b030b19 Cleanup: Remove repeated word in comment
Differential Revision: https://developer.blender.org/D14178
2022-02-23 11:07:04 +05:30
Stefan Werner 51c7193405 Cycles: Removed numaapi from standalone 2022-02-22 16:34:52 +01:00
Campbell Barton ca12696257 Merge branch 'blender-v3.1-release' 2022-02-22 10:18:15 +11:00
Campbell Barton ec5bbebf3e Python: bump minimum version to 3.10
Since Python 3.10 is now supported on all platform,
bump the minimum version to reduce the number of Python versions that
need to be supported simultaneously.

Reviewed By: LazyDodo, sybren, mont29, brecht

Ref D13943
2022-02-22 10:16:25 +11:00
Campbell Barton c434782e3a File headers: SPDX License migration
Use a shorter/simpler license convention, stops the header taking so
much space.

Follow the SPDX license specification: https://spdx.org/licenses

- C/C++/objc/objc++
- Python
- Shell Scripts
- CMake, GNUmakefile

While most of the source tree has been included

- `./extern/` was left out.
- `./intern/cycles` & `./intern/atomic` are also excluded because they
  use different header conventions.

doc/license/SPDX-license-identifiers.txt has been added to list SPDX all
used identifiers.

See P2788 for the script that automated these edits.

Reviewed By: brecht, mont29, sergey

Ref D14069
2022-02-11 09:14:36 +11:00
Ankit Meel 7331c86dbf macOS: support building blender-thumbnailer
It was missing framework flags added in `setup_platform_linker_flags`.
Keep it off until QuickLook Thumbnailing is implemented.

Differential Revision: https://developer.blender.org/D13997
2022-02-04 20:57:30 +05:30
Campbell Barton ebd0e76088 Cleanup: indentation for CMake files
Also minor white-space & case changes.
2022-01-28 14:52:47 +11:00
Campbell Barton 4c951bfa82 CMake: add WITH_SYSTEM_FREETYPE to link against the systems freetype 2022-01-26 15:31:30 +11:00
Ankit Meel cd0acba330 CMake: Support external callback in configuration
An external CMake script can be used to debug CMake code, modify/read
target properties, inter-target dependencies, non-cache variables etc.

Reviewed by: LazyDodo, brecht
Differential Revision: https://developer.blender.org/D13830
2022-01-20 00:15:09 +05:30
Ankit Meel 596ce11556 CMake Cleanup: use set for filepath instead of option
See https://developer.blender.org/D13830#368219
2022-01-19 23:34:25 +05:30
Jeroen Bakker 9d3f35a0bf Revert "Revert "GPUShaderCreateInfo for interface abstraction""
This reverts commit edee5a947b.

Fixes compilation error (Missing file BLI_float2.hh)
2022-01-17 14:46:32 +01:00
Jeroen Bakker edee5a947b Revert "GPUShaderCreateInfo for interface abstraction"
This reverts commit 8fb2ff458b.
Missing some files.
2022-01-17 14:34:28 +01:00
Jeroen Bakker 8fb2ff458b GPUShaderCreateInfo for interface abstraction
This is a first part of the Shader Create Info system could be.

A shader create info provides a way to define shader structure, resources
and interfaces. This makes for a quick way to provide backend agnostic
binding informations while also making shader variations easy to declare.

- Clear source input (only one file). Cleans up the GPU api since we can create a
  shader from one descriptor
- Resources and interfaces are generated by the backend (much simpler than parsing).
- Bindings are explicit from position in the array.
- GPUShaderInterface becomes a trivial translation of enums and string copy.
- No external dependency to third party lib.
- Cleaner code, less fragmentation of resources in several libs.
- Easy to modify / extend at runtime.
- no parser involve, very easy to code.
- Does not hold any data, can be static and kept on disc.
- Could hold precompiled bytecode for static shaders.

This also includes a new global dependency system.
GLSL shaders can include other sources by using #pragma BLENDER_REQUIRE(...).

This patch already migrated several builtin shaders. Other shaders should be migrated
one at a time, and could be done inside master.

There is a new compile directive `WITH_GPU_SHADER_BUILDER` this is an optional
directive for linting shaders to increase turn around time.

What is remaining:
- pyGPU API {T94975}
- Migration of other shaders. This could be a community effort.

Reviewed By: jbakker

Maniphest Tasks: T94975

Differential Revision: https://developer.blender.org/D13360
2022-01-17 14:32:28 +01:00
Campbell Barton 8b3d798374 CMake: add WITH_LINKER_MOLD option for GCC/Clang Unix platforms
Can give considerably faster linking, especially on system with many
cores.

The mold linker recently reached 1.0, see:
https://github.com/rui314/mold

The current stable release of GCC can't use this linker via
-fuse-ld=mold, so this patch uses the "-B" argument to add a binary
directory containing an alternate "ld" command that points to
"mold" (which is part of the default mold installation).

Some timing tests for linking full builds for AMD TR 3970X:

- BFD: 20.78 seconds.
- LLD: 12.16 seconds.
- GOLD: 7.21 seconds.
- MOLD: 2.53 seconds.

Ref D13807

Reviewed by: sergey, brecht
2022-01-14 09:44:58 +11:00
Clément Foucault fb6bd88644 Revert "BLI: Refactor vector types & functions to use templates"
Includes unwanted changes

This reverts commit 46e049d0ce.
2022-01-12 12:50:02 +01:00
Clment Foucault 46e049d0ce BLI: Refactor vector types & functions to use templates
This patch implements the vector types (i.e:`float2`) by making heavy
usage of templating. All vector functions are now outside of the vector
classes (inside the `blender::math` namespace) and are not vector size
dependent for the most part.

In the ongoing effort to make shaders less GL centric, we are aiming
to share more code between GLSL and C++ to avoid code duplication.

####Motivations:
 - We are aiming to share UBO and SSBO structures between GLSL and C++.
 This means we will use many of the existing vector types and others
 we currently don't have (uintX, intX). All these variations were
 asking for many more code duplication.
 - Deduplicate existing code which is duplicated for each vector size.
 - We also want to share small functions. Which means that vector
 functions should be static and not in the class namespace.
 - Reduce friction to use these types in new projects due to their
 incompleteness.
 - The current state of the `BLI_(float|double|mpq)(2|3|4).hh` is a
 bit of a let down. Most clases are incomplete, out of sync with each
 others with different codestyles, and some functions that should be
 static are not (i.e: `float3::reflect()`).

####Upsides:
 - Still support `.x, .y, .z, .w` for readability.
 - Compact, readable and easilly extendable.
 - All of the vector functions are available for all the vectors types
 and can be restricted to certain types. Also template specialization
 let us define exception for special class (like mpq).
 - With optimization ON, the compiler unroll the loops and performance
 is the same.

####Downsides:
 - Might impact debugability. Though I would arge that the bugs are
 rarelly caused by the vector class itself (since the operations are
 quite trivial) but by the type conversions.
 - Might impact compile time. I did not saw a significant impact since
 the usage is not really widespread.
 - Functions needs to be rewritten to support arbitrary vector length.
 For instance, one can't call `len_squared_v3v3` in
 `math::length_squared()` and call it a day.
 - Type cast does not work with the template version of the `math::`
 vector functions. Meaning you need to manually cast `float *` and
 `(float *)[3]` to `float3` for the function calls.
 i.e: `math::distance_squared(float3(nearest.co), positions[i]);`
 - Some parts might loose in readability:
 `float3::dot(v1.normalized(), v2.normalized())`
 becoming
 `math::dot(math::normalize(v1), math::normalize(v2))`
 But I propose, when appropriate, to use
 `using namespace blender::math;` on function local or file scope to
 increase readability.
 `dot(normalize(v1), normalize(v2))`

####Consideration:
 - Include back `.length()` method. It is quite handy and is more C++
 oriented.
 - I considered the GLM library as a candidate for replacement. It felt
 like too much for what we need and would be difficult to extend / modify
 to our needs.
 - I used Macros to reduce code in operators declaration and potential
 copy paste bugs. This could reduce debugability and could be reverted.
 - This touches `delaunay_2d.cc` and the intersection code. I would like
 to know @howardt opinion on the matter.
 - The `noexcept` on the copy constructor of `mpq(2|3)` is being removed.
 But according to @JacquesLucke it is not a real problem for now.

I would like to give a huge thanks to @JacquesLucke who helped during this
and pushed me to reduce the duplication further.

Reviewed By: brecht, sergey, JacquesLucke

Differential Revision: https://developer.blender.org/D13791
2022-01-12 12:47:43 +01:00
Clément Foucault e5766752d0 Revert "BLI: Refactor vector types & functions to use templates"
Reverted because the commit removes a lot of commits.

This reverts commit a2c1c368af.
2022-01-12 12:44:26 +01:00
Clément Foucault a2c1c368af BLI: Refactor vector types & functions to use templates
This patch implements the vector types (i.e:float2) by making heavy
usage of templating. All vector functions are now outside of the vector
classes (inside the blender::math namespace) and are not vector size
dependent for the most part.

In the ongoing effort to make shaders less GL centric, we are aiming
to share more code between GLSL and C++ to avoid code duplication.

Motivations:
- We are aiming to share UBO and SSBO structures between GLSL and C++.
  This means we will use many of the existing vector types and others we
  currently don't have (uintX, intX). All these variations were asking
  for many more code duplication.
- Deduplicate existing code which is duplicated for each vector size.
- We also want to share small functions. Which means that vector functions
  should be static and not in the class namespace.
- Reduce friction to use these types in new projects due to their
  incompleteness.
- The current state of the BLI_(float|double|mpq)(2|3|4).hh is a bit of a
  let down. Most clases are incomplete, out of sync with each others with
  different codestyles, and some functions that should be static are not
  (i.e: float3::reflect()).

Upsides:
- Still support .x, .y, .z, .w for readability.
- Compact, readable and easilly extendable.
- All of the vector functions are available for all the vectors types and
  can be restricted to certain types. Also template specialization let us
  define exception for special class (like mpq).
- With optimization ON, the compiler unroll the loops and performance is
  the same.

Downsides:
- Might impact debugability. Though I would arge that the bugs are rarelly
  caused by the vector class itself (since the operations are quite trivial)
  but by the type conversions.
- Might impact compile time. I did not saw a significant impact since the
  usage is not really widespread.
- Functions needs to be rewritten to support arbitrary vector length. For
  instance, one can't call len_squared_v3v3 in math::length_squared() and
  call it a day.
- Type cast does not work with the template version of the math:: vector
  functions. Meaning you need to manually cast float * and (float *)[3] to
  float3 for the function calls.
  i.e: math::distance_squared(float3(nearest.co), positions[i]);
- Some parts might loose in readability:
  float3::dot(v1.normalized(), v2.normalized())
  becoming
  math::dot(math::normalize(v1), math::normalize(v2))
  But I propose, when appropriate, to use
  using namespace blender::math; on function local or file scope to
  increase readability. dot(normalize(v1), normalize(v2))

Consideration:
- Include back .length() method. It is quite handy and is more C++
  oriented.
- I considered the GLM library as a candidate for replacement.
  It felt like too much for what we need and would be difficult to
  extend / modify to our needs.
- I used Macros to reduce code in operators declaration and potential
  copy paste bugs. This could reduce debugability and could be reverted.
- This touches delaunay_2d.cc and the intersection code. I would like to
  know @Howard Trickey (howardt) opinion on the matter.
- The noexcept on the copy constructor of mpq(2|3) is being removed.
  But according to @Jacques Lucke (JacquesLucke) it is not a real problem
  for now.

I would like to give a huge thanks to @Jacques Lucke (JacquesLucke) who
helped during this and pushed me to reduce the duplication further.

Reviewed By: brecht, sergey, JacquesLucke

Differential Revision: http://developer.blender.org/D13791
2022-01-12 12:19:39 +01:00
Campbell Barton ebad1d8d33 CMake: exclude linker options for APPLE and non-UNIX
These are only used for non-apple unix systems.
2022-01-12 18:55:13 +11:00
Brecht Van Lommel 3f96555123 Cycles: enable Metal GPU rendering
This adds the remaining bits to enable Metal on macOS. There are still
performance optimizations and other improvements planned, but it should
now be ready for early testing.

This is currently only enabled on in Arm builds for M1 GPUs. It is not
yet working on AMD or Intel GPUs.

Ref T92212

Differential Revision: https://developer.blender.org/D13503
2021-12-13 13:57:13 +01:00
Brecht Van Lommel 205254150a Build: don't look for CUDA toolkit if not using Cycles CUDA device 2021-12-07 19:52:54 +01:00
Brecht Van Lommel 484714992c Build: remove Cycles CUDA/HIP/OPTIX build options on macOS
So those device types are not listed in the preferences. Metal will be
added instead as the only option.
2021-12-07 19:01:39 +01:00
Dalai Felinto b066d58216 CMake mini-rewrite: Sync code check with BKE_blender_version_is_alpha
Reproduce the logic we already do in C (BKE_blender_version_is_alpha)
and the CMake file.

Otherwise it can get out of sync if we add/rename the non-alpha release cycles.

No functional change.

Differential Revision: https://developer.blender.org/D13379
2021-11-26 13:05:37 +01:00
Brecht Van Lommel 7b5a6f452a Merge branch 'blender-v3.0-release' 2021-11-25 18:33:19 +01:00
Brecht Van Lommel 2fb8c6805a Fix build error with experimental features after recent release cycle bump
Hair, pointcloud and simulation datablock types should be disabled in the
beta cycles already like other experimental features.
2021-11-25 18:24:46 +01:00
Jacques Lucke 050b205a97 CMake: add WITH_UNITY_BUILD option to improve compile times
Unity builds are only used in the `bf_nodes_geometry` module for now.
This module has been prepared to support unity builds already.
Usually, there is a 2-4x speedup when building `bf_nodes_geometry`
compared to without unity builds (e.g. 145s to 55s).

For more information about how unity builds work and how they help
with compile times, see D13341.

Differential Revision: https://developer.blender.org/D13341
2021-11-24 11:40:26 +01:00
Brecht Van Lommel 7d5ef64bfb Cleanup: fix typos in comments and docs
Contributed by luzpaz.

Differential Revision: https://developer.blender.org/D13264
2021-11-19 12:46:49 +01:00
Sebastian Herholz d9bc8f189c Cycles: add build option to enable a debugging feature for MIS
This patch adds a CMake option "WITH_CYCLES_DEBUG" which builds cycles with
a feature that allows debugging/selecting the direct-light sampling strategy.
The same option may later be used to add other debugging features that could
affect performance in release builds.

The three options are:
* Forward path tracing (e.g., via BSDF or phase function)
* Next-event estimation
* Multiple importance sampling combination of the previous two methods

Such a feature is useful for debugging light different sampling, evaluation,
and pdf methods (e.g., for light sources and BSDFs).

Differential Revision: https://developer.blender.org/D13152
2021-11-17 18:03:56 +01:00
Brecht Van Lommel 7689f501e2 Cycles: enable HIP device and binaries on Windows
We've now done testing to confirm this works with RDNA and RDNA2 AMD GPUs
on Windows. The AMD driver needed for this will soon be released publicly.
2021-11-10 20:16:44 +01:00
Campbell Barton b849f290c5 Cleanup: capitalize ON/OFF with CMake 2021-11-04 14:50:24 +11:00
Sebastian Parborg 690300eb4a Fix install paths for blender thumbnailer when not building a portable install
When doing a non portable build of blender, the executable
blender-thumbnailer would be installed in two locations:
/usr/bin/
/usr/

While cleaning up, also make the blender thumbnailer dll optional on
windows to bring the logic in line with what it is on linux and mac.

Reviewed By: Campbell Barton, Ray molenkamp

Differential Revision: http://developer.blender.org/D13014
2021-10-28 21:13:47 +02:00
Sybren A. Stüvel 816d3f830b CMake: expand instructions for accidental 'cmake' run in source dir
Our CMake setup refuses to run from the source directory (i.e. Blender does
not support in-source builds). Instead, it shows instructions on how to
clean up after an accidental `cmake` invocation. These instructions missed
one directory that should also be removed (`CMakeFiles`), so that's been
added to the message now.

No functional changes to Blender or the build.
2021-10-26 11:46:57 +02:00
Brecht Van Lommel fa688fbf06 Build: improve descriptions and organization of Cycles build options 2021-10-22 08:34:31 +02:00
Brecht Van Lommel b0d64841d2 Cycles: keep HIP device disabled until we have binaries
And clear communication about supported hardware.

Ref T92397
2021-10-22 08:18:53 +02:00
Sybren A. Stüvel a5917175d8 Deps: Python, bundle zstandard package
This package allows Python scripts to handle compressed blend files (see
rB2ea66af742bc). This is for example needed by Blender Asset Tracer to
send files to a Flamenco render farm.

This change includes a new `WITH_PYTHON_INSTALL_ZSTANDARD` build-time
option, to control whether to actually install the package. For this the
already-existing approach for Requests was copied.

Reviewed By: LazyDodo, mont29, brecht

Differential Revision: https://developer.blender.org/D12777
2021-10-21 13:46:33 +02:00
Sayak Biswas ba4e227def HIP device code cleanup and fix for high VRAM usage
This patch cleans up code for HIP device and makes it more consistent with the CUDA code.
It also fixes the issue with high VRAM usage on AMD cards using HIP allowing better performance and usage on cards like 6600XT.
Added a check in intern/cycles/kernel/bvh/bvh_util.h to prevent compiler error with hipcc

Reviewed By: brecht, leesonw

Maniphest Tasks: T92124

Differential Revision: https://developer.blender.org/D12834
2021-10-20 14:04:28 +02:00
Campbell Barton fd7510984a CMake: add WITH_BLENDER_THUMBNAILER option
Make building the thumbnail extraction executable optional,
disable on macOS as this was not linking, further, macOS doesn't use
this for thumbnail extraction so it could be left disabled.
2021-10-20 12:15:33 +11:00
Brecht Van Lommel 55b8fc718a Cycles: improve detection of HIP compiler for buildbot
And fix various broken things in the HIP kernel compilation.
2021-10-05 13:47:50 +02:00
Brian Savery 044a77352f Cycles: add HIP device support for AMD GPUs
NOTE: this feature is not ready for user testing, and not yet enabled in daily
builds. It is being merged now for easier collaboration on development.

HIP is a heterogenous compute interface allowing C++ code to be executed on
GPUs similar to CUDA. It is intended to bring back AMD GPU rendering support
on Windows and Linux.

https://github.com/ROCm-Developer-Tools/HIP.

As of the time of writing, it should compile and run on Linux with existing
HIP compilers and driver runtimes. Publicly available compilers and drivers
for Windows will come later.

See task T91571 for more details on the current status and work remaining
to be done.

Credits:

Sayak Biswas (AMD)
Arya Rafii (AMD)
Brian Savery (AMD)

Differential Revision: https://developer.blender.org/D12578
2021-09-28 19:18:55 +02:00
Brecht Van Lommel 0803119725 Cycles: merge of cycles-x branch, a major update to the renderer
This includes much improved GPU rendering performance, viewport interactivity,
new shadow catcher, revamped sampling settings, subsurface scattering anisotropy,
new GPU volume sampling, improved PMJ sampling pattern, and more.

Some features have also been removed or changed, breaking backwards compatibility.
Including the removal of the OpenCL backend, for which alternatives are under
development.

Release notes and code docs:
https://wiki.blender.org/wiki/Reference/Release_Notes/3.0/Cycles
https://wiki.blender.org/wiki/Source/Render/Cycles

Credits:
* Sergey Sharybin
* Brecht Van Lommel
* Patrick Mours (OptiX backend)
* Christophe Hery (subsurface scattering anisotropy)
* William Leeson (PMJ sampling pattern)
* Alaska (various fixes and tweaks)
* Thomas Dinges (various fixes)

For the full commit history, see the cycles-x branch. This squashes together
all the changes since intermediate changes would often fail building or tests.

Ref T87839, T87837, T87836
Fixes T90734, T89353, T80267, T80267, T77185, T69800
2021-09-21 14:55:54 +02:00
Ankit Meel b477333473 Cleanup: fix comment about compiler support.
Differential Revision: https://developer.blender.org/D12288
2021-08-22 22:15:28 +05:30
Ankit Meel 34a05f39be Clang: warn about C++20 designated initializers
With the ongoing transition to C++ files, Windows build
breaks often because of designated initializers.
Now we have two compilers to catch the MSVC build error on.

Reviewed By: #platform_macos, brecht, campbellbarton
Differential Revision: https://developer.blender.org/D11940
2021-08-21 14:02:50 +05:30
Germano Cavalcante 89014b51f1 Xcode: support cmake options for grouping in folders
The Xcode IDE can also benefit from the options:
- WINDOWS_USE_VISUAL_STUDIO_SOURCE_FOLDERS
- WINDOWS_USE_VISUAL_STUDIO_PROJECT_FOLDERS

So add suport to these options and also renames them as they are no
longer limited to just Windows and Visual Studio.

Reviewed By: brecht, ankitm

Differential Revision: https://developer.blender.org/D12132
2021-08-05 15:31:41 -03:00
Germano Cavalcante cc4e674e41 DRW: New Select Debug Engine
This is a simple engine used only to debug the texture of select ids.

It is only used when the `WITH_DRAW_DEBUG` option is enabled and the
debug value is 31.

Reviewed By: fclem

Differential Revision: https://developer.blender.org/D5490
2021-08-05 11:56:51 -03:00
Ankit Meel 652fbc2005 macOS: Portable builds with dynamic libraries.
For Blender.app: dropping libomp.dylib next to Blender executable is
enough for it getting picked up since `@executable_path` is an rpath.

For non-distributed binaries datatoc, makesdna, tests etc, code for
copying libomp.dylib to build folder is removed and replaced by
CMake's rpath option for *build* tree.

For bpy.so, the post build rpath change has also been replaced by CMake
rpath option for *install* tree.

Since -id has been changed in D11748, remove the
`install_name_tool -change ...` command.

Any dylib can just be dropped at `MAC_BLENDER_TARGET_DYLIBS_DIR`
hereafter. Appending dylib path to `CMAKE_BUILD_RPATH` will be needed
for datatoc etc if linked against one (instead of copying the
dylibs around).

Reviewed By: #platform_macos, brecht
Differential Revision: https://developer.blender.org/D11997
2021-08-03 20:49:40 +05:30
Brecht Van Lommel eccd8af828 Revert "GHOST/X11: enable EGL"
This is causing issues for some users launching Blender, because EGL indirectly
requires GLVND, which is not installed by default on e.g. Ubuntu.

This reverts commit 0b18a618b8.

Fixes T90374

Ref D12034
2021-08-02 17:19:17 +02:00
Christian Rauch 0b18a618b8 GHOST/X11: enable EGL
This will replace GLX with EGL for X11. GLEW does not support GLX and EGL
at the same time. Most distributions build GLEW with GLX support, so we
have to use the externally provided GLEW and build with EGL support.
This effectively sets WITH_SYSTEM_GLEW to OFF for all Linux configurations.

Differential Revision: https://developer.blender.org/D12034
2021-07-29 17:39:55 +01:00
Brecht Van Lommel 073bf8bf52 Cycles: remove WITH_CYCLES_DEBUG, add WITH_CYCLES_DEBUG_NAN
WITH_CYCLES_DEBUG was used for rendering BVH debugging passes. But since we
mainly use Embree an OptiX now, this information is no longer important.

WITH_CYCLES_DEBUG_NAN will enable additional checks for NaNs and invalid values
in the kernel, for Cycles developers. Previously these asserts where enabled in
all debug builds, but this is too likely to crash Blender in scenes that render
fine regardless of the NaNs. So this is behind a CMake option now.

Fixes T90240
2021-07-28 19:27:57 +02:00
Sybren A. Stüvel faa65f151d Revert "cmake: enable Wayland by default"
This reverts commit a2ccd0e495.

This change was part of the still-under-review patch D11489, which
hasn't been accepted yet.
2021-07-26 12:18:53 +02:00
Christian Rauch a2ccd0e495 cmake: enable Wayland by default 2021-07-24 12:30:14 +01:00
Ray Molenkamp ebf7673f83 CMake: Have CMake Control the C++ version.
We were manually setting the compiler flags
for C++17 support for this previously. CMake
can do this for us in a uniform way without
having to worry about compiler specifics.

Setting these flags manually somehow brought
out some unwanted behaviour (CMake switching
back to C++14) in the nightly CMake builds.

Unsure if that's a CMake bug or planned
new behaviour for future version, but best
to play it safe.

These flags are supported since CMake 3.1
so should not break anything.

Reviewed by: Campbell Barton

Differential Revision: https://developer.blender.org/D11891
2021-07-14 15:17:02 -06:00
Yuki Hashimoto 83e2f8c993 macOS: support Japanese input for text buttons
Blender did not support to input East Asian characters (Chinese, Japanese,
Korean) on macOS. This patch adds support for Japanese input, by implementing
the appropriate processing for the NSTextInputClient protocol.

Technical notes:
* The conversion candidate window is drawn by the input method program calling
  `firstRectForCharacterRange`.
* The string before confirmation (called `composite` in blender) is handled in
  the `setMarkedText` method called by the input method program.
* The string after confirmation (called `result` in the blender) is processed
  in the `insertText` method called by the input method program.

Ref T51283

Differential Revision: https://developer.blender.org/D11695
2021-07-05 17:24:27 +02:00
Ray Molenkamp 4947aa29db CMake: Improve python version mismatch error
When CMake detects and incompatible Python version
it errors out with an error saying at-least python 3.9
is required, but doesn't mention the version it detected.

This makes troubleshooting the problem harder than it
needs to be.

This diff changes the error message to include the python
version CMake detected.

Differential Revision: https://developer.blender.org/D11666

Reviewed By: Ray Molenkamp
2021-06-21 18:19:07 -06:00
Ankit Meel aa95f8019e macOS: Fix unknown -Wsuggest-override warning
Added in rB7cef01b090c4c2d2703274edb91886ae37d3ce82
and rB87bfa2b207b90b5e34ebd835a23c2a82afbed878

Reviewed by: jbakker, #platform_macos
Differential Revision: https://developer.blender.org/D11012
2021-04-24 01:54:30 +05:30
Ankit Meel f061de9b3e Cleanup/CMake: warning to status to reduce noise
Correction in e5f0d176d4
2021-04-01 01:12:48 +05:30
Ankit Meel e5f0d176d4 CMake: issue warnings when changing options
Only done in top level CMakeLists, and platform_apple.

Reviewed By: campbellbarton
Differential Revision: https://developer.blender.org/D10343
2021-03-30 20:28:45 +05:30
Ray Molenkamp f9eaf93d37 MSVC: ASAN support for VS 16.9
This enables ASAN support when used with VS 16.9
enable as usual in cmake with the WITH_COMPILER_ASAN
option, or when using make.bat just tag on `asan'
to the invocation, ie: `make lite 2019 asan`

MSVC: Asan support for 16.9

This enables ASAN support when used with VS 16.9
enable as usual in cmake with the WITH_COMPILER_ASAN
option, or when using make.bat just tag on `asan'
to the invocation, ie: `make lite 2019 asan`

Differential Revision: https://developer.blender.org/D7794
Reviewed By: brecht, sergey
2021-03-29 19:11:17 -06:00
Ankit Meel ad31b13f91 macOS/bpy: add support for OpenMP
Changes made:
* Add OpenMP linker flags.
* Copy the libomp.dylib to `2.93/lib/libomp.dylib`.
* Change the `LC_LOAD_DYLIB` item such that
  the lib is found at `bpy.so/../../Resources/2.93/lib/libomp.dylib`.
Installation is done by D10664.

Reviewed By: #platform_macos, brecht
Maniphest Tasks: T86579
Differential Revision: https://developer.blender.org/D10657
2021-03-27 01:08:51 +05:30
Ankit Meel 2600b27d26 Cleanup/CMake: Fix comment, sort order of options. 2021-03-23 12:11:46 +05:30
Jörg Müller 12c08ceee3 Audaspace: add support for CoreAudio on macOS
This adds CoreAudio as audio backend on macOS.
CoreAudio is the standard audio API on macOS.

Ref T86590
2021-03-16 23:21:45 +01:00
Jörg Müller bc57985306 Audaspace: add support for WASAPI on Windows
This adds WASAPI as audio backend on Windows.
WASAPI is the modern standard audio API on
Windows introduced with Windows Vista.

Ref T86590
2021-03-16 23:21:45 +01:00
Jörg Müller d33339ebf4 Audaspace: add support for PulseAudio on Linux
This adds PulseAudio as audio backend on Linux.
PulseAudio is the main audio engine used on most,
if not all, Linux distributions today.

Ref T86590
2021-03-16 23:21:45 +01:00
Jörg Müller 7b8fc307dc Audaspace: porting minor improvements from upstream
- NullDevice is now called None
- Automatic choice of best available device.
- Minor formatting, documentation and cmake fixes.
2021-03-16 23:21:45 +01:00
Brecht Van Lommel f39143bc2e CMake: reduce Neon related output on Intel platforms
* Only try to find sse2neon if Neon detected
* Only run Neon support test once
2021-03-01 19:43:54 +01:00
Brecht Van Lommel bcd369c3c1 Fix macOS SSE support not detected correctly after recent changes
Due to moving the code the test binary was incorrectly compiled with OpenMP
flags. Move setting of the OpenMP flags to the appropriate place.
2021-02-25 15:09:10 +01:00
Ray Molenkamp 4fb0c83c1c Cmake/deps: Update OSL to 1.11.10.0
This bumps OSL to 1.11.10.0. OSL Has a new build time
dependency: Clang, and more importantly it expects
clang and llvm to share a library folder, which it
previously for us did not.

This patch changes:

-OSL Update to 1.11.10.0

-refactor the llvm/clang/clang-tools-extra builds into the llvm
 build using the llvm-project tarball for building that has all
 of the subprojects in it.

-update ispc/openmp builds since clang no longer its own dependency
 and they have to depend on the llvm build now.

-Update the windows builder to use the 64 bit host tools since it
 ran out of ram linking clang

-Since OSL now needs clang to link successfully a findclang.cmake
 has been provided for linux/OSX

Differential Revision: https://developer.blender.org/D10212

Reviewed By: brecht, sebbas, sybren
2021-02-24 07:13:37 -07:00
Brecht Van Lommel db28411fd9 BLI: use sse2neon to emulate SSE instructions with Arm Neon
* WITH_CPU_SSE was renamed to WITH_CPU_SIMD, and now covers both SSE and Neon.
* For macOS sse2neon.h is included as part of the precompiled libraries.
* For Linux it is enabled if the sse2neon.h header file is detected. However
  this library does not have official releases and is not shipped with any Linux
  distribution, so manual installation and configuration is required to get this
  working.

Ref D8237, T78710
2021-02-17 16:26:24 +01:00
Brecht Van Lommel 1b4961b318 OpenColorIO: upgrade to version 2.0.0
Ref T84819

Build System
============

This is an API breaking new version, and the updated code only builds with
OpenColorIO 2.0 and later. Adding backwards compatibility was too complicated.

* Tinyxml was replaced with Expat, adding a new dependency.
* Yaml-cpp is now built as a dependency on Unix, as was already done on Windows.
* Removed currently unused LCMS code.
* Pystring remains built as part of OCIO itself, since it has no good build system.
* Linux and macOS check for the OpenColorIO verison, and disable it if too old.

Ref D10270

Processors and Transforms
=========================

CPU processors now need to be created to do CPU processing. These are cached
internally, but the cache lookup is not fast enough to execute per pixel or
texture sample, so for performance these are now also exposed in the C API.

The C API for transforms will no longer be needed afer all changes, so remove
it to simplify the API and fallback implementation.

Ref D10271

Display Transforms
==================

Needs a bit more manual work constructing the transform. LegacyViewingPipeline
could also have been used, but isn't really any simpler and since it's legacy
we better not rely on it.

We moved more logic into the opencolorio module, to simplify the API. There is
no need to wrap a dozen functions just to be able to do this in C rather than C++.
It's also tightly coupled to the GPU shader logic, and so should be in the same
module.

Ref D10271

GPU Display Shader
==================

To avoid baking exposure and gamma into the GLSL shader and requiring slow
recompiles when tweaking, we manually apply them in the shader. This leads
to some logic duplicaton between the CPU and GPU display processor, but it
seems unavoidable.

Caching was also changed. Previously this was done both on the imbuf and
opencolorio module levels. Now it's all done in the opencolorio module by
simply matching color space names. We no longer use cacheIDs from OpenColorIO
since computing them is expensive, and they are unlikely to match now that
more is baked into the shader code.

Shaders can now use multiple 2D textures, 3D textures and uniforms, rather
than a single 3D texture. So allocating and binding those adds some code.

Color space conversions for blending with overlays is now hardcoded in the
shader. This was using harcoded numbers anyway, if this every becomes a
general OpenColorIO transform it can be changed, but for now there is no
point to add code complexity.

Ref D10273

CIE XYZ
=======

We need standard CIE XYZ values for rendering effects like blackbody emission.
The relation to the scene linear role is based on OpenColorIO configuration.

In OpenColorIO 2.0 configs roles can no longer have the same name as color
spaces, which means our XYZ role and colorspace in the configuration give an
error.

Instead use the new standard aces_interchange role, which relates scene linear
to a known scene referred color space. Compatibility with the old XYZ role is
preserved, if the configuration file has no conflicting names.

Also includes a non-functional change to the configuraton file to use an
XYZ-to-ACES matrix instead of REC709-to-ACES, makes debugging a little easier
since the matrix is the same one we have in the code now and that is also
found easily in the ACES specs.

Ref D10274
2021-02-12 19:06:35 +01:00
Campbell Barton 7952ed872a CMake: update python to 3.9.1
Default to Python version 3.9.

Reviewed By: LazyDodo, sybren, sebbas

Ref D10380
2021-02-12 07:50:01 +11:00
Campbell Barton faad487b58 Cleanup: remove version check for unsupported cmake version 2021-02-11 15:57:24 +11:00
Brecht Van Lommel 677e63d518 TBB: fix deprecation warnings with newer TBB versions
* USD and OpenVDB headers use deprecated TBB headers, suppress all deprecation
  warnings there since we have no control over them.
* For our own TBB includes, use the individual headers rather than the tbb.h that
  includes everything to avoid warnings, rather than suppressing all.

This is in anticipation of the TBB 2020 upgrade in D10359. Ref D10361.
2021-02-10 19:32:24 +01:00
Campbell Barton db9d40b9d3 CMake: set compiler-ccache & build-type-init variables as advanced
These settings aren't useful for basic configuration.
2021-02-10 17:44:14 +11:00
Sergey Sharybin 62ef35db6d Fix strict uninitialized warning for C++
Allows to compile Blender without uninitialized warning in Bullet code.
2021-02-08 11:10:21 +01:00
Ankit Meel 33b8063b1f CMake: Remove duplicated code for Haru-TIFF dependency. 2021-02-02 02:15:40 +05:30
Ankit Meel 59054d906f CMake/Windows/macOS: Add Libharu
Decision: https://lists.blender.org/pipermail/bf-committers/2020-December/050836.html
Adds CMake dependency builder support. Tested on
macOS and Windows (Thanks @LazyDodo).

Reviewed By: #platform_macos, LazyDodo, sebbas
Maniphest Task: T84836
Differential Revision: https://developer.blender.org/D9928
2021-02-01 21:58:57 +05:30
Brecht Van Lommel 31f568c336 Fix: incomplete integration of PugiXML and Potrace build options
Add them to the standard build configurations, disable properly when library
not found and print as part of configuration overview.
2021-01-26 15:55:27 +01:00
Charles Flèche 532d3a103a Cycles standalone: fix missing dependencies in CMake files
Also set default CYCLES_INSTALL_PATH to CMAKE_INSTALL_PREFIX.

By default with a `make cycles` this will build to ${CMAKE_BINARY_DIR}/bin

Differential Revision: https://developer.blender.org/D9961
2021-01-26 14:39:32 +01:00
Sybren A. Stüvel 54f8a5dd73 Tests: run suites instead of individual test cases
Group all tests of a test suite into a single test command invocation.
This reduces the number of invocations by `ctest` by an order of
magnitude.

Since rB56aa5b0d8c6b663, `bin/tests/blender_test` was run for every
individual test. Having over a 1000 tests made testing slower than
necessary. Individual tests can still be run if desired by invocation of
`bin/tests/blender_test --gtest_filter=suitename.testname`.

NOTE: For this commit to have an immediate effect, it may be necessary
to remove the `tests` and `Testing` directories and some CMake files
from your build directory and rebuild. Run `ctest -N` to see the list of
tests; there should be less than 200.

Reviewed By: sergey, LazyDodo, sebbas

Maniphest Tasks: T83222

Differential Revision: https://developer.blender.org/D9649
2021-01-11 11:29:30 +01:00
Matt Hill fdb7623e09 Unix/macOS: support building with Ccache
This adds an option (WITH_COMPILER_CCACHE) to build using Ccache if it's
found. Makefiles-based, Ninja-based and Xcode generators are supported.

Pass `-DWITH_COMPILER_CCACHE=ON` to cmake to enable Ccache.
Utility option in GNUmakefile is also added: for e.g.,
`make ninja ccache`.

Reviewed By: brecht, ankitm
Differential Revision: https://developer.blender.org/D9665
2020-12-21 10:47:35 +05:30
Bastien Montagne 010f44b855 Fix several issues with handling of numpy in CMake.
Issues were:
* Abusing of `WITH_PYTHON_INSTALL_NUMPY` by both Audaspace and
  Mantaflow.
    - `PYTHON_INSTALL` options only decide whether we copy python (and
      some extra modules) in our Blender installation. On linux it
      makes much more sense to use global python installation.
    - Now we have instead a proper `WITH_PYTHON_NUMPY`
* Bad assumptions regarding path of headers relative to path of python
  module.
    - In current Debian testing, modules are under `python3.9`
      directory, while headers are under `python3` directory.
    - Now we properly `find_path` for headers as well, modifying
      `find_python_package` to take an optional argument for headers.

Note that the required changes done to `extern` libraries are in
blender-specific files that do not exist upstream.

Differential Revision: https://developer.blender.org/D9773
2020-12-14 16:44:55 +01:00
Bastien Montagne 551856ed32 Revert "Fix several issues with handling of numpy in CMake."
This reverts commit 5d570c875e.

Buildbots are still borken, need more time to investigate.
2020-12-14 12:29:34 +01:00
Bastien Montagne fdc9350a9f Revert "Fix own error in rB5d570c875eda in CMake script."
This reverts commit 6da609fcb3.

Buildbots are still broken, need more time to investigate.
2020-12-14 12:29:08 +01:00
Bastien Montagne 6da609fcb3 Fix own error in rB5d570c875eda in CMake script.
My mistake, though CMake could handle default arguments but it needs to
be explicitly passed actually.
2020-12-14 12:23:21 +01:00
Bastien Montagne 5d570c875e Fix several issues with handling of numpy in CMake.
Issues were:
* Abusing of `WITH_PYTHON_INSTALL_NUMPY` by both Audaspace and
  Mantaflow.
    - `PYTHON_INSTALL` options only decide whether we copy python (and
      some extra modules) in our Blender installation. On linux it
      makes much more sense to use global python installation.
    - Now we have instead a proper `WITH_PYTHON_NUMPY`
* Bad assumptions regarding path of headers relative to path of python
  module.
    - In current Debian testing, modules are under `python3.9`
      directory, while headers are under `python3` directory.
    - Now we properly `find_path` for headers as well, modifying
      `find_python_package` to take an optional argument for headers.

Note that the required changes done to `extern` libraries are in
blender-specific files that do not exist upstream.

Differential Revision: https://developer.blender.org/D9773
2020-12-14 11:00:28 +01:00
Ray Molenkamp f637b47064 MSVC: Enable clang-tidy analyser
This enables the use of clang-tidy in the VS IDE.

To use it:

1 - Enable WITH_CLANG_TIDY in your cmake configuration
2 - From the Analyse pull down menu select Run Code Analysis on...

The analyser is currently not enabled by default on build
given it is quite slow and there are quite a few problems
it reports that we still need to deal with.
2020-12-03 11:00:58 -07:00
Sebastián Barschkis f8d1378b84 Deps: Additional changes for PugiXML on macOS
This commit expands the Windows-specific code in rBdca9aa0053f7 and Linux-specific code in rB33b7d53df08a.

It also fixes a capitalization issue in FindPugiXML.cmake
2020-12-02 15:18:05 +01:00
Ankit Meel da22ec1254 Cleanup: Fix CMake syntax error in the last commit. 2020-12-02 13:55:52 +05:30
Ankit Meel 6535135ef7 CMake/macOS: consider MinSizeRel too for ASan. 2020-12-02 13:23:25 +05:30
Sybren A. Stüvel 33b7d53df0 Deps: Add PugiXML as an official dependency
PugiXML was historically shipped hidden embedded into OIIO, the Grease
Pencil team had a requirement for an XML library recently so pugi seems
like a natural choice since it's not really a 'new' library, we just
turn an implicit dependency into an explicit one.

This commit expands the Windows-specific code in rBdca9aa0053f7 to
include Linux. macOS support will be handled in a later commit.

NOTE: run `cmake -U'*PUGIXML*' .` in the build directory to ensure CMake
finds PugiXML in the new location.

For details see D8628
2020-12-01 16:25:51 +01:00
Brecht Van Lommel dd391d38f6 Tests: add CMake option to run Cycles regression tests on GPU devices
CYCLES_TEST_DEVICES is a list of devices (CPU, CUDA, OPTIX, OPENCL). It is set
to CPU only by default.

Test output is now writen to build/tests/cycles/<device>, and the HTML report
has separate report pages for the different devices, with option to compare
between CPU and GPU renders.

Various GPU tests are still failing due to CPU/GPU differences, these are to be
fixed or blacklisted still.

Ref T82193
2020-11-30 13:40:33 +01:00
Ray Molenkamp dca9aa0053 Deps: PugiXML 1.10
This separates out PugiXML that was previously
bundled by OIIO.

As this linux/mac libs are not available
this commit only contains the builder and windows
changes, and the option to enable pugixml is
guarded by a platform if, this can be removed
once all platforms have committed the svn libs.

For details see D8628
2020-11-29 14:01:33 -07:00
Sergey Sharybin 7146e9696e CMake: Extend strict flags cancellation flags
Becomes rather annoying to duplicate them across C/C++ GCC/Clang sets,
almost as if the test should test both C and C++, and to do it for all
compilers.

Solves strict warning in the upstream of Ceres library.
2020-11-13 11:51:49 +01:00
Patrick Mours bd6bfba64d Cycles: Enable NanoVDB usage by default
As discussed during the Rendering Metting. Ref T81454.
2020-11-10 16:20:15 +01:00
Sergey Sharybin f26e267770 CMake: Extend supported strict flags cancelation for Clang 2020-11-09 12:12:00 +01:00
Ankit Meel 84bbdfb8af Cleanup: Fix the order of info_cfg_option. 2020-11-06 12:46:58 +05:30
Campbell Barton 2bd8f7e059 Cleanup: use string APPEND/PREPEND
Replace 'set' with 'string(APPEND/PREPEND ...)'.
This avoids duplicating the variable name.
2020-11-06 12:32:54 +11:00
Ankit Meel 0802e9cf54 Use compiler check for -fmacro-prefix-map
Use a more reliable method to check the availability of the flag than
compiler versions. Some compilers have different behaviors for
C and C++.

Reviewed By: campbellbarton, ChrisLend

Differential Revision: https://developer.blender.org/D9446
2020-11-04 21:00:29 +05:30
Campbell Barton 819a9622e9 CMake: remove -fmacro-prefix-map from build-info
Quotes caused build-info to fail,
remove these flags since they're not necessary.
2020-11-04 18:41:40 +11:00
Campbell Barton 72f8a08880 CMake: use path_ensure_trailing_slash for fmacro-prefix-map
Use the native system slash so this can work on windows.
2020-11-04 16:00:37 +11:00
Ankit Meel f2c7b4a1c5 Re-enable WITH_COMPILER_SHORT_FILE_MACRO, fix build error.
The issue was in `buildinfo.c`:
  char build_c[xx]flags[] = BUILD_C[XX]FLAGS;

Non-escaped double-quotes were terminating the string early, and
causing the compile error. So use single-quotes.
2020-11-02 16:11:10 +05:30
Ankit Meel 19dec6c8a7 Turn off WITH_COMPILER_SHORT_FILE_MACRO temporarily.
It's causing build errors on compilers that I don't have. Turn it off
while I fix them.

Added in {rB1daa3c3f0a1cfd74bef527e0207f38154e591d46}.
2020-11-02 15:45:59 +05:30
Ankit Meel 1daa3c3f0a Clang/GCC: use relative path in __FILE__ macro
This change removes the user-specific information from
macros like `__FILE__` and keeps it relative to top level
source or build (for generated files) directory.
It makes traces concise.

Added option `WITH_COMPILER_SHORT_FILE_MACRO` enabled by default.

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D9386
2020-11-02 15:12:10 +05:30
Nicholas Rishel cbc1c83154 Remove Wintab logging. 2020-10-30 16:29:04 -07:00
Nicholas Rishel a9d6eb8f0b Add Wintab debug logging as a CMake option WITH_WINTAB_DEBUG.
Signed-off-by: Nicholas Rishel <rishel.nick@gmail.com>
2020-10-30 16:29:04 -07:00
Alistair Sealy f52f51aef2 Cleanup: spelling in comments
Fixed a couple of typos in comments in CMakeLists.txt and GNUmakefile

Reviewed By: #platforms_builds_tests, mont29

Differential Revision: https://developer.blender.org/D9261
2020-10-19 09:27:32 +02:00
Patrick Mours 3bb3b26c8f Cycles: Add CUDA 11 build support
With this patch the build system checks whether the "CUDA10_NVCC_EXECUTABLE" CMake
variable is set and if so will use that to build sm_30 kernels. Similarily for sm_8x kernels it
checks "CUDA11_NVCC_EXECUTABLE". All other kernels are built using the default CUDA
toolkit. This makes it possible to use either the CUDA 10 or CUDA 11 toolkit by default and
only selectively use the other for the kernels where its a hard requirement.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D9179
2020-10-13 15:15:44 +02:00
Ankit Meel d7f482f88e CMake/macOS: Avoid passing compiler flags to try_compile.
`APPLE` platform handles ASan compiler and linker flags using
`add_compile_options` and `add_link_options`. {rB74bcb32c9f02}

Arguments in `CMAKE_{LANG}_FLAGS{_CONFIG}` are also passed to
`try_compile` which will fail due to linker errors, since link flags
are not set. `try_compile` is used by `find_package(Boost)` for
`thread` library.

See CMP0066 [1] also.

[1] https://cmake.org/cmake/help/latest/policy/CMP0066.html

Ref D8855
2020-10-08 19:50:43 +05:30
Patrick Mours 3df90de6c2 Cycles: Add NanoVDB support for rendering volumes
NanoVDB is a platform-independent sparse volume data structure that makes it possible to
use OpenVDB volumes on the GPU. This patch uses it for volume rendering in Cycles,
replacing the previous usage of dense 3D textures.

Since it has a big impact on memory usage and performance and changes the OpenVDB
branch used for the rest of Blender as well, this is not enabled by default yet, which will
happen only after 2.82 was branched off. To enable it, build both dependencies and Blender
itself with the "WITH_NANOVDB" CMake option.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D8794
2020-10-05 15:03:30 +02:00
Ankit Meel fdf77341cd CMake: Remove duplicate WITH_GMP options.
I didn't realize there were more duplicates while committing
{rBf1fee433be92}.

Original was added in {rB83f8223543f58c3b0881a03b6e9ddffff91}.
Duplicate was added in the merge {rB9e09b5c418c0a436e3c84ccf}.

Ref D8822
2020-09-26 23:13:07 +05:30
Ankit Meel 74bcb32c9f macOS: Remove ASan debug flags from release config.
Setting `PLATFORM_LINKLIBS` is not required for clang, compiler and
linker flags are enough. Note that the change made in
{rBa4c5811e2127}) to `platform_apple.cmake` (appending to
`PLATFORM_CFLAGS`) has not been reverted. platform file shouldn't be
overwriting the flags.

`PLATFORM_LINKFLAGS` is overwritten by `platform_apple.cmake`, so no
point in setting it. Fixing that like `PLATFORM_CFLAGS` is out of the
scope of this change.

`PLATFORM_LINKFLAGS_DEBUG` has been replaced with generator expression
to include RelWithDebInfo and MinSizeRel build types also.
2020-09-26 23:12:57 +05:30
Ray Molenkamp b21e2cfd03 CMake: Enable WITH_POTRACE by default
All platforms have landed the libs, this can be on
by default now.
2020-09-22 08:03:50 -06:00
Brecht Van Lommel f9fcb25d52 CMake: clean up setting of platform specific linker flags
Set flags directly on the target, and use common function for all cases.
This refactoring helps with the next commit for test executables.

Ref D8714
2020-09-17 12:29:19 +02:00
Ankit Meel a4c5811e21 ASan/macOS: fix incomplete C/CXX compiler flags.
While testing for {rB40dcf686f04f}, compiler flags got mixed up and
non-working ASan configuration was committed.

Platform file, which is `include`d after the `CMAKE_C_FLAGS_DEBUG` etc.,
are set, overwrites those flags instead of appending to them. To fix this,
`PLATFORM_CFLAGS` is used to pass the `-fsanitize=*` flags to the C/C++
compiler.

Tested on fresh build using both Xcode and Ninja, with & without ccache.

Also silence a clang warning for multi-config generators:
the object size sanitizer has no effect at -O0, but is explicitly
enabled: -fsanitize=object-size [-Winvalid-command-line-argument]

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D8879
2020-09-16 02:18:59 +05:30
Ray Molenkamp 2eec6ec793 Deps: Add potrace as a new library dependency
For work the GP team plans to land soon (T79877) potrace was taken
on as an additional optional dependency.

This diff adds building the library to the deps builder and takes
care of the integration into the build-system with the `WITH_POTRACE`
cmake switch.

Differential Revision: https://developer.blender.org/D8662

Reviewed by: brecht, sergey
2020-09-15 13:16:37 -06:00
Ray Molenkamp 1509d2ba7d Cleanup: Fix whitespace changes
Introduced in rB40dcf686f04f7db8110f9c85621eb8a0bd764080
2020-09-12 16:06:24 -06:00
Dalai Felinto 5c0eda51ff CMake: Force experimental features to be on/off based on release cycle
This makes it error-proof to disable/enable experimental features
during the release cycles. Since it is handled by CMake it should always
work reliably now (not depending on someone turning this on and off).

Reviewed by Sergey Sharybin.
2020-09-09 16:15:27 +02:00
Ankit 6aaa6c96a1 Tests: set build directory using build type
Similar to {rB0a5f7061369d53b4eac55362ad2}
but also for Xcode and Ninja multi-config.

This silences 44 pairs of warnings like:

/bin/rm -f build_full/bin/tests/BLI_ghash_performance_test
"build_full/CMakeScripts/XCODE_DEPEND_HELPER.make:42: warning:
ignoring old commands for target
`build_full/bin/tests/BLI_ghash_performance_test'"

/bin/rm -f build_full/bin/tests/BLI_ghash_performance_test
"build_full/CMakeScripts/XCODE_DEPEND_HELPER.make:3523: warning:
overriding commands for target
`build_full/bin/tests/BLI_ghash_performance_test'"

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D8815
2020-09-08 00:23:48 +05:30
Ankit 40dcf686f0 Support ASan library on macOS for all generators.
This change allows macOS developers to use
`WITH_COMPILER_ASAN` with every generator.

`CMAKE_C_IMPLICIT_LINK_DIRECTORIES` on macOS points to
`Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/lib`
which is not where the Sanitizer libraries are.

To link the library, rpath could be used but that seems complex,
so linker flags are passed as the documentation says. [1]

If users have `ASAN_OPTIONS=detect_leaks=1` in their environment
variables, it should be removed to avoid a feature-unsupported error
while compiling.

[1]: http://clang.llvm.org/docs/AddressSanitizer.html#usage

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D8817
2020-09-08 00:19:07 +05:30
Howard Trickey 9e09b5c418 Merge newboolean branch into master.
This is for design task T67744, Boolean Redesign.
It adds a choice of solver to the Boolean modifier and the
Intersect (Boolean) and Intersect (Knife) tools.
The 'Fast' choice is the current Bmesh boolean.
The new 'Exact' choice is a more advanced algorithm that supports
overlapping geometry and uses more robust calculations, but is
slower than the Fast choice.
The default with this commit is set to 'Exact'. We can decide before
the 2.91 release whether or not this is the right choice, but this
choice now will get us more testing and feedback on the new code.
2020-08-28 11:01:06 -04:00
Ray Molenkamp 8b82693898 MSVC: Set proper flags for C++17 support.
MSVC already builds with the /std:c++17 flag but for
'reasons' [1] MSVC still gives the wrong value for the
__cplusplus define.

This change sets an additional cxx flag on supported
compilers to allow the compiler properly identify
C++17 support.

This resolves 2 warnings coming out of bullet about
the register keyword being deprecated.

[1] https://devblogs.microsoft.com/cppblog/msvc-now-correctly-reports-__cplusplus/
2020-08-26 22:25:40 -06:00
Ray Molenkamp 010c1370af CMake: Fix policy warning about OSL_ROOT being set.
When the OSL_ROOT variable is set this is ignored
by findpackage on cmake < 3.12. CMake 3.12 and up
also  ignore it and warn about it. This change
tells cmake it is OK to use the variable and
stop warning
2020-08-22 16:24:09 -06:00
Dalai Felinto 90ee622830 Turn experimental features ON for master
During alpha the user preferences > experimental featuers are available
to prevent merge issues and allow developers to seek feedback.

This needs to be manually turned off when we branch for beta, otherwise
the RNA of the incomplete features will be exposed.
2020-08-19 10:23:21 +02:00
Dalai Felinto ffb8fca751 Revert "Turn experimental features on for master (alpha)"
I turned on the wrong feature in cmake.
This reverts commit bdf43213b2.
2020-08-19 10:22:00 +02:00
Dalai Felinto bdf43213b2 Turn experimental features on for master (alpha)
Remember to turn this off again when we branch out for the next beta (2.91)
2020-08-18 14:56:22 +02:00
Dalai Felinto 8ab0d0e399 Merge remote-tracking branch 'origin/blender-v2.90-release' 2020-08-18 14:55:44 +02:00
Dalai Felinto 83e3d25bca Remove (ifdef) RNA for simulation, point cloud and particles
For 2.90 release this should not be exposed in the RNA API.

In master this needs to be ON by default, that's all.

Differential Revision: https://developer.blender.org/D8589
2020-08-18 14:41:16 +02:00
Ray Molenkamp 83f8223543 Deps builder: Add support for building GMP
Required for the new boolean code, disabled by default
until all platforms have landed the libs and the boolean
code actually lands in master.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D8384
2020-07-31 09:34:26 -06:00
Sybren A. Stüvel 76d489fe23 Bump minimum CMake version to 3.10
This bumps the minimally required CMake version from 3.5 to 3.10, as
discussed in D8405.

Since D7649 landed, there has been the `gtest_discover_tests()` call to
discover individual unit tests in `bin/tests/blender_test`. This
function was introduced in CMake 3.10.

Since there were no complaints about this incompatibility, I suspect
that a newer version is already in use by the majority of the
Blender-building people.
2020-07-28 14:17:13 +02:00
Patrick Mours a9644c812f Cycles: Use pre-compiled PTX kernel for older generation when no matching one is found
This patch changes the discovery of pre-compiled kernels, to look for any PTX, even if
it does not match the current architecture version exactly. It works because the driver can
JIT-compile PTX generated for architectures less than or equal to the current one.
This e.g. makes it possible to render on a new GPU architecture even if no pre-compiled
binary kernel was distributed for it as part of the Blender installation.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D8332
2020-07-20 19:25:27 +02:00
Sybren A. Stüvel 56aa5b0d8c T73268: Link C/C++ unit tests into single executable
This commit introduces a new way to build unit tests. It is now possible
for each module to generate its own test library. The tests in these
libraries are then bundled into a single executable.

The test executable can be run with `ctest`. Even though the tests
reside in a single executable, they are still exposed as individual
tests to `ctest`, and thus can be selected via its `-R` argument.

Not yet ported tests still build & run as before.

The following rules apply:

- Test code should reside in the same directory as the code under test.
- Tests that target functionality in `somefile.{c,cc}` should reside in
  `somefile_test.cc`.
- The namespace for tests is the `tests` sub-namespace of the code under
  test. For example, tests for `blender::bke` should be in
  `blender::bke:tests`.
- The test files should be listed in the module's `CMakeLists.txt` in a
  `blender_add_test_lib()` call. See the `blenkernel` module for an
  example.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D7649
2020-07-16 12:58:49 +02:00
Stefan Werner 9715ad5aca macOS: Support arm64 architecture.
Enabling all `make deps` dependencies with the exception of Embree and OIDN.
After that, Blender can be compiled on an Apple Silicon Mac just like on any
Intel based Mac. There are still compiler warnings that need to be
investigated and there are probably a couple of bug still to be discovered
and to be fixed.

Most patches to the dependencies are simple and are about disabling SSE and
setting the proper architecture to compiile for. Notable exception is Python,
where I back ported a yet to be accepted PR for upstream Python:
https://github.com/python/cpython/pull/21249

Cross compiling or buliding a Universal Binary is not supported yet.
The minimum macOS target version for x86_64 remains at 10.13, the target
for arm64 is 11.00.

Differential Revision: https://developer.blender.org/D8236
2020-07-16 09:37:38 +02:00
Jacques Lucke 91c763af3e Cleanup: typo 2020-07-13 10:34:44 +02:00
Sergey Sharybin 9ea5469178 Initial support of clang-tidy toolchain
Clang Tidy is a Clang based "linter" tool which goal is to help
fixing typical programming errors.

It is run as a separate compile step of every file, which slows
compilation down but allows to fully analyze the file the same
way as compiler does and catch non-trivial bugprone cases.

This change includes:

- CMake option called `WITH_CLANG_TIDY` which enables Clang Tidy
  linter tool on all source in the `source/` directory.

  This option is only available on Linux, as it is currently the
  easiest platform to get the Clang Tidy toolchain to work.

- CMake module which is aimed to find latest available Clang Tidy.

- Set of rules which allows to have Blender fully compiled without
  extra issues.

The goal of this change is to provide a base ground so that solving
all the warnings can happen later on, as a team effort.

It should be possible to use Clang Tidy side-by-side with both GCC
and Clang, but there seems to be some tweaks to be done in CMake to
make it really work for Blender. For now use Clang toolchain if
there are issues with GCC+Clang Tidy.

It will be worked on in the nearest future to bring seamless
experience for all configurations.

Currently there is no official way of getting Clang Tidy on macOS,
and on Windows there are some difficulties of hooking up Clang Tidy
from LLVM package to the MSVC compiler toolchain.

The actual warnings in the code will be addressed as a part of the
Code Quality Days, task T78535.

Differential Revision: https://developer.blender.org/D7937
2020-07-03 09:57:41 +02:00
Jacques Lucke 87ceff3d1b Preferences: New experimental settings for particle system and hair
This replaces the cmake options `WITH_NEW_OBJECT_TYPES` and
`WITH_NEW_SIMULATION_TYPE` with two experimental userpref settings:

* `use_new_particle_system`: Enables the point cloud type and the simulation editor.
* `use_new_hair_type`: Only displays the add-operator in the add menu for now.

Note, in the current state you can't do anything productive with the new particle
system or the new hair type. Features will be added step by step in the upcoming
weeks and months.

Reviewers: brecht

Differential Revision: https://developer.blender.org/D8096
2020-06-23 11:30:46 +02:00
Brecht Van Lommel 99436acde8 Cycles: enable Embree by default for CPU rendering
For GPU debugging purposes, it is still possible to render with the same BVH2
on the CPU using the Debug panel in the render properties.

Note that building Blender without Embree will now lead to significantly reduced
performance in CPU rendering, and a few of the Cycles regression tests will fail
due to small pixel differences.

Ref T73778

Depends on D8014

Maniphest Tasks: T73778

Differential Revision: https://developer.blender.org/D8015
2020-06-22 13:28:01 +02:00
Brecht Van Lommel d8c2092b15 Cycles: make TBB a required library dependency, and use in a few places
Now that the rest of Blender also relies on TBB, no point in maintaining custom
code for paraller_for and thread local storage.
2020-06-22 13:06:47 +02:00
Sergey Sharybin 90010c3e04 CMake: Correct warning about which C++ version is required
Was only happening on unsupported compilers.
2020-06-19 14:44:03 +02:00
Sergey Sharybin e9a7f4d389 Upgrade C++ standard to C++17
Ref T76783
2020-06-19 12:02:21 +02:00
Sergey Sharybin 31ae833811 Ceres: Update to the latest upstream version
Using latest master because of various compilation error fixes.

Brings a lot of recent development. From most interesting parts:

- New threading model.
- Tiny solver.
- Compatibility with C++17.
2020-06-19 12:02:21 +02:00
Sergey Sharybin 171c4fb238 Update C++ standard to C++14
This is an intermittent state to get all dependencies to compile.

For example, the latest Ceres is needed to bring C++17 support,
but it has bumped minimal requirement to C++14.
2020-06-19 12:02:21 +02:00
Sybren A. Stüvel 0102b9d47e Alembic: remove HDF5 support from CMake files
This is a follup to 0c38436227.

No functional changes to Blender, just the build scripts.
2020-06-15 11:58:58 +02:00
Campbell Barton 5a842b3412 Merge branch 'blender-v2.83-release' 2020-05-25 15:55:54 +10:00
Campbell Barton c15bb3b55f Fix T77031: Blender as pymodule crashes when rendering
No longer enforce WITH_HEADLESS when building as a Python module
as it disables GPU access which is needed for rendering.
2020-05-25 15:53:43 +10:00
Philipp Oeser 325307d82b Merge branch 'blender-v2.83-release' 2020-05-19 13:59:39 +02:00
Sybren A. Stüvel f89b89fa7f CMake: Enable WITH_USD by default
Having USD disabled by default was an oversight, and could have been
corrected earlier. It's already enabled by default in the
`blender_release.cmake` and `blender_full.cmake`.
2020-05-19 09:39:51 +02:00
Brecht Van Lommel c54ced9f55 Build: print TBB ON/OFF state on first configure, cleanup old TBB logic 2020-05-05 14:06:08 +02:00