Commit Graph

2717 Commits

Author SHA1 Message Date
Campbell Barton
391b5ac93c Fix uninitialized pending actions for Windows under Wayland
A windows pending actions wasn't cleared for new windows.
Although I'm not aware of user visible bugs, this prevents
unpredictable updates for new windows.
2023-11-09 16:57:06 +11:00
Campbell Barton
aaf05c2497 Cleanup: various C++ changes (use nullptr, function style casts) 2023-11-07 11:35:16 +11:00
Jeroen Bakker
e7148fc28e Vulkan: Enable Optional Vulkan 12 Features
`shaderOutputLayer` and `shaderOutputViewportIndex` are optional in
Blender, but when used they should be activated on physical device level.
This wasn't the case and when used the validation layer reported an error.

This PR activates the features when creating the device if the features
are available.

Pull Request: https://projects.blender.org/blender/blender/pulls/114303
2023-10-31 08:37:31 +01:00
Brecht Van Lommel
39107b3133 Revert changes from main commits that were merged into blender-v4.0-release
The last good commit was 8474716abb0db3b06838a57f7217bc945638d8df.

After this commits from main were pushed to blender-v4.0-release. These are
being reverted.

Commits a4880576dc from to b26f176d1a that happend afterwards were meant for
4.0, and their contents is preserved.
2023-10-30 21:40:35 +01:00
Campbell Barton
28394dd42e Merge branch 'blender-v4.0-release' 2023-10-25 21:20:28 +11:00
Campbell Barton
8e38cd9b8f Correct potential error in recent Wayland/LIBDECOR window size change
While the fix worked in my tests, the compositor is allowed to ignore
a requested window state change which could have entered an eternal
loop. Avoid this by limiting the while loop to 2x round-trips.
2023-10-25 21:17:31 +11:00
Campbell Barton
ab1be3bd48 Merge branch 'blender-v4.0-release' 2023-10-25 20:47:41 +11:00
Campbell Barton
dcaeed7522 Fix Wayland/LIBDECOR size on startup when maximized
Even though the window was maximized, the non-maximized size was used.
Since the display size was used the window would be slightly larger,
clipping the status bar in GNOME.
2023-10-25 20:42:27 +11:00
Campbell Barton
6ba74de1f2 Merge branch 'blender-v4.0-release' 2023-10-25 15:43:27 +11:00
Campbell Barton
3638aa5b77 Fix Wayland/LIBDECOR assuming a normal window state on startup
As the window state will have been initialized, read the current window
state instead of assuming normal so changes are properly detected.

Also note that the cause of #107314 has been fixed up-stream.
2023-10-25 11:21:17 +11:00
Campbell Barton
63dc379dcc Merge branch 'blender-v4.0-release' 2023-10-24 11:44:09 +11:00
Campbell Barton
ca32ba33ae Fix #113961: Incorrect window size for new windows on Wayland
When the output wasn't fractionally scaled but the compositor supports
fractional scaling, new windows were smaller than requested.

Caused by [0] which was incorrectly calculating the non-fractional scale
used by LIBDECOR (which isn't accessible via it's API).

Resolve by only using fractional scaling logic when outputs
have a fractional component.

[0]: 3eda5a114f14d14e1a454d97c9e5496247fe6c21
2023-10-24 11:42:18 +11:00
Sebastian Parborg
b77209e617 Merge branch 'blender-v4.0-release' 2023-10-23 15:03:43 +02:00
Sebastian Parborg
72d011a87c Fix: Missing null pointer check in wayland xkb code
Each locale is not guaranteed to have a compose file.
We have to check if the generated table is a null pointer.
2023-10-23 15:00:32 +02:00
Campbell Barton
c8c2343b4b Cleanup: spelling in comments 2023-10-23 10:09:05 +11:00
Campbell Barton
2864c20302 Cleanup: various C++ changes (use nullptr, function style casts) 2023-10-21 21:17:57 +11:00
Sergey Sharybin
21c8af467d Cleanup: Convert winfunc and utfconv to C++
Basically, the intern/utfconv directory, as well as users of
these headers.

Pull Request: https://projects.blender.org/blender/blender/pulls/113901
2023-10-20 10:27:31 +02:00
Campbell Barton
eaffcee074 Cleanup: remove printf left in by mistake 2023-10-20 17:51:33 +11:00
Campbell Barton
6f197f6df3 Merge branch 'blender-v4.0-release' 2023-10-20 14:00:41 +11:00
Campbell Barton
57a5c6c4be GHOST/Wayland: add support for dead keys via xkb_compose
Dead keys worked in X11 but not Wayland (or XWayland),
use XKB APIs to support composition.

Resolve #113724.
2023-10-20 13:51:08 +11: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
d288b73062 Merge branch 'blender-v4.0-release' 2023-10-18 14:40:42 +11:00
Campbell Barton
df6cedeee1 Merge branch 'blender-v4.0-release' 2023-10-18 14:40:39 +11:00
Campbell Barton
176218fce1 Merge branch 'blender-v4.0-release' 2023-10-18 14:40:34 +11:00
Campbell Barton
d35dd83701 Merge branch 'blender-v4.0-release' 2023-10-18 14:40:31 +11:00
Campbell Barton
3eda5a114f Fix Wayland/LIBDECOR window size on startup without a hack
The USE_LIBDECOR_FRACTIONAL_SCALE_HACK worked on my system but made
window size issues worse in older versions of GNOME, see: #109194.

Replace the hack with logic to set the window size using frational
scaling information from the output.
2023-10-18 14:37:12 +11:00
Campbell Barton
bafb36f8bc Fix glitches resizing windows on Wayland, LIBDECOR & fractional scaling
When fractional scaling is used, window sizes from LIBDECOR are still
divided by the window-decorations internal buffer scale which doesn't
match the GHOST window (always 1 in the case of fractional scale).

Also resolve glitches caused by recalculating the window size when
no size change was intended. In this case reuse LIBDECOR's internal
size so there are never any changes (caused by rounding for e.g.).
2023-10-18 14:37:11 +11:00
Campbell Barton
3ad21b2169 Fix invalid surface size under Wayland when GHOST set the window size
When the window manager set the window size, there were no checks
the size is a multiple of the buffer scale (a requirement for Wayland).

This meant setting the window size could exit Blender without warning
if an invalid window size was set.
2023-10-18 14:37:09 +11:00
Campbell Barton
46159c131d Cleanup: add rounding utilities for GHOST/Wayland
Prepare for fixes that use add additional rounding.
2023-10-18 14:37:08 +11:00
Campbell Barton
89efeedd5b Merge branch 'blender-v4.0-release' 2023-10-16 10:35:45 +11:00
Campbell Barton
db36c9f204 Merge branch 'blender-v4.0-release' 2023-10-16 10:35:42 +11:00
Campbell Barton
f95ee3e871 Fix incorrect window decoration size with Wayland & libdecor on startup
When fractional scaling was used with libdecor the window decorations
would not match the window size on startup, drawing small and on top
of Blender's window.
While there are still glitches with fractional-scaling & libdecor
(which doesn't support fractional scaling),
see #109194 this at least resolves one of the worst issues.
2023-10-16 10:01:00 +11:00
Campbell Barton
e8f2c3e45f GHOST/Wayland: don't preempt new windows buffer fractional scale
When a new window is created the final buffer scale isn't known
so setting the buffer scale assuming the final state was just a guess
and only had the minor advantage of preventing rounding the window size
on startup.

Removing this to resolve a bug with LIBDECOR & fractional scaling
relating to #109194 (will commit separately).
2023-10-16 09:50:44 +11:00
Jeroen Bakker
8ebe7d98d7 Vulkan: Remove Renderdoc Extension
When running Blender inside renderdoc an extension can be used to print
from any shader stage to the console. This is useful during developing,
but not so during running/triaging. For now we remove the extension to
not confuse by incorrect error messages.

Pull Request: https://projects.blender.org/blender/blender/pulls/113654
2023-10-13 11:35:56 +02:00
Jeroen Bakker
159e798cdb Vulkan: Add Viewport Array/Layer Workarounds
This PR adds workarounds for platforms that don't support `shaderOutputLayer`
or `shaderOutputViewportIndex`. Some NVIDIA laptop GPUs and ARM GPUs don't
have those device features.

The workaround uses the same approach as OpenGL. A geometry shader is injected
to emulate the feature.

For testing the workarounds they have also been connected to the
`--debug-gpu-force-workarounds` command line argument.

Fixes #113475 by implementing #113529

Pull Request: https://projects.blender.org/blender/blender/pulls/113605
2023-10-13 10:40:11 +02:00
Campbell Barton
ac82a7c3f8 Merge branch 'blender-v4.0-release' 2023-10-13 17:32:55 +11:00
Campbell Barton
5e6a34ac6c Fix memory leak with Wayland drag & drop
The data-offer for drag & drop wasn't freed when cancelled or not
dropped on a Blender owned surface.
2023-10-13 17:31:02 +11:00
Campbell Barton
c814c0295d Merge branch 'blender-v4.0-release' 2023-10-13 15:46:41 +11:00
Campbell Barton
3e9403bd76 Fix drag & drop crash when dragging over window decorations on Wayland
Missing null checks for drag events for non-GHOST surfaces
(typically window decorations).
2023-10-13 15:34:21 +11:00
Campbell Barton
3180f16cef Merge branch 'blender-v4.0-release' 2023-10-12 14:20:26 +11:00
Campbell Barton
3d90af5ae1 Merge branch 'blender-v4.0-release' 2023-10-12 14:20:19 +11:00
Campbell Barton
ecde39baf3 Fix #113328: Wrong startup window size with fractional scale on Wayland
The output's XDG scale wasn't available at startup, add a round-trip
to resolve this.
2023-10-12 14:18:53 +11:00
Campbell Barton
ee15925716 Fix incorrect screen-size under Wayland with transformed outputs
- The transform was incorrectly accessed as a flag.
- Missing checks for 270 degree rotation.
2023-10-12 14:18:51 +11:00
Harley Acheson
0deb4f3e98 Merge branch 'blender-v4.0-release' 2023-10-11 18:34:04 -07:00
Harley Acheson
6aeadce34b UI: Win32 Warp Margin Adjustment
Windows mouse warping bounds margin needs to be different when not
GHOST_kGrabHide, or else the visible wrapping occurs within the
area at an odd location. Making it 2, like it used to be.
2023-10-11 18:32:11 -07:00
Harley Acheson
fba58a1483 Merge branch 'blender-v4.0-release' 2023-10-11 16:05:09 -07:00
Harley Acheson
67e4af3ea1 Fix #113511: Win32 Warping Needs Screen Edge Margin
Windows mouse warping requires a margin when the bounds are at screen
edge. Setting a margin of 10% of bounds width tests sufficient.

Pull Request: https://projects.blender.org/blender/blender/pulls/113565
2023-10-12 01:03:53 +02:00
Campbell Barton
db093a4608 Merge branch 'blender-v4.0-release' 2023-10-12 09:27:43 +11:00
Campbell Barton
b8ad624006 Cleanup: use doxygen doc-strings, spelling in comments 2023-10-12 09:26:53 +11:00
Sergey Sharybin
79dc2c7672 Merge branch 'blender-v4.0-release' 2023-10-11 19:12:12 +02:00
Sergey Sharybin
534e7f4470 Fix #112935: Wrong window order handling on macOS 14
The issue was caused by the custom code which was ensuring that closing
About window does not leave application without any key
windows.

Turns out that the windowWillClose is executed when menu is closed,
forcing the custom code to ensure a key window.

The solution is to only perform manual re-ordering if the closing window
was a key window. This both keeps old behavior of ensuring there is a
key window after closing About, and solves the ordering issues when a
window is created or activated via menus.

Pull Request: https://projects.blender.org/blender/blender/pulls/113515
2023-10-11 19:11:41 +02:00
Campbell Barton
5e7a85539d Merge branch 'blender-v4.0-release' 2023-10-10 11:06:29 +11:00
Campbell Barton
951ae52912 GHOST/Wayland: disable assert which can happen during debugging 2023-10-10 11:04:36 +11:00
Harley Acheson
a6a4d45538 Merge branch 'blender-v4.0-release' 2023-10-09 13:10:22 -07:00
Harley Acheson
1d141e721c Fix #109968: Allow Warping on Actual Mouse Bounds
For Color Circle (and Square) and for Walk Navigation, use the actual
region bounds for mouse warping.

Pull Request: https://projects.blender.org/blender/blender/pulls/113066
2023-10-09 22:09:04 +02:00
Campbell Barton
39295476d0 Cleanup: store const events in GHOST's event handling logic 2023-10-08 15:23:40 +11:00
Campbell Barton
fc78182cc8 Refactor: use const event data, use static_casts
In some cases processing events was modifying them, as there can be
multiple event consumers, manipulating events isn't correct.
Even though in practice it didn't cause issues, it's straightforward
not to do this and makes logic easier to reason about.
2023-10-08 15:23:39 +11:00
Campbell Barton
0bf7d15fa6 Cleanup: replace strncpy with memcpy for buffers of a known size 2023-10-08 14:34:27 +11:00
Campbell Barton
8f8a9ef488 Cleanup: remove unused GHOST_kEventTimer
There was a type error assigning customdata, (wmTimer *) was expected
although this data isn't created so it was never hit.
2023-10-08 14:31:15 +11:00
Campbell Barton
0742ef808f Fix writing past struct bounds of GHOST_TEventImeData
IME editing would cast GHOST_TEventImeData to wmIMEData then read/write
an additional member that doesn't exist in GHOST_TEventImeData.

In practice it's likely struct padding prevented this from showing up
as a bug. Nevertheless it's bad practice to rely on this.

- Make GHOST_TEventImeData read-only, move the is_ime_composing boolean
  into the window.
- Add static assert to ensure both structs are the same size.
- Correct code comments.
2023-10-08 14:29:08 +11:00
Campbell Barton
519d29423d Fix building WITH_GHOST_DEBUG without NDOF 2023-10-08 14:28:25 +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
f3f494fd63 macOS: fix issues building without OpenGL headers
macOS has WITH_OPENGL_BACKEND disabled but still included
`epoxy/gl.h` and defined an unused NSOpenGLContext.
2023-10-07 20:51:24 +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
a17d6efe98 Cleanup: correct enums used as booleans 2023-10-07 18:28:09 +11:00
Campbell Barton
126cf64004 CMake: quiet undefined variable use with MOLTENVK on non-apple systems 2023-10-07 18:25:44 +11:00
Jeroen Bakker
9a654c04de Vulkan: Wayland Windowing
Wayland WSI would crash the system when used. The reason is that the
wayland vulkan WSI doesn't provide windowing support. Vulkan gets full access
to the desktop of the OS and it is the responsibilty of the application to
do the right thing.

For OpenGL Wayland proved basic windowing support using `wayland-egl.h`.
Which essentially is a tiny wrapper that keeps track of the window position and
size.

This PR changes a few things to make the Wayland surface usable:

- Do not load debug extensions when blender isn't started with
  `--debug-gpu`.
- Recreate swapchain images when surface size changes.

Pull Request: https://projects.blender.org/blender/blender/pulls/113007
2023-10-06 14:45:09 +02:00
Campbell Barton
6b2f9dd71d Merge branch 'blender-v4.0-release' 2023-10-06 17:34:18 +11:00
Campbell Barton
e1dac0b122 Fix glitch resizing windows with LIBDECOR on Wayland
The window contents and the window boarders were noticeably out of sync
when resizing the window quickly.

Resolve by keeping the current size as-is, rely on deferred handling
of the pending window size to apply the new size along with the contents.
2023-10-06 17:32:43 +11:00
Campbell Barton
a110873f52 Merge branch 'blender-v4.0-release' 2023-10-06 17:15:15 +11:00
Campbell Barton
9ddb3143c0 Merge branch 'blender-v4.0-release' 2023-10-06 17:15:13 +11:00
Campbell Barton
b9d300380f Cleanup: correct typo in assertions 2023-10-06 17:13:44 +11:00
Campbell Barton
d59a79ef95 Fix redundant window activation/deactivation events under Wayland
Any window state change (resizing for e.g.) triggered
activation/deactivation events. Resolve by only sending events on state
change. The activation caused cursor motion events from #107594.
2023-10-06 17:12:32 +11:00
Campbell Barton
31dce9d11d Merge branch 'blender-v4.0-release' 2023-10-06 16:21:01 +11:00
Campbell Barton
36021021aa GHOST/Wayland: remove window activation on tablet proximity in
Activating on tablet proximity isn't needed and would activate windows
that were already active. The window manager handles activation.
2023-10-06 16:20:08 +11:00
Campbell Barton
ba472eb69e Merge branch 'blender-v4.0-release' 2023-10-06 16:16:58 +11:00
Campbell Barton
c413a8d183 Fix error clearing the windows libdecor state on failure on Wayland
API docs note the state should remain unchanged when accessing the state
fails.
2023-10-06 16:15:47 +11:00
Jeroen Bakker
6e18bb4e3e Vulkan: Make Maintenance4 Extension Optional
`VK_KHR_maintenance4` extension is core in Vulkan 1.3. As Blender
should support Vulkan 1.2 we should not enable this extension when
it isn't available.This fixes issue to run Vulkan backend on some
platforms (Intel Iris Plus).

Maintenance4 is used to relax the interface matching rules to allow
a larger output vector to match with a smaller input vector, with
additional values being discarded.

When Maintenance4 isn't enabled a few shaders might run a tiny bit
slower as it triggers a performance notice. Users won't notice the
performance slowdown.

Pull Request: https://projects.blender.org/blender/blender/pulls/113239
2023-10-05 13:40:28 +02:00
Dalai Felinto
a9aa0c3fc8 Cleanup: make format 2023-10-05 10:20:09 +02:00
Jeroen Bakker
9f891b6f98 Cleanuip: Make format 2023-10-05 09:33:12 +02:00
Campbell Barton
60b2b663cc Merge branch 'blender-v4.0-release' 2023-10-05 13:16:20 +11:00
Campbell Barton
c9130e38e3 Cleanup: spelling in comments 2023-10-05 13:07:58 +11:00
Germano Cavalcante
bd6b7088bf Fix #112978: MacOS no longer has a path associated with the window
The problem was introduced in 636f3697ee

MacOS has a different way of handling the title.

In this OS the directory is searched and taken from the title string
which is then formatted.

This limits the title format and makes it prone to errors.

This commit makes the code more generic by splitting each component of
the title beforehand and allowing the associated directory to be informed
with `GHOST_SetTitle`.

Pull Request: https://projects.blender.org/blender/blender/pulls/113227
2023-10-05 02:26:11 +02:00
Germano Cavalcante
d6b2b5d0c5 Fix #112978: MacOS no longer has a path associated with the window
The problem was introduced in 636f3697ee

MacOS has a different way of handling the title.

In this OS the directory is searched and taken from the title string
which is then formatted.

This limits the title format and makes it prone to errors.

This commit makes the code more generic by splitting each component of
the title beforehand and allowing the associated directory to be informed
with `GHOST_SetTitle`.
2023-10-04 21:23:38 -03:00
Sergey Sharybin
d7a21d0199 Merge branch 'blender-v4.0-release' 2023-10-04 18:10:50 +02:00
Sergey Sharybin
d522938fd5 macOS: Enable secure coding for restorable state
There are secure implications of not using secure coding for the
restorable state described in the following article:

  https://sector7.computest.nl/post/2022-08-process-injection-breaking-all-macos-security-layers-with-a-single-vulnerability/

Starting with macOS 14 this secure coding is enabled implicitly
but with a warning printed into the console with a note that it
does not affect other versions of macOS.

This change makes it so the secure coding is used explicitly on
all supported macOS versions.

Blender does not use the restorable state itself, and used its
own code to take care of window placement, so there should be
no user-measurable changes.

Pull Request: https://projects.blender.org/blender/blender/pulls/113240
2023-10-04 18:09:27 +02:00
Campbell Barton
ddad645157 Fix use after free error in recent check for EGL context
Correct error in [0].

[0]: 5ae917ffe9cee71115590fbc8dae20a88495923c
2023-10-04 13:16:44 +11:00
Campbell Barton
5ae917ffe9 Fix GHOST_SystemWayland::disposeContext assuming an EGL context
Only destroy the EGL window for OpenGL contexts.
2023-10-04 10:17:36 +11:00
Campbell Barton
41d62f36d5 Fix uninitialized variable use accessing the screen size under Wayland
It's possible for there to be no outputs under Wayland
(when unplugging monitors for e.g.) so this must be accounted for.

Also avoid calculating the window position when the GHOST backend
doesn't support window positions (which is the case for Wayland).

Add checks for the SDL backend too, where accessing the
screen & desktop size may fail.
2023-10-03 15:40:58 +11:00
Campbell Barton
8337b3dd3f Fix mouse cursor failing to update for blocking actions on Wayland
Changes to the mouse cursor would only display when the main loop
was being handled, so blocking actions such as file load wouldn't
refresh the cursor.

Solve by flushing the display when the cursor changes.
2023-09-29 16:32:35 +10:00
Campbell Barton
9be80399aa Cleanup: update code comments for wayland cursor locking
Since this comment was written support for warping was added.
2023-09-26 19:50:48 +10:00
Campbell Barton
c4651af470 Cleanup: use initializer list for all GHOST_SystemWayland members 2023-09-26 19:50:48 +10:00
Campbell Barton
0309de1f15 Cleanup: use C++ style casts in GHOST/Wayland 2023-09-26 19:50:48 +10:00
Campbell Barton
2721b937fb Cleanup: use braces in headers 2023-09-24 14:52:38 +10:00
Campbell Barton
d4dbbab5d9 Cleanup: locate break statements inside the case body
Follow the convention used almost everywhere in Blender's code.
2023-09-23 21:17:50 +10:00
Campbell Barton
f13f61df98 GHOST/Wayland: follow SDL's method of XDG window initialization
Using SDL's initialization logic, this is mainly a change for XDG
as LIBDECOR already required a configure event before accessing
the underlying XDG window.

While I didn't notice functional changes with this change window
flickering on startup remains an issue with some compositors
(KDE & river). Debugging these issues is simpler when both windowing
decoration systems work in a similar way & window configuration
is guaranteed to have run before the window is returned.
(via #xdg_surface_ack_configure).
2023-09-22 12:43:22 +10:00
Jeroen Bakker
e93bf13626 Windows: Update Min OpenGL Version
https://archive.blender.org/developer/D13885 has added several
messages that mentioned OpenGL 3.3 as minimum requirement.
Blender 4.0 requires OpenGL 4.3 and this PR updates these messages.

Pull Request: https://projects.blender.org/blender/blender/pulls/112575
2023-09-20 09:20:56 +02:00
Campbell Barton
085b094f18 Cleanup: use const arguments & variables 2023-09-19 11:09:20 +10:00
Jeroen Bakker
915256eb0a Vulkan: Enable Device Features for EEVEE-Next
This PR enabled device features that are required for EEVEE-Next.
Enabling these features would allow an initial screen drawn by
EEVEE-Next.

Note:
* Changes to EEVEE-Next after this commit, might require other changes
* Not all features are working, but a basic diffuse cube without shadows
  is.
* Vulkan views are not correct and leads to incorrect lighting.

Pull Request: https://projects.blender.org/blender/blender/pulls/112519
2023-09-18 13:54:02 +02:00
Campbell Barton
75afef1372 Cleanup: use braces for GHOST Cocoa *.mm sources 2023-09-17 09:16:09 +10:00
Campbell Barton
635a4eac05 Fix delete key setting a control character in wmEvent::utf8_buf
The check for control characters didn't account for delete (127).
This wasn't noticeable in most cases as delete is mapped to delete text.
Pressing Shift-Delete would enter 127 control character in the
text-editor, 3D text & Python console. This happened X11 & Wayland,
I didn't check other platforms.
2023-09-15 16:01:00 +10:00
Campbell Barton
b7f3e0d84e Cleanup: spelling & punctuation in comments
Also remove some unhelpful/redundant comments.
2023-09-14 13:25:24 +10: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
057c9364fc Cleanup: use braces around statements 2023-09-12 14:48:20 +10:00
Jeroen Bakker
81c6eb9c7f Vulkan: Enable Shader Draw Parameters Support
Shader draw parameter support is needed for Workbench-next. (Almost) All
devices that we support also supports shader draw parameters. This PR
doesn't include a workaround for devices that don't have support.

For end-users this PR will allow workbench-next to render the object on
the correct location. Before this patch they were always drawn on the origin.

The catch is that OpenGL uses gl_InstanceID which always starts counting at 0.
Vulkan has gl_InstanceIndex which holds the correct instance number. By
subtracting the gl_InstanceIndex from gl_BaseInstance will get the correct
gl_InstanceID.

This patch also activates some device extensions to perform in shader printf
statements inside a shader. Documentation for this will be added to the dev
docs how to use them.

Pull Request: https://projects.blender.org/blender/blender/pulls/111461
2023-09-11 15:04:54 +02:00
Campbell Barton
4fc5d287ac Cleanup: doxygen parameters, blank comment lines 2023-09-08 16:53:30 +10:00
ChengduLittleA
bf8d3c157a Fix #111820: Missing type casting in XrGraphicsBinding.cc
The line `oxr_binding.egl.getProcAddress = eglGetProcAddress` supposedly
needs a type casting for it to compile successfully under llvm16.

Pull Request: https://projects.blender.org/blender/blender/pulls/111915
2023-09-06 15:26:51 +02:00
Campbell Barton
4dd5385807 GHOST/Wayland: remove exception if wl_keyboard_listener::keymap fails
This would cause Blender to exist, log the message & return instead.
2023-09-06 16:19:33 +10:00
Campbell Barton
d06bd5d1f0 GHOST: remove prefix from exception messages
The back-end name is already included remove duplicate information.
2023-09-06 16:08:06 +10:00
Campbell Barton
51e3cd1603 Fix Wayland error message displaying when running on X11
Problem caused by [0], resolve by only printing error messages
when none of the GHOST back-ends are able to start.

[0]: f58d596c36c81245ed8c5723e5fa8369106a7a80
2023-09-06 15:38:34 +10:00
Campbell Barton
bedfc68e3f Cleanup: use function style integer casts, modernize headers 2023-09-05 11:10:44 +10:00
Campbell Barton
0c26c84704 Cleanup: spelling in comments 2023-09-05 11:04:27 +10:00
Campbell Barton
e8c812a307 Cleanup: spelling in comments, update dictionary 2023-09-03 21:35:07 +10:00
Campbell Barton
e3fd80dd64 Fix building with GHOST/Wayland & Vulkan 2023-09-01 22:04:34 +10:00
Campbell Barton
cc5dd9e3d3 Cleanup: use libdecor_ prefix for libdecor_frame_interface callbacks
These names weren't obviously related to libdecor.
2023-09-01 16:09:16 +10:00
Campbell Barton
e711af8987 GHOST/Wayland: correction to xdg_toplevel_listener::configure use
Zero width/height should be ignored, don't overwrite the window
size set by the client in this case.
2023-09-01 16:09:16 +10:00
Campbell Barton
0026d20c8c Cleanup: quiet compiler warnings, correct doxy section 2023-08-30 10:57:17 +10:00
Jeroen Bakker
bee3f645d8 Vulkan: Rewrite GHOST_ContextVK
This is a rewrite of GHOST_ContextVK to align with Metal backend as described
in #111389 - solution 3 with the adaptation that GHOST is still responsible
for presenting the swap chain image and a post callback is still needed in
case the swapchain is recreated.

This PR also includes some smaller improvements in stability.

Technical documentation: https://developer.blender.org/docs/eevee_and_viewport/gpu/vulkan/swap_chain/

* Renderpasses and framebuffers are not owned anymore by GHOST_ContextVK
* VKFramebuffer doesn't contain a swap chain image.
* Swapchain images can only be used as a blit destination or present source.
  Not as an attachment.
* GHOST_ContextVK::swapBuffers would call a callback with the image the
  GPU module needs to blit the results to.
* Clearing of depth/stencil attachments when no depth write state is set.
* Enable VK_KHR_maintenance4 to relax the stage interface mapping.
* Removes most vulkan validation warnings/errors.
* Detection of frame buffer changes that needs to be applied before
  performing a command requiring render pass (draw/clear attachment)

**Benefits**

* Late retrieval of a swap chain image results in better overall performance as
  Blender doesn't need to wait until the image is presented on the screen.
* Easier API and clearer state (transitions)
* More control over Image layouts and command buffer states. (Better alignment with
  Vulkan API)

Pull Request: https://projects.blender.org/blender/blender/pulls/111473
2023-08-29 15:05:08 +02:00
Hans Goudey
eafe8332c7 Fix: Compile error with Ghost X11 off and Wayland on
‘const’ qualifiers cannot be applied to ‘const std::runtime_error&’
2023-08-28 16:15:21 -04:00
Vitor Boschi
e5a0d11c4e UI: Allow eyedropper outside of Blender (X11)
Implements the GHOST_GetPixelAtCursor for the X11 backend, allowing
the user to sample any color displayed on the screen.

Noted some limitations in the code-comments.

Ref !111493.
2023-08-26 17:20:05 +10:00
Harley Acheson
f69c7afe57 Fix #111295: Add Missing Win32 Platform-Specific Window functions
Add platform-specific (Windows) versions of getOSWindow() and
getWindowUnderCursor().

Pull Request: https://projects.blender.org/blender/blender/pulls/111359
2023-08-25 22:09:54 +02:00
Campbell Barton
0f0a2d9038 Correct error printing NDOF rotation 2023-08-23 15:36:34 +10:00
Campbell Barton
3405e14446 GHOST: handle all event types in GHOST_EventPrinter::processEvent
- Adjust switch statement to warn when members aren't accounted for.
- Print NDOF button/motion data.
2023-08-23 15:31:21 +10:00
Campbell Barton
c52965e9c7 Cleanup: simplify struct declarations 2023-08-23 13:45:19 +10:00
Campbell Barton
f58d596c36 GHOST/Wayland: print the exception message on failure
When GHOST_SystemWayland can't be created, print the run-time error
unless X11 is available as a fallback.
2023-08-22 16:08:55 +10:00
Campbell Barton
4760908b6e Fix potential buffer overflow & un-terminated strings on macOS
- GHOST_SystemPathsCocoa::getUserSpecialDir
  used `strncpy` without ensuring the string was null terminated.
- GHOST_SystemPathsCocoa::getBinaryDir
  used `strcpy` without checking the destination buffer size.
2023-08-21 11:53:22 +10:00
Campbell Barton
0a04a6d1a1 Cleanup: quiet GCC's -Wsuggest-attribute=format warning 2023-08-17 16:52:45 +10:00
Campbell Barton
a7c1a57957 CMake: correct WITH_X11_XF86VMODE include path 2023-08-17 11:53:49 +10:00
Germano Cavalcante
fc39963b31 Cleanup: Deduplicate code
By unifying the return, we don't need to duplicate the `CoTaskMemFree`
call.

Ref 84718feb4b.
2023-08-16 18:29:12 -03:00
Guillermo Venegas
84718feb4b Fix potential leaks using SHGetKnownFolderPath
Documentation for `SHGetKnownFolderPath` remarks that the `PWSTR`
parameter should always be freed with `CoTaskMemFree`  even if it
succeeds or not.

Pull Request: https://projects.blender.org/blender/blender/pulls/111128
2023-08-16 23:10:00 +02:00
Campbell Barton
92c4756d02 Fix replacement of "Blender Foundation" in recent header change
The recent change to header copyrights [0] unintentionally changed
"Blender Foundation" to "Blender Authors" for the WIN32 file path
which blender is installed into.

Revert lines changed that aren't related to copyright text.

[0]: e955c94ed38595cb12fa6cf517b6ba8033017141
2023-08-16 21:21:55 +10:00
Harley Acheson
5741a5d433 UI: Allow Eyedropper Outside of Blender
This adds a new Ghost function, GHOST_GetPixelAtCursor, that allows
picking colors from outside of Blender windows. This only has an
implementation for the Windows platform, but this should allow other
platforms to also do so if possible.

Pull Request: https://projects.blender.org/blender/blender/pulls/105324
2023-08-16 01:14:36 +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
Jeroen Bakker
dd4ab50065 GPU: Add Dummy Backend For Unsupported Platforms
With the introduction of metal and vulkan we use a different
GPU backend selection which broke the dialog box for unsupported
platforms.

Blender asserted and segfaulted before the dialog was being shown
to the user.

This patch solves this by introducing a dummy GPU backend in case no
GPU backend was supported by OpenGL, Metal and Vulkan Backend.

It also adds the showMessageBox to GHOST_SystemCocoa.

Related to #110335

Pull Request: https://projects.blender.org/blender/blender/pulls/110919
2023-08-15 14:15:12 +02:00
Campbell Barton
311fa9768d Cleanup: spelling in comments 2023-08-12 16:29:51 +10:00
Campbell Barton
9810942adf Cleanup: avoid uninitialized members in GHOST classes 2023-08-11 09:34:08 +10:00
Campbell Barton
cc95c02a89 Fix building WITH_OPENGL_BACKEND=OFF 2023-08-10 17:40:24 +10:00
Campbell Barton
ea10e601fd Cleanup: use _get() suffix for GHOST/Wayland methods
Avoid variables shadowing methods for common names such as
scale & outputs.
2023-08-10 17:38:34 +10:00
Campbell Barton
23cd37de25 Cleanup: redundant checks 2023-08-10 17:11:24 +10:00
Jason Fielder
2367ed2ef2 macOS: Enable support for EDR rendering
Add a High Dynamic Range option in the Color Management > Display panel.
This enables display of extended color ranges above 1.0 for the 3D
viewport, image editor and render previews.

This requires a monitor that can display HDR colors, and a view
transform designed for HDR output. The Standard view transform works,
but Filmic does not as it was designed to bring values into the 0..1
range for SDR displays.

This patch is limited to allowing the display to visualize extended
colors, but does not include future looking work to better integrate HDR
into the full workflow.

It is implemented by rendering to high bit-depth texture formats for
the user interface, and uncapping the color range in color management.

Authored by Apple: Michael Parkin-White

Pull Request: https://projects.blender.org/blender/blender/pulls/105662
2023-08-09 14:25:15 +02:00
Campbell Barton
da0fef65c0 Cleanup: remove unsafe string API use
This was only enabled WITH_GHOST_DEBUG, getKeyString now returns
a static string instead of filling in a buffer.
2023-08-09 15:50:32 +10:00
Campbell Barton
bff7962c80 Cleanup: remove redundant struct/void in C++, function style casts 2023-08-09 13:37:37 +10:00
Campbell Barton
5f1b02937a Cleanup: remove 'struct' prefix from GHOST/Wayland types
Move struct members into sub-structs (wl/wp/xdg/xkb) to prevent
naming collisions with the types & struct members.
2023-08-09 12:54:19 +10:00
Clément Foucault
983ff8e616 GPU: Framebuffer: Add multi viewport support
This add the possibility to define different
viewports inside a single framebuffer and
let the vertex shader decide which viewport
to render to.

This only contain the GL and VK implementation.
The Vulkan implementation works but still
has a validation error related to shader features
and extension. The test passes nonetheless.

Pull Request: https://projects.blender.org/blender/blender/pulls/110923
2023-08-08 17:12:49 +02:00
Jeroen Bakker
b1357f6790 Vulkan: Error When Creating Windows Offscreen Context
Thanks to UPBGE developers to point this one out.

Pull Request: https://projects.blender.org/blender/blender/pulls/110892
2023-08-07 14:58:06 +02:00
Campbell Barton
7f34ad736a Cleanup: spelling in comments 2023-08-05 13:54:25 +10:00
Campbell Barton
de391cf811 Cleanup: use nullptr instead of zero 2023-08-03 19:17:43 +10:00
Campbell Barton
8c8ff6b85b Cleanup: spelling in comments, use C-style comments 2023-08-03 09:44:28 +10:00