Commit Graph

1580 Commits

Author SHA1 Message Date
bsavery
d19ad12b45 Cycles: add support for AMD RDNA3 APUs
Pull Request: https://projects.blender.org/blender/blender/pulls/113696
2023-10-19 18:03:31 +02:00
Bastien Montagne
ab91c18995 Fix linking errors when doing full debug build with ASAN: Disable ASAN for extern.
With current main code, trying to build a full debug build with ASAN
enabled will fail at linking, due to out-of-bound memory references
within the binary file, e.g.:

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

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

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

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

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

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

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

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

**What is known to not work?**

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

**A word about performance**

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

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

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

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

**How can the backend be enabled?**

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Design task: #110784

Ref !110783.
2023-08-16 00:20:26 +10:00
Campbell Barton
87c61f2354 CMake: add warning for WITH_UNITY_BUILD 2023-08-11 09:34:07 +10:00
Campbell Barton
735273f537 CMake: show WITH_HYDRA on first installation
Also disable OSL for lite builds, only makes a difference when cycles is
enabled for lite builds.
2023-08-10 12:37:54 +10:00
Campbell Barton
9dfb3fc550 CMake: refactor flag checking function to take multiple argument pairs
Many calls to add_check_c_compiler_flag add_check_cxx_compiler_flag
resulted in over long lines & visual noise. Replace with a function that
takes multiple (cache_var flag) pairs to reduce duplication.
2023-08-10 11:28:22 +10:00
Campbell Barton
648dd6a5f7 CMake: wrap long lines, especially option descriptions
Wrap text to fit in the column width and encourage descriptive text.
2023-08-10 00:54:12 +10:00
Campbell Barton
22d23a7269 CMake: add missing default for WITH_SYSTEM_BULLET 2023-08-10 00:08:54 +10:00
Bogdan Nagirniak
04bb5f9995 Render: support USD Hydra render delegates
Hydra is a rendering architecture part of USD, designed to abstract the
host application from the renderer. A renderer implementing a Hydra
render delegate can run in any host application supporting Hydra, which
now includes Blender.

For external renderers this means less code to be written, and improved
performance due to a using a C++ API instead of a Python API.

Add-ons need to subclass bpy.types.HydraRenderEngine. See the example in
the Python API docs for details.

An add-on for Hydra Storm will be included as well. This is USD's
rasterizing renderer, used in other applications like usdview. For users
it can provide a preview of USD file export, and for developers it
serves a reference.

There are still limitations and missing features, especially around
materials. The remaining to do items are tracked in #110765.

This feature was contributed by AMD.

Ref #110765

Co-authored-by: Georgiy Markelov <georgiy.m.markelov@gmail.com>
Co-authored-by: Vasyl-Pidhirskyi <vpidhirskyi@gmail.com>
Co-authored-by: Brian Savery <brian.savery@gmail.com>
Co-authored-by: Brecht Van Lommel <brecht@blender.org>

Pull Request: https://projects.blender.org/blender/blender/pulls/104712
2023-08-04 17:01:09 +02:00
Bogdan Nagirniak
61f407d427 Build: install USD Storm and MaterialX libraries by default
* Bundle hdStorm and associated plugins
* Enable WITH_MATERIALX by default to bundle MaterialX libraries
* Set PXR_MTLX_STDLIB_SEARCH_PATHS so Storm can find MaterialX files

Co-authored-by: Georgiy Markelov <georgiy.m.markelov@gmail.com>
Co-authored-by: Brecht Van Lommel <brecht@blender.org>

Ref #110765, #104712
2023-08-04 17:01:09 +02:00
Brecht Van Lommel
a1eff7d0c0 macOS: remove note about sold linker, mold 2.0 is now free on macOS 2023-08-01 15:43:11 +02:00
Campbell Barton
ed01e16aa6 Cleanup: quiet uninitialized warnings 2023-07-29 13:47:57 +10:00
Clément Foucault
cdb8a8929c GHOST: Delete Mac OpenGL support
The maximum OpenGL versions supported on mac
doesn't meet the minimum required version (>=4.3) anymore.

This removes all the OpenGL paths in GHOST
Cocoa backend and from the drop down menu in
the user preferences.

Pull Request: https://projects.blender.org/blender/blender/pulls/110185
2023-07-19 14:16:03 +02:00
Clément Foucault
1978b4fc92 GHOST: Replace WITH_OPENGL build option
Replaces it by WITH_OPENGL_BACKEND and cleanup its usage.
Limits visibility of opengl enums and cases.

Pull Request: https://projects.blender.org/blender/blender/pulls/109947
2023-07-11 09:17:31 +02:00
Campbell Barton
4da96623ff CMake: use mark_as_advancd for most non WITH_* options
Avoid showing many obscure CMake options by default.
2023-07-10 12:02:15 +10:00
Sergey Sharybin
b3cd646a15 CMake: Enable unused-parameter warning for Clang C++
Was already done for C, but not for C++.

Pull Request: https://projects.blender.org/blender/blender/pulls/109724
2023-07-05 09:25:51 +02:00
Sergey Sharybin
7651885a9c Fix copy-paste error in CFlags for Clang
Was harmless, as both C and C++ support this flag.
2023-07-05 09:20:26 +02:00
Ray Molenkamp
39b3a95efb CMake: Enable CMAKE_OPTIMIZE_DEPENDENCIES by default
Ever since #107858 landed builds of a single library from a clean state
were significant heavier than they used to the since the full dependency
chain is being build. While this is desired behavior since some projects
emit artefacts (like bf_dna's dna_type_offsets.h) for others given we
are building static libraries that don't actually get linked until the
very end this is unneeded. CMake offers a flag here to optimize this
called CMAKE_OPTIMIZE_DEPENDENCIES. See the CMake docs for details
what this exactly does.

This diff changes the default for CMAKE_OPTIMIZE_DEPENDENCIES from
Off to On for all CMake versions that support it. If people desire to
do so, this flag can still be changed though CMakeCache.txt

Pull Request: https://projects.blender.org/blender/blender/pulls/109672
2023-07-04 17:38:02 +02:00
Brecht Van Lommel
38cc2e2f72 Fix "unknown warning option" message with some Clang versions
Should use distinct variable names per flag.
2023-07-04 13:49:05 +02:00
Sergey Sharybin
46d47e8f9c CMake: Add -Wundef and -Wundef-prefix for Clang compiler
The -Wundef was already added to the GCC compiler, but not
to the Clang compiler.

This allows catching cases when code accesses define variable
which has not been defined yet, for example `#if SOME_VAR` without
having `#define SOME_WAV <value>`.

The exact difference between undef and undef-prefix is not fully
clear, this is just something that seems empirically be needed.

This change discovers access to undefined WITH_METAL in the
GHOST_ContextCGL.mm, which needs to be looked into separately.
2023-07-03 19:18:28 +02:00
Sergey Sharybin
03fd794130 Fix #109550: Cycles: OptiX not able to render without CUDA toolkit
Happens with specific GPUs like  NVIDIA A100-SXM4-40GB. They use the
compute capability 8.0, which is not explicitly compiled as a cubin,
and since 7fca0ee76a the PTX is not suitable for it either.

The safest solution is to revert the change to a known good state,
and re-iterate as needed.

Revert "Cycles: Increase the compute model for the PTX kernel"

This reverts commit 7fca0ee76a3ba49519075d1833207b8d877cde43.

This change would need to be cherry-picked to the 3.6 LTS.

Pull Request: https://projects.blender.org/blender/blender/pulls/109636
2023-07-03 13:55:36 +02:00
Sergey Sharybin
fb25ba2378 Merge branch 'blender-v3.6-release' 2023-06-15 14:45:25 +02:00
Sergey Sharybin
7fca0ee76a Cycles: Increase the compute model for the PTX kernel
Keep the PTX compute capability at the same level as the latest
architecture-optimized CUDA kernel.

Should help performance of the future cards when running older
Blender, and maybe will allow to perform JIT optimization faster.

Pull Request: https://projects.blender.org/blender/blender/pulls/109007
2023-06-15 14:44:57 +02:00
Campbell Barton
49594c37ae License headers: use SPDX-FileCopyrightText for CMake files 2023-06-14 23:36:23 +10:00
Jeroen Bakker
b7963d247c Vulkan: Low Precision Float Conversion
This PR adds conversion template to convert between Low Precision float
formats. These include Binary32 floats and lower. It also adds support
to convert between unsigned and signed float formats and float formats
with different mantissa and exponents.

Additionally overflows (values that don't fit in the target float
format) will be clamped to the maximum value.

**Reasoning**:
Up to now the Vulkan backend only supported float and half float
formats, but to support workbench, 11 and 10 unsigned floats have to be
supported as well. The available libraries that support those float
formats targets scientific applications. Where the final code couldn't
be optimized that well by the compiler.

Data conversion for color pixels have different requirements about
clamping and sign, what could eliminate some clamping code in other
areas in Blender as well. Also could fix some undesired overflow when
using pixels with high intensity that didn't fit in the texture format
leading to known artifects in Eevee and slow-down in the image editor.

**Future**
In the future we might want to move this to the public part of the GPU
module so we can use this as well in other areas (Metal backend), Imbuf clamping
See 3c658d2c2e69e9cf97dfaa7a3c164262aefb9e76 for a commit that uses
this and improves image editor massively as it doesn't need to reiterate over
the image buffer to clamp the values into a known range.

Pull Request: https://projects.blender.org/blender/blender/pulls/108168
2023-06-07 07:50:04 +02:00
Lukas Stockner
888bdc1419 Cycles: Remove MultiGGX code, replace with albedo scaling
While the multiscattering GGX code is cool and solves the darkening problem at higher roughnesses, it's also currently buggy, hard to maintain and often impractical to use due to the higher noise and render time.

In practice, though, having the exact correct directional distribution is not that important as long as the overall albedo is correct and we a) don't get the darkening effect and b) do get the saturation effect at higher roughnesses.

This can simply be achieved by adding a second lobe (https://blog.selfshadow.com/publications/s2017-shading-course/imageworks/s2017_pbs_imageworks_slides_v2.pdf) or scaling the single-scattering GGX lobe (https://blog.selfshadow.com/publications/turquin/ms_comp_final.pdf). Both approaches require the same precomputation and produce outputs of comparable quality, so I went for the simple albedo scaling since it's easier to implement and more efficient.

Overall, the results are pretty good: All scenarios that I tested (Glossy BSDF, Glass BSDF, Principled BSDF with metallic or transmissive = 1) pass the white furnace test (a material with pure-white color in front of a pure-white background should be indistinguishable from the background if it preserves energy), and the overall albedo for non-white materials matches that produced by the real multi-scattering code (with the expected saturation increase as the roughness increases).

In order to produce the precomputed tables, the PR also includes a utility that computes them. This is not built by default, since there's no reason for a user to run it (it only makes sense for documentation/reproducibility purposes and when making changes to the microfacet models).

Pull Request: https://projects.blender.org/blender/blender/pulls/107958
2023-06-05 02:20:57 +02:00
Harley Acheson
9cf77efaa0 UI: Updated Windows File Registration
Windows file associations using ProgID, needed because of the launcher.
This fixes "pin to taskbar" and Recent Documents lists, allow per-
version jump lists and an "Open with" list with multiple versions.

Pull Request: https://projects.blender.org/blender/blender/pulls/107013
2023-05-24 21:19:56 +02:00