210 Commits

Author SHA1 Message Date
Campbell Barton
3c7f4edd92 Cleanup: spelling in comments & string
Also back-tick quote literals in CMakeLists files.
2025-09-06 09:27:54 +10:00
Jeroen Bakker
1f1098c498 Vulkan: Remove MoltenVK
Blender had some support for using MoltenVK. However there are some key
issues why MotlenVK cannot be used. Bugs have been reported up-stream.
As it doesn't work and holds back regular developments it will be removed
from the main branch.

Any efforts on making Vulkan run on Apple (including KosmicKrisp)
is considered a community effort and can be done in a development
branch.

Pull Request: https://projects.blender.org/blender/blender/pulls/144602
2025-08-15 09:36:38 +02:00
Jonas Holzman
d95c2bc406 GHOST: Rename Metal Context from ContextCGL to ContextMTL
This commit renames the GHOST Metal graphic context class and related
files / references from `GHOST_ContextCGL` to `GHOST_ContextMTL`. When
the Metal backend was first introduced, this context file contained
both the old OpenGL context (CGL, for macOS Core OpenGL API), and the
newer Metal context. Since #110185 all CGL related code was removed
from the class, making it Metal only, and thus rendering the old class
name outdated and potentially misleading. In addition to the rename,
unused OpenGL related forward declarations and old TODOs were also
removed.

Pull Request: https://projects.blender.org/blender/blender/pulls/142519
2025-07-24 13:28:44 +02:00
Hans Goudey
e573d9dd24 Revert "Wayland: Set surface color management"
This reverts commit 965b4dce6d.

This commit caused #141688.
2025-07-09 15:11:58 -04:00
Jeroen Bakker
965b4dce6d Wayland: Set surface color management
This PR solves running Wayland on compositors that don't support HDR/
color management. It also allows to let Blender window be drawn across
monitor boundaries and being transferred and clamped to the monitor
it is being displayed on.

From our point of view monitor configurations is a compositor/OS
responsibility. This PR provides the compositor that the provided
swapchain image will be using sRGB whitepoints and transfer
function. The compositor should then take care of performing the
final transfer to the monitor color volume.

The color management protocol doesn't provide guarantees that
every compositor does this. It is mentioned as a recommendation
and 'should do this'.

Pull Request: https://projects.blender.org/blender/blender/pulls/141598
2025-07-09 10:50:20 +02:00
Sebastian Parborg
232b106e64 GHOST: Implement the cursor shape protocol and remove X11 cursors from the wayland backend
This makes the the cursor drawing be handled by the Wayland compositor
unless the cursor shape is not in the standard cursor shape set.
For custom cursor shape, Blender still manually draws and handles these.

Removal of the X11 cursors was done because:
1. Greatly simplifies the code (and compositors not supporting the cursor
    shape protocol will fallback to Blenders built in cursors).

2. On a lot of compositors the X11 cursor theme is not set per default,
       this would lead to us falling back to a default theme. This would
       in almost all cases not match the actual cursor theme of the user.
       The fallback theme would also look quite ugly and the cursor size
       would be inconsistent with the rest of the system.

Pull Request: https://projects.blender.org/blender/blender/pulls/140366
2025-07-01 15:16:44 +02:00
Campbell Barton
c8e31d34b4 Cleanup: quiet CMake warnings from use of undefined variables 2025-06-11 16:22:18 +10:00
Jonas Holzman
733d65e514 GHOST: Remove GHOST_DisplayManager and its implementations
The GHOST_DisplayManager and its implementations are for the most part
unmaintained and almost completely unused in all backends. To clean
things up, and avoid any confusion about how displays are handled in
each respective GHOST backend, this PR completely removes the GHOST
Display Manager, and move the few remaining logic it still held directly
to the corresponding backends.

The backends that were modified (apart from removing the display manager
initialization call from their init) are:

- Win32: `GHOST_SystemWin32::getNumDisplays()` was calling
  `m_displayManager->getNumDisplays`, the underlying system metric call
  (`GetSystemMetrics(SM_CMONITORS)`) was substituted in place.

- SDL: `GHOST_SystemSDL::createWindow` was calling
  `GHOST_DisplayManagerSDL::getCurrentDisplayModeSDL` which returned its
  `m_mode` data member by reference. Since none of the
  `GHOST_DisplayManagerSDL` member function that modified this data member
  were ever called, the variable `memset` initialization call was
  substituted in place from the `DisplayManagerSDL` constructor

Pull Request: https://projects.blender.org/blender/blender/pulls/138066
2025-04-28 14:26:39 +02:00
Campbell Barton
01c32a9ccc Cleanup: trailing space 2025-04-24 12:44:27 +10:00
Jeroen Bakker
6f6df389a1 Cleanup: OpenXR: Move Direct3D to its own compile unit
_No response_

Pull Request: https://projects.blender.org/blender/blender/pulls/137255
2025-04-10 09:32:48 +02:00
Campbell Barton
0b369b6613 Cleanup: remove GHOST_TaskbarX11
This only worked for Ubuntu's discontinued Unity desktop.

Even though `libunity.so` can be used outside of Unity,
it's no longer actively developed.

Ref: !137128
2025-04-08 10:56:29 +00:00
Campbell Barton
3a51d140d8 Cleanup: remove WITH_X11_XF86VMODE since mode setting is no longer used
Setting the display mode was last used for the Game Engine
remove the CMake option WITH_X11_XF86VMODE and the associated code.

Ref: !137126
2025-04-08 10:56:27 +00:00
Brecht Van Lommel
98b3b36411 Refactor: Build: Add bf::dependencies::eigen target
To make adding a dependeny on TBB easier.

Additional changes:
* Using LIB for libmv tests, as it now brings in includes
* Removing Eigen header listing in iTaSC

Pull Request: https://projects.blender.org/blender/blender/pulls/136865
2025-04-02 16:50:46 +02:00
Jeroen Bakker
3885a37541 Vulkan: Initial OpenXR support
The Blender's VkInstance cannot be shared with OpenXR VkInstance. The
reason is a chicken and egg problem where OpenXR needs to be started
before Vulkan. OpenXR can add special vulkan specific requirements
(instance&device) that are only available when the user starts an OpenXR
session.

The goal implementation is to share memory between both instances using
[VK_KHR_external_memory](https://registry.khronos.org/vulkan/specs/latest/man/html/VK_KHR_external_memory.html) and related extensions. However this seems
to be a bridge to far as a initial step. Reason: There are not that many
samples/ guides and documentation to be found to handle the workflow that
we require. We want to do a smaller step by step approach to gain the needed
knowledge.

For that reason this PR does the most stupidest thing that can be done to
share memory between instances. Download the render result to CPU RAM share
the host pointer with the OpenXR instance which copies it to the swap chain.
Also the synchronization is done using wait idle commands.

<video src="attachments/32a0d69b-c3fa-4272-aea0-d207609afaaf" title="Screencast From 2025-03-18 11-16-17.webm" controls></video>

**Gaining knowledge**

- Experiment with `VK_KHR_external_memory_host` extension for uploading vertex buffers (not related to OpenXR).
- Import host pointer with `VK_KHR_external_memory_host`. This reduces the additional
  memcpy on OpenXR side.
- Export host pointer from Blender side from a mappable buffer.
- Replace host pointers with fd/dmabuf/winhandle
- Remove mappable buffer.

Ref #133718

Pull Request: https://projects.blender.org/blender/blender/pulls/133824
2025-03-27 16:57:51 +01:00
Ray Molenkamp
a0d9826b3c Cleanup: CMake: Modernize bf_imbuf dependencies
Pretty straightforward

- Remove any bf_imbuf paths from INC
- Add a dependency though LIB when missing

context: https://devtalk.blender.org/t/cmake-cleanup/30260

Pull Request: https://projects.blender.org/blender/blender/pulls/132336
2024-12-25 23:32:15 +01:00
Ray Molenkamp
b7407aabb5 Cleanup: CMake: Modernize bf_gpu dependencies
Pretty straightforward

- Remove any bf_gpu paths from INC
- Add a dependency though LIB when missing

context: https://devtalk.blender.org/t/cmake-cleanup/30260

Pull Request: https://projects.blender.org/blender/blender/pulls/132286
2024-12-23 21:38:19 +01:00
Campbell Barton
5dd67c6e1c Cleanup: sort CMake path lists 2024-12-09 09:18:50 +11:00
Jeroen Bakker
108a0f2ec0 Vulkan: Share driver check between GPU and GHOST
GPU and GHOST require to have identical checks to remove faulty drivers.
When not done GHOST can still select a device that isn't supported and
lead to freezing interfaces.

Pull Request: https://projects.blender.org/blender/blender/pulls/131241
2024-12-02 14:50:32 +01:00
Jonas Holzman
9a8e9bb61b Fix #129985: macOS headless build fails due to missing CGL context symbols
When making a `headless` macOS build, linking would fail complaining
about missing `GHOST_ContextCGL` symbols, which are required by the Metal
backend. This commit fixes this issue by compiling the macOS CGL GHOST
Context if the Metal backend is enabled, instead of only depending on
`WITH_HEADLESS`, similarly to what's done on Linux/other *nix systems.

Pull Request: https://projects.blender.org/blender/blender/pulls/130847
2024-11-25 22:43:19 +01:00
Jacques Lucke
64a9260921 Core: remove WITH_CXX_GUARDEDALLOC option
This implements the proposal from #124512. For that it contains the following
changes:
* Remove the global override of `new`/`delete` when `WITH_CXX_GUARDEDALLOC` was
  enabled.
* Always use `MEM_CXX_CLASS_ALLOC_FUNCS` where it is currently used. This used
  to be guarded by `WITH_CXX_GUARDEDALLOC` in some but not all cases. This means
  that a few classes which didn't use our guarded allocator by default before,
  are now using it.

Pull Request: https://projects.blender.org/blender/blender/pulls/130181
2024-11-13 13:39:49 +01:00
Campbell Barton
7d33cd9877 GHOST/Wayland: reference the stable tablet-v2 API
The tablet API become stable in wayland-protocol 1.35

NOTE: this was reverted [0] because I missed adding the files to lib.
The files have been included, so use the stable API.

No functional changes expected.

[0]: c525e4db83
2024-10-08 09:37:52 +11:00
Jeroen Bakker
3bec05518d Vulkan: Remove always failing extension
Since the introduction of vulkan loader in vulkan (not Blender) the
molten vk extension always leads to a failed registration. This
extension is only available when using the loader. Blender doesn't use
the vulkan loader so we should remove it.

Pull Request: https://projects.blender.org/blender/blender/pulls/128354
2024-09-30 10:14:10 +02:00
Campbell Barton
c6afb0e270 Core: remove sdlew/WITH_SDL_DYNLOAD & disable SDL by default
Disable dynamic SDL loading as well as disable SDL for release builds.

This was only used for audio output which can already use OpenAL
if there are back-ends not natively supported by Blender.

- Remove extern/sdlew/
- Remove the WITH_SDL_DYNLOAD build option.
- Remove `bpy.app.sdl.available`.

Ref !127554
2024-09-13 22:44:35 +10:00
Campbell Barton
08d5eb8f9c Cleanup: cmake formatting 2024-08-21 23:20:34 +10:00
Bastien Montagne
2d7f00e410 Merge branch 'blender-v4.2-release' 2024-06-26 11:50:27 +02:00
Bastien Montagne
c525e4db83 Revert "GHOST/Wayland: reference the stable tablet-v2 API"
The currently available `wayland-protocol` libraries in lib-linux_x64
repo do not appear to be advertised 1.36 (or 1.35) versions, since the
tablet protocol is not available among the stable ones.

This reverts commit 2a85eaaf16.

Pull Request: https://projects.blender.org/blender/blender/pulls/123774
2024-06-26 11:48:55 +02:00
Campbell Barton
9ee6da08ab Merge branch 'blender-v4.2-release' 2024-06-26 16:29:57 +10:00
Campbell Barton
2a85eaaf16 GHOST/Wayland: reference the stable tablet-v2 API
The tablet API become stable in wayland-protocol 1.35
2024-06-26 16:26:18 +10:00
Jeroen Bakker
a7a554479f Vulkan: Fix compilation issue macOs due to renamed variable
Pull Request: https://projects.blender.org/blender/blender/pulls/123503
2024-06-20 19:21:47 +02:00
Campbell Barton
0cd414120b Unbreak build on macOS with AppleClang from recent cleanup
Exact an exact match with Clang broke building when the compiler ID
was "AppleClang", reverting parts of [0].

[0]: 6549019ae1
2024-03-07 19:56:58 +11:00
Campbell Barton
6549019ae1 Cleanup: use STREQUAL instead of MATCHES for exact comparisons
MATCHES takes a REGEX and searches the input for a match,
this isn't necessary for CMAKE_SYSTEM_PROCESSOR & CMAKE_*_COMPILER_ID.
2024-03-07 17:56:41 +11:00
Campbell Barton
1455315111 Fix window updates with threaded event handling with LIBDECOR on Wayland
Under GNOME resizing a window often caused the window contents could be
a different size to the window-frame, resizing was also slow.

This occurred with LIBDECOR on Wayland when a window configure event
was called from a non-main thread.

Resolve by postponing the commit-configuration call until the main event
can handle it (matching XDG behavior).

A workaround using malloc_usable_size is currently needed.
While relying on the malloc size is not so portable and worth avoiding,
it resolves noticeable glitches and allows other workarounds to be
removed.

Any application that supports threaded event handing with LIBDECOR
will need a way to postpone applying the configuration.
Even once LIBDECOR supports this properly, a workaround is necessary
until support older versions of LIBDECOR can be dropped.
2023-12-17 16:26:27 +11:00
Jeroen Bakker
65e58fe574 CMake: Fix Compiling Shader Builder on macOS
Due to changes in the build environment shader_builder wasn't able to
compile on macOs. This patch reverts several recent changes to CMake files.

* dbb2844ed9
* 94817f64b9
* 1b6cd937ff

The idea is that in the near future shader_builder will run on the buildbot as
part of any regular build to ensure that changes to the CMake doesn't break
shader_builder and we only detect it after a few days.

Pull Request: https://projects.blender.org/blender/blender/pulls/115929
2023-12-08 15:47:14 +01:00
Ray Molenkamp
1b6cd937ff Cleanup: CMake: Modernize bf_imbuf dependencies
Pretty straightforward

- Remove any bf_imbuf paths from INC
- Add a dependency though LIB when missing

context: https://devtalk.blender.org/t/cmake-cleanup/30260

Pull Request: https://projects.blender.org/blender/blender/pulls/115425
2023-11-25 23:37:24 +01:00
Ray Molenkamp
b683bcc46c Cleanup: CMake: Modernize bf_intern_clog dependencies
Pretty straightforward

- Remove any bf_intern_clog paths from INC
- Add a dependency though LIB when missing

context: https://devtalk.blender.org/t/cmake-cleanup/30260

Pull Request: https://projects.blender.org/blender/blender/pulls/115323
2023-11-24 17:12:24 +01:00
Campbell Barton
661da427d7 Build: attempt to fix linking error WITH_INPUT_IME & GHOST
Always define WITH_INPUT_IME when IME is enabled so both WM and GHOST
can rely on functions existing when enabled from CMake.
2023-10-19 21:05:27 +11: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
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
e8834565a3 CMake: support building GHOST/X11 without OpenGL 2023-10-07 21:22:15 +11:00
Campbell Barton
1bb098bf44 CMake: WITH_OPENGL_BACKEND=OFF excludes EGL/EPOXY includes & libraries
This isn't complete as opensubdiv, hydra & XR still depend on OpenGL.
2023-10-07 18:30:17 +11:00
Campbell Barton
126cf64004 CMake: quiet undefined variable use with MOLTENVK on non-apple systems 2023-10-07 18:25:44 +11:00
Ray Molenkamp
5f8dfa231d CMake: Fix building with WITH_VULKAN_BACKEND
Ghost uses vulkan in its public headers but none of the projects that
depend on ghost had the vulkan headers in its includes nor did
bf_intern_ghost expose this vulkan dependency itself publicly yet.

bf_windowmanager also did not express its dependency on
bf_intern_ghost yet used its headers.

this change fixes both issues.

Pull Request: https://projects.blender.org/blender/blender/pulls/112259
2023-09-12 15:07:41 +02:00
Campbell Barton
a7c1a57957 CMake: correct WITH_X11_XF86VMODE include path 2023-08-17 11:53:49 +10: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
Ray molenkamp
4ea2baf4ae CMake: revert last weeks modernizations
The cleanup of blenkernel last weeks , caused the house of cards to
collapse on  top of bf_gpu's shader_builder, which is off by default
but used on a daily basis by the rendering team.

Given the fixes forward in #110394 ran into a ODR violation in OSL that
was hiding there for years, I don't see another way forward without
impeding the rendering teams productivity for "quite a while" as there
is no guarantee the OSL issue would be the end of it.

the only way forward appears to be back.

this reverts :

19422044ed
a670b53abe
0f541db97c
be516e8c81
3e88a2f44c
4e64b772f5
9547e7a317
07fe6c5a57

The problematic commit was 07fe6c5a57
as blenkernel links most of blender, it's a bit of a link order issue
magnet. Given all these commits stack, it's near impossible to revert
just that one without spending a significant amount of time resolving
merge conflicts. 99% of that work was automated, so easier to just
revert all of them, and re-do the work, than it is to deal with the
merge conflicts.

Pull Request: https://projects.blender.org/blender/blender/pulls/110438
2023-07-25 16:43:21 +02:00
Ray Molenkamp
0f541db97c Cleanup: CMake: Modernize bf_intern_clog dependencies
Pretty straightforward

- Remove any clog paths from INC
- Add a dependency though LIB when missing

context: https://devtalk.blender.org/t/cmake-cleanup/30260

Pull Request: https://projects.blender.org/blender/blender/pulls/110350
2023-07-21 18:37:30 +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
Ray Molenkamp
04235d0e55 Cleanup: CMake: Modernize bf_blenlib dependencies
Pretty straightforward

- Remove any blenlib paths from INC
- Add a dependency though LIB

Pull Request: https://projects.blender.org/blender/blender/pulls/109934
2023-07-10 22:04:18 +02:00
Ray Molenkamp
7cebb61486 Cleanup: CMake: Modernize bf_dna dependencies
There's quite a few libraries that depend on dna_type_offsets.h
but had gotten to it by just adding the folder that contains it to
their includes INC section without declaring a dependency to
bf_dna in the LIB section.

which occasionally lead to the lib building before bf_dna and the
header being missing, while this generally gets fixed in CMake by
adding bf_dna to the LIB section of the lib, however until last
week all libraries in the LIB section were linked as INTERFACE so
adding it in there did not resolve the build issue.

To make things still build, we sprinkled add_dependencies wherever
we needed it to force a build order.

This diff :

Declares public include folders for the bf_dna target so there's
no more fudging the INC section required to get to them.

Removes all dna related paths from the INC section for all
libraries.

Adds an alias target bf:dna to signify it has been updated to
modern cmake

Declares a dependency on bf::dna for all libraries that require it

Removes (almost) all calls to add_dependencies for bf_dna

Future work:

Because of the manual dependency management that was done, there is
now some "clutter" with libs depending on bf_dna that realistically
don't. Example bf_intern_opencolorio itself has no dependency on
bf_dna at all, doesn't need it, doesn't use it. However the
dna include folder had been added to it in the past since bf_blenlib
uses dna headers in some of its public headers and
bf_intern_opencolorio does use those blenlib headers.

Given bf_blenlib now correctly declares the dependency on bf_dna
as public bf_intern_opencolorio will get the dna header directory
automatically from CMake, hence some cleanup could be done for
bf_intern_opencolorio

Because 99% of the changes in this diff have been automated, this diff
does not seek to address these issues as there is no easy way to
determine why a certain dependency is in place. A developer will have
to make a pass a this at some later point in time. As I'd rather not
mix automated and manual labour.

There are a few libraries that could not be automatically processed
(ie bf_blendthumb) that also will need this manual look-over.

Pull Request: https://projects.blender.org/blender/blender/pulls/109835
2023-07-10 15:07:37 +02:00
Campbell Barton
a2c6371e3e License headers: use SPDX-FileCopyrightText in intern/ghost 2023-06-14 17:42:15 +10:00