Commit Graph

2817 Commits

Author SHA1 Message Date
Campbell Barton
50bb98fba5 Fix #123339: Blender fails to build with older versions of wayland
Follow up to [0] which only addressed one of the issues.

[0]: bc7cb481da
2024-06-19 19:36:10 +10:00
Campbell Barton
bc7cb481da Fix #123339: Blender fails to build with older versions of wayland 2024-06-18 20:37:25 +10:00
Anthony Roberts
794a8f35fa Windows: Update GPU error message on ARM64
This makes it more verbose, and a little clearer that devices prior to 8cx Gen3 are not supported in  >=v4.0. It makes the error message from #113674 more prominent than just being printed to cout.

Spurred by an email I got from someone trying to run blender on a Surface Pro X, and getting the not very helpful (to old devices) error.

Pull Request: https://projects.blender.org/blender/blender/pulls/122732
2024-06-18 11:47:01 +02:00
Campbell Barton
7f7648c6ed Cleanup: spelling in code comments & minor edits
- Use uppercase NOTE: tags.
- Correct bNote -> bNode.
- Use colon after parameters.
- Use doxy-style doc-strings.
2024-06-06 09:55:13 +10:00
Campbell Barton
7b30f657a5 Fix memory leak on exit with tablet seat data on Wayland 2024-06-01 22:54:52 +10:00
Jeroen Bakker
12a5b2977f Vulkan: Do not enable layers
Vulkan layers should not be controlled from application, but
 should be enabled via `vkconfig`. There are configurations
in the layers that are mutual exclusive and hard to maintain from
within an application.

An example is that currently we are not able to use renderdoc efficient,
because there is an validation error triggered from within renderdoc.

This PR removes all vulkan layer configuration from Blender.

Pull Request: https://projects.blender.org/blender/blender/pulls/122473
2024-05-30 11:11:21 +02:00
Campbell Barton
0cbadd00a3 Cleanup: various non functional changes 2024-05-28 14:09:40 +10:00
Jeroen Bakker
b6002872a1 Vulkan: Optional device extensions maintenance 4
When VK_EXT_maintenance4 extension is used at device creation its
extension should also be part of the device extension list.

This wasn't the case and would trigger UB in the validation layers.

Pull Request: https://projects.blender.org/blender/blender/pulls/122208
2024-05-24 13:39:04 +02:00
Jesse Yurkovich
1f243f1d36 Cleanup: fix -Wpessimizing-move warning in GHOST_XrGraphicsBinding 2024-05-24 07:28:55 +02:00
Jeroen Bakker
79dfe8d37f Vulkan: Enable device feature dynamic rendering
In the near future the legacy framebuffer/renderpass/pipeline drawing
will be replaced by dynamic rendering. Dynamic rendering provide a
flexible API to reuse pipelines between framebuffers if they share
the same image formats.

Dynamic rendering is provided by `VK_KHR_dynamic_rendering` extension
and is supported by all platforms we support (Intel since HD4000, NVIDIA
since 700, AMD since GCN2 and llvmpipe).

Functions provided by extensions are loaded in a struct inside
`VKDevice`.

Pull Request: https://projects.blender.org/blender/blender/pulls/121642
2024-05-10 10:22:58 +02:00
Campbell Barton
98f319ce02 Cleanup: spelling in comments 2024-05-04 15:24:46 +10:00
Campbell Barton
c7de9b9f4a Reapply "GHOST/Wayland: improve the error message for protocol errors"
This reverts commit 2b85314f05.
2024-05-03 10:55:17 +10:00
Sergey Sharybin
1b0012d51c Refactor: Require C++ for users of BLI_simd.h
This is because sse2neon.h might be used to emulate SSE intrinsics
on ARM64 architecture, and it uses some preprocessor which is not
available for C language when using MSVC.

The old-style math file math_matrix.c uses this header, so needed
to become C++. Simple rename did not work since there is a new math
utility math_matrix.cc exists. Following some existing convention
the math_matrix.c is renamed to math_matrix_c.cc. Eventually all the
code should switch to use C++ style math, and the C style removed,
so it seems reasonable to not mix old and new style of API in the
same file.

There should be no functional changes.

Pull Request: https://projects.blender.org/blender/blender/pulls/121335
2024-05-02 16:22:19 +02:00
Jacques Lucke
2b85314f05 Revert "GHOST/Wayland: improve the error message for protocol errors"
This reverts commit a63e44a61f.

This lead to build failures on linux because `wl_display_get_protocol_error`
is not defined. The error happened on the buildbot too.
2024-05-02 10:23:42 +02:00
Campbell Barton
0f2827ff77 GHOST/Wayland: postpone mapping LIBDECOR windows
While there should be no user visible changes.
Follow LIBDECOR sample code by setting the app-id & title before
mapping the window.
2024-05-02 10:43:55 +10:00
Campbell Barton
a63e44a61f GHOST/Wayland: improve the error message for protocol errors
Include the interface that fails in a protocol error.
2024-05-02 10:28:35 +10:00
Campbell Barton
f735e4e611 GHOST/Wayland: prevent eternal loop in case of an error creating windows
Check & print a message if there is an error creating the window.
In both cases Blender will fail to start, it's just better to exit
quickly with a message instead of hanging.
2024-05-02 10:28:35 +10:00
Campbell Barton
2d152db090 GHOST/Wayland: use XDG_CURRENT_DESKTOP to detect GNOME
This change was made previously [0] but reverted as it caused the
title-bar to disappear on Ubuntu (see #121241).
Check if the value is set to GNOME delimited by `:`.

Previously checking the interfaces was used which has the down-side
that any compositor that adds `gtk_shell*` support may hang on startup
because of bugs in Blender/LIBDECOR as happened with WAYFIRE,
see reply to #76428.

[0]: 3a5389d5ab
2024-05-02 10:22:39 +10:00
Campbell Barton
848f1d8792 Cleanup: assign display as a variable on window creation
Reduces noise accessing the same value multiple times.
2024-05-02 10:20:54 +10:00
Campbell Barton
d06c34b2e5 Cleanup: note that XDG_* environment variables can't be relied on
This assumption caused #121241.

Also correct `endif` comment.
2024-04-30 15:02:29 +10:00
Campbell Barton
e8de8ee85a Fix hang on startup under Wayland with the WayFire compositor (#2)
Disable use of LIBDECOR on WAYFIRE as it causes Blender to hang
on window creation.

Detect WAYFIRE using the presence of the `zwf_shell_manager_v*`
interface, don't use LIBDECOR if this is found.

This is an alternative fix to [0] which also disabled LIBDECOR
but caused LIBDECOR not to be used in GNOME on some systems.

I'm not keen on this solution, but it seems alternatives are less
reliable. See code-comment for details.

[0]: 3a5389d5ab
2024-04-30 14:50:56 +10:00
Campbell Barton
3a2fafba73 Revert "Fix hang on startup under Wayland with the WayFire compositor"
This reverts commit 3a5389d5ab.

It seems XDG_CURRENT_DESKTOP isn't reliably set,
causing no titlebar on GNOME, see #121241.

The WAYFIRE workaround will need to be resolved another way.
2024-04-30 14:34:55 +10:00
Campbell Barton
3a5389d5ab Fix hang on startup under Wayland with the WayFire compositor
Use XDG_CURRENT_DESKTOP to check if GNOME is running.

Previously the existence of a `gtk_shell*` interface was used however
the WAYFIRE compositor provides this interface which made GHOST require
LIBDECOR.

Initializing LIBDECOR was hanging as the initial configuration was
never seen. From a quick check it doesn't seem like a bug in Blender's
LIBDECOR use, the issue may be in either LIBDECOR or WAYFIRE.
Whatever the case, LIBDECOR isn't needed so workaround the bug by
changing how GNOME is detected.
2024-04-29 12:32:22 +10:00
Campbell Barton
c444f128d3 WM: add a capability flag for physical trackpad direction
Support detecting if the trackpad direction flag is propertly set
(currently unused).

Needed so Wayland compositors that don't support seat-version 9 or
newer (GNOME-46 & KDE5 for e.g) can have a working trackpad.

Eventually this option will be removed when the functionality is
widely supported.
2024-04-26 21:26:49 +10:00
Campbell Barton
d544082e1d Fix #120925: Smooth scrolling mouse wheel broken on Wayland
Accumulate scrolling for mouse wheels that create scroll values below
a single "click".

Regression in [0], caused by bumping the seat API.

[0]: 8d86fb43a4
2024-04-23 13:34:59 +10:00
Fermin
821b773d95 FIX #109121: VR: Render controllers only if they are active
When turning on VR mode, if no controllers are available,
a fallback model (a sphere) is rendered in the middle of the VR area.

This change uses the OpenXR API to check if the controllers are
available, sets new properties in `GHOST_XrPose` and `wmXrController`
that store if each controller is active or not, and uses
those properties to render the controllers in the VR view only
when they are active.

NOTE: in `wmXrController`, two state properties have been included,
but only `grip_active` is currently used. `aim_active` has been
included for consistency, but it could be removed.

Pull Request: https://projects.blender.org/blender/blender/pulls/119989
2024-04-21 03:28:35 +02:00
Campbell Barton
fd589fdca4 Cleanup: various non functional C++ changes 2024-04-20 13:46:14 +10:00
Campbell Barton
4e8b24f1d1 Cleanup: spelling in comments & punctuation 2024-04-19 15:57:06 +10:00
Campbell Barton
cf37424203 Cleanup: use const pointers, quiet cppcheck unreadVariable warning 2024-04-17 11:36:38 +10:00
Campbell Barton
1f44a74947 Fix inverted table wheel on wayland
The tablet wheel direction matches the mouse wheel which also needed
to be inverted.
2024-04-15 11:39:04 +10:00
Campbell Barton
1e6716a903 Fix inverted mouse wheel on wayland after recent changes
Recent change from [0] inverted mouse wheel direction.

[0]: c9a79f9a3c.
2024-04-15 11:06:47 +10:00
Campbell Barton
b405bb3268 GHOST/Wayland: constrain new window size on startup with XDG-decor
On KDE, running "blender -w" (windowed with borders) created window
which was too big: the window contents matched the screen-size
causing the window decorations be outside the screen-bounds.

Un-maximizing the default startup file would also move window to the
same over-sized location.

Resolve by clamping the size of new windows to the requested bounds.
2024-04-14 22:19:24 +10:00
Jacques Lucke
0a192c5da4 Cleanup: fix compilation
Missing from e27889dc12.
2024-04-14 10:50:54 +02:00
Campbell Barton
c9a79f9a3c WM: handle multiple wheel events from GHOST
Scrolling the mouse wheel fast can generate multiple click-steps
which were ignored by window manager events.

This meant scrolling fast with a trackpad (with "Multi-touch gestures"
disabled) for e.g. would zoom less than the gesture made more slowly.
2024-04-14 17:55:20 +10:00
Campbell Barton
c4745a24b2 GHOST/Wayland: bump xdg_toplevel_listener version from 1 to 6 2024-04-14 17:55:17 +10:00
Campbell Barton
cc9edd2d35 GHOST/Wayland: bump zxdg_output_manager_v1 version from 2 to 3 2024-04-14 17:55:15 +10:00
Campbell Barton
dcec5ce635 GHOST/Wayland: bump wl_compositor_interface version from 3 to 6 2024-04-14 17:55:14 +10:00
Campbell Barton
6689053e43 GHOST/Wayland: bump wl_output_listener version from 2 to 4 2024-04-14 17:55:13 +10:00
Campbell Barton
8d86fb43a4 GHOST/Wayland: bump wl_seat_interface version from 5 to 9
This ensures callbacks are called to detect "natural" scroll direction
on the touch-pad, see: #107676.
2024-04-14 17:55:11 +10:00
Campbell Barton
98cb5da6d1 GHOST/Wayland: add an interface version clamping macro
This macro makes it convenient to define a supported version range for
an interface.

Uncommenting USE_VERBOSE_OLD_IFACE_PRINT prints when newer versions
of an interface are supported by the compositor which Blender could
be updated to support.

This makes it more convenient to bump interface versions as they
become available so bumping multiple versions at once doesn't
cause unexpected changes in behavior as happened with #120587.
2024-04-14 17:55:10 +10:00
Campbell Barton
df87770ca1 GHOST/Wayland: resolve mouse wheel being treated like touchpad scroll
Resolves the issue reported in #120587, which occurred when bumping the
supported version of the seat API to 9.

Smooth scrolling values were set in without calling the discrete step
callback. Resolve by calculating discrete values from the:
wl_pointer_listener::axis_value120 handler.

The functional changes from this commit only apply once the version
of the seat API is increased - which isn't part of this commit.
2024-04-14 17:55:09 +10:00
Campbell Barton
e27889dc12 Cleanup: use const references for GWL_RegistryHandler parameters 2024-04-14 17:54:59 +10:00
Campbell Barton
dce8668b1f GHOST/Wayland: use discrete zoom steps with multi-touch disabled
This matches behavior on macOS as well as the property description.

On Wayland, smooth scrolling doesn't use the touchpad API,
so disabling multi-touch gestures doesn't change the behavior as it
does on macOS.

Resolve by converting vertical touch scrolling to mouse-wheel events.
2024-04-14 14:56:30 +10:00
Campbell Barton
f12d20a819 Cleanup: always reset discrete mouse-wheel
A correctness issue, this didn't cause any bugs.
2024-04-14 14:23:36 +10:00
Campbell Barton
6e3eaae299 Cleanup: spelling in comments 2024-04-14 12:13:55 +10:00
Campbell Barton
bf3ca83df9 Cleanup: use C-style comments for descriptive text in GHOST/Cocoa 2024-04-14 09:40:19 +10:00
Hans Goudey
30c3f8eafb Revert "Fix #107676 detection of "natural" touchpad scrolling on Wayland"
This reverts commit af88ff0484.

That commit broke scrolling (at least in some cases).
Reverting the commit resolves #120587
2024-04-12 11:47:03 -04:00
Campbell Barton
af88ff0484 Fix #107676 detection of "natural" touchpad scrolling on Wayland
The callback to set the relative direction wasn't running because
it required GHOST to request version 9 of the wl_seat_interface.

Natural touchpad events now work for KDE 6 and recent versions
of WLROOTS based compositors, GNOME 46 is uses wl_seat_interface
version 8 which still wont work.
2024-04-13 00:18:21 +10:00
Jeroen Bakker
c15e5116ab Vulkan: MoltenVK Support for Developers
MoltenVK original intent was to let developers work on a mac system developing
for the vulkan eco-system. MoltenVK doesn't support all the features that we
require and would require additional workarounds to be actually supported.

It is not expected that we will release Blender with MoltenVK for this reason.
But it still has value for shader developers to validate shaders on metal and
vulkan on a single platform.

![image](/attachments/9a4a9904-a5f6-4922-896d-744dfb78244c)

Pull Request: https://projects.blender.org/blender/blender/pulls/117940
2024-04-11 11:04:43 +02:00
Campbell Barton
01187dfc8e GHOST: add missing check for end full-screen failing 2024-04-08 12:03:01 +10:00