Commit Graph

1456 Commits

Author SHA1 Message Date
Jörg Müller
68af6f6836 Audaspace: porting changes from upstream. 2023-04-08 10:36:40 +02:00
Ali-Erdinc-Koroglu
18ad154cf9 Fix CUdeviceptr and hipDeviceptr_t build error on ppc64le architecture
Pull Request: https://projects.blender.org/blender/blender/pulls/106575
2023-04-05 17:42:01 +02:00
Aras Pranckevicius
e1426e6319 Externals/IO: update fast_float.h to latest version
fast_float.h currently is only used by OBJ, STL and PLY I/O importers.
Update it to the latest release from upstream (from 3.4.0 2020 Nov to
4.0.0 2023 Mar).

No behavior changes, but they have optimized the performance a bit.
Importing a 6-level subdivided Suzanne OBJ file (330MB) goes from 3.5sec
down to 3.2sec on Win10, Ryzen 5950X, VS2022 build.
2023-03-31 11:03:13 +03:00
Sergey Sharybin
a12a8a71bb Remove "All Rights Reserved" from Blender Foundation copyright code
The goal is to solve confusion of the "All rights reserved" for licensing
code under an open-source license.

The phrase "All rights reserved" comes from a historical convention that
required this phrase for the copyright protection to apply. This convention
is no longer relevant.

However, even though the phrase has no meaning in establishing the copyright
it has not lost meaning in terms of licensing.

This change makes it so code under the Blender Foundation copyright does
not use "all rights reserved". This is also how the GPL license itself
states how to apply it to the source code:

    <one line to give the program's name and a brief idea of what it does.>
    Copyright (C) <year>  <name of author>

    This program is free software ...

This change does not change copyright notice in cases when the copyright
is dual (BF and an author), or just an author of the code. It also does
mot change copyright which is inherited from NaN Holding BV as it needs
some further investigation about what is the proper way to handle it.
2023-03-30 10:51:59 +02:00
Jacques Lucke
a58c951c98 Merge branch 'blender-v3.5-release' 2023-03-28 14:30:12 +02:00
Jacques Lucke
45c16f43ad Fix #105953: division by zero in quadriflow leads to crash
The bug was found by ASAN when running the file from #105953. It's not
entirely clear what the root issue for the division by zero is, but
at least now the result is more predictable.

Pull Request: https://projects.blender.org/blender/blender/pulls/106165
2023-03-28 14:25:19 +02:00
Bastien Montagne
fea567651b Fix building Blender with some versions of gcc.
Seems like quadriflow was missing a header, which somehow made the build
fails on Suse Tumbleweed (gcc 13).
2023-03-27 18:29:39 +02:00
Jeroen Bakker
fda65ad5ca GPU: Renderdoc Frame Capturing
This PR uses renderdoc for frame capturing when enabled.
It enabled an easier workflow for frame capturing.

- Capture GPU API calls from test cases
- Capture GPU API calls from background threads
- Capture GPU API calls from background rendering.

Renderdoc is an important GPU debugger used by the Eevee/
Viewport module. Previously we needed to change code in
order to record background rendering, that could on its own
lead to other side-effects.

The integration with renderdoc can be enabled using
`WITH_RENDERDOC=On` compiler option. `GPU_debug_capture_begin`
and `GPU_debug_capture_end` can be added to the section
of the code you want to debug. When running Blender inside
renderdoc this part will automatically be captured.

All GPU test cases are now guarded by these calls. In order
to capture the test cases you need to start the test cases
from renderdoc and the captured GPU API calls will appear
where each capture is a single test case.

Pull Request: https://projects.blender.org/blender/blender/pulls/105921
2023-03-23 16:37:52 +01:00
Shane Ambler
0e6cc4f86a Build: changes needed to build on FreeBSD
* Fix SDL not finding Xlib.h
* Link to clangSupport library for newer LLVM versions
* Add FreeBSD essential symbols to symbols_unix.map

Pull Request: https://projects.blender.org/blender/blender/pulls/105892
2023-03-22 14:15:46 +01:00
Julian Squires
466eb426ed Extern: Update TinyGLTF to include fix for CVE-2022-3008
The use of wordexp(3) permits arbitrary code execution from manually-crafted
glTF files. See https://github.com/syoyo/tinygltf/issues/368 for more details.
In practice this shouldn't be an issue for Blender since the GlTF data isn't
manually crafted but from the OpenXR runtime (a bit like a driver). But
updating the library to include the fix is not a big deal anyway.

Note that the warning that required the local modification is no longer present upstream since
  0bfcb4f49e

Pull Request: https://projects.blender.org/blender/blender/pulls/105536
2023-03-10 14:56:35 +01:00
Brecht Van Lommel
cb5318b651 Docs: change Git URLs to point projects.blender.org instead of git.blender.org 2023-02-07 14:23:05 +01:00
Jeroen Bakker
199233eee1 Cleanup: Change VMA from CRLF to LF.
To match the rest of our repository.
2023-02-02 08:23:54 +01:00
Jeroen Bakker
5d9971bc63 Vulkan: Fix compilation warning in VMA. 2023-02-02 08:19:17 +01:00
Jeroen Bakker
a36c1cabce Vulkan: Changes to CMake config.
Paths to vulkan libraries, paths and related components were
hardcoded in the platform cmake file. This patch separates
this by using adding CMake modules for Vulkan and ShaderC.

This change has only been applied to the macOs configuration as
that is currently our main platform for development. Other platforms
will be added during the development of the Vulkan back-end.
2023-01-30 12:04:44 +01:00
Campbell Barton
66dee44088 CMake: quiet references to undeclared variable warnings
These warnings can reveal errors in logic, so quiet them by checking
if the features are enabled before using variables or by assigning
empty strings in some cases.

- Check CMAKE_THREAD_LIBS_INIT is set before use as CMake docs
  note that this may be left unset if it's not needed.
- Remove BOOST/OPENVDB/VULKAN references when disable.
- Define INC_SYS even when empty.
- Remove PNG_INC from freetype (not defined anywhere).
2023-01-19 17:10:42 +11:00
Jörg Müller
cc332264ae Audaspace: porting changes from upstream. 2023-01-14 22:18:39 +01:00
Ray Molenkamp
388bbc3290 Build: library updates for Blender 3.5
This updates the libraries dependencies for VFX platform 2023, and adds various
new libraries. It also enables Python bindings and switches from static to
shared for various libraries.

The precompiled libraries for all platforms will be updated to these new
versions in the coming weeks.

New:

Fribidi 1.0.12
Harfbuzz 5.1.0
MaterialX 1.38.6 (shared lib with python bindings)
Minizipng 3.0.7
Pybind11 2.10.1
Shaderc 2022.3
Vulkan 1.2.198

Updated:

Boost 1.8.0 (shared lib)
Cython 0.29.30
Numpy 1.23.2
OpenColorIO 2.2.0 (shared lib with python bindings)
OpenImageIO 2.4.6.0 (shared lib with python bindings)
OpenSubdiv 3.5.0
OpenVDB 10.0.0 (shared lib with python bindings)
OSL 1.12.7.1 (enable nvptx backend)
TBB (shared lib)
USD 22.11 (shared lib with python bindings, enable hydra)
yaml-cpp 0.8.0

Includes contributions by Ray Molenkamp, Brecht Van Lommel, Georgiy Markelov
and Campbell Barton.

Ref T99618
2022-12-07 15:28:17 +01:00
Jeroen Bakker
a819523dff Vulkan: Add VK memory allocator 3.0.1 to extern.
Vulkan doesn't have a memory allocator builtin. The application should
provide the memory allocator at runtime. Vulkan Memory Allocator is a
widely used implementation.

Vulkan Memory Allocator is a header only implementation, but the using
application should compile a part in a CPP compile unit. The file
`vk_mem_alloc_impl.cc` and `extern_vulkan_memory_allocator` library
is therefore introduced.

Reviewed By: fclem

Differential Revision: https://developer.blender.org/D16572
2022-11-23 14:42:27 +01:00
Ray Molenkamp
7c1ab77fa6 audaspace: Fix build error with MSVC 17.4+
`DeviceManager.h` uses `std::string` without explicitly including
the `<string>` header. While older MSVC implicitly included this
header somewhere, the headers for 17.4+ do not leading to a build
error.
2022-11-09 14:39:15 -07:00
Campbell Barton
6377d00a61 Cleanup: cmake comment line length 2022-11-03 12:11:08 +11:00
Brecht Van Lommel
f66236a827 Fix T102018: find HIP library also in system library paths on Linux
Previously it would use a hardcoded location where the AMD driver installs it,
but Linux distributions may use other locations. Now look for both cases.
2022-11-01 18:36:45 +01: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
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
Jörg Müller
e4fd2d5754 Fix T99812: Audio scrubbing freezes Blender 3.2.1
Bug was caused by a change in ffmpeg's API.
2022-08-02 20:17:46 +02:00
Campbell Barton
bdb4ebebf1 Cleanup: quiet GCC cast-function-type warnings for gflags 2022-07-26 14:47:12 +10:00
Jörg Müller
d136a996ca Audaspace: minor formatting fix for last commit. 2022-07-16 22:20:08 +02:00
Colin Basnett
1e4c557d82 Fix T99039: bpy.ops.sound.mixdown returns indecipherable error
Fix for {T99039}.

The problem was that `AUD_mixdown` and `AUD_mixdown_per_channel` were returning pointers to freed memory.

Two key changes are made:
1. The return value of those functions now simply return a bool as to whether the operation succeeded, instead of an optional error string pointer.
2. The error string buffer is now passed into the function to be filled in case an error occurs. In this way, the onus of memory ownership is unamibiguously on the caller.

Differential Revision: https://developer.blender.org/D15260
2022-07-16 22:14:19 +02:00
Campbell Barton
6777c420db Mantaflow: call MANTA::terminateMantaflow on exit
terminateMantaflow was never called, this leak is more of a technicality
since it's only called on exit.

Also make Py_Initialize/Py_Finalize optional in Pd:setup/finalize
as it caused Blender to crash, finalizing Python twice.

Add a patch to extern/mantaflow to keep track of changes in Blender
from up-stream.
2022-06-29 10:11:01 +10:00
Campbell Barton
d94d7a5d8f Cleanup: update curve_fit_nd (no functional changes) 2022-06-29 09:55:44 +10:00
Campbell Barton
ad8add5f0c Fix T98427: Crash adding quick effects smoke from Python
Manta flow used the `__main__` namespace which it was executed in,
this caused a bug when calculating fluid from Python, which clears
it's `__main__` name-space after execution.
This caused Manta-flows name space to be cleared too.

Resolve this by creating a separate name-space for manta-flow.

Reviewed by: SonnyCampbell_Unity

Ref D15269
2022-06-24 23:28:55 +10:00
Jörg Müller
41a0411d79 Fix T99083: audio bad in command-line video player (blender -a)
There was a wrong sample size computation in PulseAudioDevice.
The sample format is switched to float32 for the command-line player.
2022-06-23 21:32:34 +02:00
Jim Eckerlein
33bad77043 Draco: update to version 1.5.2
Differential Revision: https://developer.blender.org/D15233
2022-06-17 19:40:01 +02:00
Campbell Barton
42a6c226d0 CMake: fix AUDASPACE disabling WITH_PYTHON for Blender
When AUDASPACE couldn't find NUMPY, it would disable WITH_PYTHON for
the rest of Blender. Now setting the value globally is only done for
standalone AUDASPACE builds. Now it's possible to build Blender with
AUDASPACE & PYTHON but without NUMPY.

While this isn't an especially important configuration to support,
having Python mysteriously disabled is a hassle to troubleshoot.

NOTE: extern/audaspace/CMakeLists.txt has become out sync with the
original [0], it seems this is being maintained in our repository.

[0]: https://github.com/neXyon/audaspace/blob/master/CMakeLists.txt
2022-05-20 11:18:49 +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
Jörg Müller
ac8beb4fda Fix T97453: Blender crash when selecting Caching checkbox in VSE
Merge Audaspace fixes from upstream.
2022-04-22 22:36:04 +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
Aras Pranckevicius
213cd39b6d OBJ: further optimize, cleanup and harden the new C++ importer
Continued improvements to the new C++ based OBJ importer.

Performance: about 2x faster.
- Rungholt.obj (several meshes, 263MB file): Windows 12.7s -> 5.9s, Mac 7.7s -> 3.1s.
- Blender 3.0 splash (24k meshes, 2.4GB file): Windows 97.3s -> 53.6s, Mac 137.3s -> 80.0s.
- "Windows" is VS2022, AMD Ryzen 5950X (32 threads), "Mac" is Xcode/clang 13, M1Max (10 threads).
- Slightly reduced memory usage during import as well.

The performance gains are a combination of several things:
- Replacing `std::stof` / `std::stoi` with C++17 `from_chars`.
- Stop reading input file char-by-char using `std::getline`, and instead read in 64kb chunks, and parse from there (taking care of possibly handling lines split mid-way due to chunk boundaries).
- Removing abstractions for splitting a line by some char,
- Avoid tiny memory allocations: instead of storing a vector of polygon corners in each face, store all the corners in one big array, and per-face only store indices "where do corners start, and how many". Likewise, don't store full string names of material/group names for each face; only store indices into overall material/group names arrays.
- Stop always doing mesh validation, which is slow. Do it just like the Alembic importer does: only do validation if found some invalid faces during import, or if requested by the user via an import setting checkbox (which defaults to off).
- Stop doing "collection sync" for each object being added; instead do the collection sync right after creating all the objects.

Cleanup / Robustness:

This reworking of parser (see "removing abstractions" point above) means that all the functions that were in `parser_string_utils` file are gone, and replaced with different set of functions. However they are not OBJ specific, so as pointed out during review of the previous differential, they are now in `source/blender/io/common` library.

Added gtest coverage for said functions as well; something that was only indirectly covered by obj tests previously.

Rework of some bits of parsing made the parser actually better able to deal with invalid syntax. E.g. previously, if a face corner were a `/123` string, it would have incorrectly treated that as a vertex index (since it would get "hey that's one number" after splitting a string by a slash), instead of properly marking it as invalid syntax.

Added gtest coverage for .mtl parsing; something that was not covered by any tests at all previously.

Reviewed By: Howard Trickey
Differential Revision: https://developer.blender.org/D14586
2022-04-17 22:07:43 +03:00
Aras Pranckevicius
e2e4c1daaa OBJ: use fmt library instead of sprintf for faster formatting
On Windows/MSVC this gives a minor (~20%) speedup presumably due to a faster float/int formatter. On macOS (Xcode13), this gives a massive speedup, since snprintf that is in system libraries ends up spending almost all the time inside some locale-related mutex lock.

The actual exporter code becomes quite a bit smaller too, since it does not have to do any juggling to support std::string arguments, and the buffer handling code is smaller as well.

Windows (VS2022 release build, Ryzen 5950X 32 threads) timings:
- Blender 3.0 splash scene (2.4GB obj): 4.57s -> 3.86s
- Monkey subdivided level 6 (330MB obj): 1.10s -> 0.99s

macOS (Xcode 13 release build, Apple M1Max) timings:
- Blender 3.0 splash scene (2.4GB obj): 21.03s -> 5.52s
- Monkey subdivided level 6 (330MB obj): 3.28s -> 1.20s

Linux (ThreadRipper 3960X 48 threads) timings:
- Blender 3.0 splash scene (2.4GB obj): 10.10s -> 4.40s
- Monkey subdivided level 6 (330MB obj): 2.16s -> 1.37s

The produced obj/mtl files are identical to before.

Reviewed By: Howard Trickey, Dalai Felinto

Differential Revision: https://developer.blender.org/D13998
2022-03-27 14:25:48 +03:00
Sebastian Parborg
c2016feadc Merge branch 'blender-v3.1-release' 2022-02-18 18:25:31 +01:00
Sebastian Parborg
af6a1b08e3 VSE: Refactor our code to be compatible with ffmpeg 5.0
In ffmpeg 5.0, several variables were made const to try to prevent bad API usage.
Removed some dead code that wasn't used anymore as well.

Reviewed By: Richard Antalik

Differential Revision: http://developer.blender.org/D14063
2022-02-18 18:24:16 +01:00
Jörg Müller
4782713390 Fix T94994: Anim Player Stops working In Video Sequence Editor
Port from upstream: variable was unitialized when device initialization
failed when the WASAPI mixing thread is started.
2022-02-15 20:04:42 +01:00
Campbell Barton
1df8a5f8fb File headers: use SPDX license for CMake files 2022-02-11 14:23:56 +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
Campbell Barton
ebd0e76088 Cleanup: indentation for CMake files
Also minor white-space & case changes.
2022-01-28 14:52:47 +11:00
Jörg Müller
2a095d8bfe Audaspace: port bugfixes from upstream.
Windows audio backend (WASAPI) now automatically switches to
the selected audio device in windows.
2022-01-14 22:51:35 +01:00
Clément Foucault
fb6bd88644 Revert "BLI: Refactor vector types & functions to use templates"
Includes unwanted changes

This reverts commit 46e049d0ce2bce2f53ddc41a0dbbea2969d00a5d.
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 a2c1c368af48644fa8995ecbe7138cc0d7900c30.
2022-01-12 12:44:26 +01:00