Commit Graph

2717 Commits

Author SHA1 Message Date
sjfricke
c9c01724b9 Vulkan: Add shaderClipDistance feature
Various GLSL shaders use gl_ClipDistance and without the feature
enabled validation layers errors are triggered

Pull Request: https://projects.blender.org/blender/blender/pulls/116530
2024-01-15 15:02:19 +01:00
Campbell Barton
3aa3743b6e Fix hang on startup under Wayland & LIBDECOR with the VULKAN backend
Create a dummy buffer so LIBDECOR initializes the window configuration.
2024-01-12 11:31:10 +11:00
Hans Goudey
6438d0ad1f Cleanup: Grammar in comments 2024-01-11 11:01:50 -05:00
Campbell Barton
7a4f7a1d51 Cleanup: spelling in comments, comment blocks 2024-01-11 16:46:46 +11:00
Campbell Barton
89ad66fbbd Fix #1092563: invalid event timestamps on X11 after 49 days uptime
Regression from [0] based on the incorrect assumption that X11's
Time was a uint64. Despite the `Time` type being 8 bytes,
the value wraps at UINT32_MAX.

Details:

- GHOST_SystemX11::m_start_time now uses CLOCK_MONOTONIC instead of
  gettimeofday(..) since event times should always increase.
- Event timestamps now accumulate uint32 rollover.

[0]: efef709ec73ce95817a82e4e26cf7ec0bad8eca0
2024-01-09 12:05:31 +11:00
Hans Goudey
468e0f873f Cleanup: Fix spelling mistakes in recent spelling fix commit
0ba83fde1f4be18372dcd937627a24404a0aed8a
2024-01-08 12:52:54 -05:00
Campbell Barton
214f942258 Fix crash reading an empty clipboard under Wayland 2024-01-08 23:32:30 +11:00
Hans Goudey
e90d844dd7 Cleanup: Grammar in comments
"it's own" -> "its own" again. Start new sentences properly.
2024-01-06 09:02:56 -05:00
Brecht Van Lommel
d377ef2543 Clang Format: bump to version 17
Along with the 4.1 libraries upgrade, we are bumping the clang-format
version from 8-12 to 17. This affects quite a few files.

If not already the case, you may consider pointing your IDE to the
clang-format binary bundled with the Blender precompiled libraries.
2024-01-03 13:38:14 +01:00
Sergey Sharybin
4657d541c8 Fix use-after-free in Cocoa GHOST system creation
The use-after-free is triggered when the GHOST system is created
multiple timers during the application timelife which happens in
the integration tests.

The solution is to release the application delegate and set it
to nil when the GHOST system is being destroyed. This ensures that
all subsequent GHOST systems properly initialize application
delegate, and that there is no application delegate which points
to a freed system.

The original issue was noticed by a flackey behavior of the
bf_gpu_tests test which was failing at random. The issue could
be reliably reproduced by running this test with ASAN enabled.

Pull Request: https://projects.blender.org/blender/blender/pulls/116717
2024-01-02 17:19:54 +01:00
Harley Acheson
355654487e Fix #116618: Win32 Use Null for Background Window Brush
Using a non-null background brush does remove an initial white flash
while the program is loading and before we start painting. But this
results in some extra and unnecessary redraws. Default WM_ERASEBKGND
behaviour is to do nothing if this is brush is null, so if non-null we
get erased and must redraw. Suppressing WM_ERASEBKGND will not give us
that initial paint, so no benefit in keeping the brush added in #115968.

Pull Request: https://projects.blender.org/blender/blender/pulls/116642
2023-12-29 23:12:10 +01:00
Hans Goudey
7d44065f73 Cleanup: Revert replacement of GSQueue with std::queue
There are some tragic design flaws with the Microsoft STL
implementation of `std::dequeue`. Unless we implement our
own similar data structure or use an implementation from
another library, the change isn't worth it.

This reverts commit b26cd6a4b9008836f9d764489b4aac5e143ad611.
This reverts commit cc11ba33d90e5a541e8263f7d365d6eeda9d984c.
This reverts commit c929d750541bc25131dec63c9c9e126a1370daf0.
This reverts commit bd3d5a750d2d0f5f72ed7ae262cd69abec4b0143.
2023-12-27 12:34:49 -05:00
Hans Goudey
b26cd6a4b9 Cleanup: Remove unused GSQueue container
GSQueue dates back over 21 years, past the initial git commit. Nowadays
we generally prefer to use data structures from the C++ standard library
or our own C++ data structures. Previous commits replaced this container
with `std::queue` in a few areas. Now it is unused and can be removed.
2023-12-26 23:26:32 -05:00
Harley Acheson
6007838bb2 UI: Set Initial Background Color Darker
With the popularity of dark themes, and the fact that our default theme
is dark, make the initial background color (before the program fully
loads) a darker shade of grey. {0.25f, 0.25f, 0.25f} versus current
{0.55f, 0.55f, 0.55f}. Also set Windows class background brush to the
same color to remove a potential flash.

Pull Request: https://projects.blender.org/blender/blender/pulls/115968
2023-12-20 01:36:11 +01:00
Campbell Barton
a3130280b8 GHOST/Wayland: note that GNOME's IME also give us bad time-stamps 2023-12-19 15:55:43 +11:00
Campbell Barton
c9a298d60f Fix assert under Wayland when IME text input completed without a window
Remove null IME checks for to resolve an assertion and allow for the
window be set at any time before the event has been generated,
or generate the events even when there is no window.

Reported by Lukas Toenne who ran into this while debugging.
2023-12-19 15:23:38 +11:00
Campbell Barton
29b5919ad1 Cleanup: order GHOST_WindowWayland new/delete before other methods 2023-12-18 10:53:07 +11:00
Campbell Barton
17aca68146 Cleanup: tweaks to Wayland scale updating for new windows
- Remove redundant lock.
- Use a variable to skip resizing instead of faking unchanged values.
2023-12-18 10:46:40 +11:00
Campbell Barton
004420af8f Fix error setting the initial window size with LIBDECOR on Wayland
Error in [0] with whole-number scaling.

[0]: f845a3992cff5f660b2f94b31ab609f10e1e6b6c
2023-12-18 10:42:48 +11:00
Campbell Barton
f845a3992c Fix #109194: window decorations mismatch on startup under Wayland
Workaround for multiple monitors with different scaling causing
the window frame not to match the window contents on startup with GNOME.
2023-12-17 17:24:56 +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
Campbell Barton
4d965615fc Cleanup: various C++ changes (use ELEM & string copy macros) 2023-12-17 16:25:10 +11:00
Campbell Barton
9097f1c62d Cleanup: unhyphenate track-pad & thumb-stick
Both are typically written without hyphenation, add to local dictionary.
2023-12-15 22:57:34 +11:00
Campbell Barton
bc51f541c2 GHOST/Wayland: correct internal error in size initialization
Missing from 9479b49bd33882870785aabecc85fdae11c2b28b
2023-12-15 17:05:15 +11:00
Campbell Barton
5197dd2a7a Cleanup: use local variable, replace pointer with reference 2023-12-14 23:12:57 +11:00
rajveermalviya
40a89c0984 GHOST/X11: Enable desktop sample capability
The functionality was added [0] but the flag wasn't enabled.

Ref: !116178

[0]: e5a0d11c4ed07fbf1b3e08ddb75b635ce76c9d05
2023-12-14 22:33:46 +11:00
Campbell Barton
9479b49bd3 GHOST/Wayland: remove workaround when resizing windows with LIBDECOR
This was an attempt to fix a crash resizing windows #107797
(which I can't reproduce), however it didn't fix the issue and meant
that a window would sometimes not reach the desired size,
the maximized window for e.g. would sometimes remain the un-maximized
size.
2023-12-14 21:25:53 +11:00
Campbell Barton
f79da9f245 Cleanup: remove libdecor workaround for fractional scale
Since the preferred fractional scale callback runs,
remove a workaround that guessed the fractional scale from the output.

While it could be kept, it added unnecessary complexity.
2023-12-14 21:02:43 +11:00
Campbell Barton
a7bcee8833 Fix crash with change to window initialization order
Recent re-ordering change [0] on Wayland window initialization crashed
WLROOTS based compositors, resolve by keeping the updates and only
postponing the state change.

[0]: 39f378da37eedb918a69a31c68c34e5a9263754c
2023-12-14 17:27:17 +11:00
Campbell Barton
39f378da37 Fix incorrectly sized maximized windows on Wayland + KDE
Starting blender with --window-maximized wouldn't always size the
windows properly, similar to the fix for LIBDECOR, move setting the
window state last.
2023-12-14 17:04:29 +11:00
Campbell Barton
ba33dba2b6 Fix window frames not following blender window with fractional scaling
With fractional scale under GNOME, the window frames didn't match
the window contents. This was caused by updates needed to call
libdecor_frame_get_xdg_toplevel initializing the LIBDECOR window
before the window scale, internal buffer - etc were set.

Resolve by accessing moving the window state assignment last.
2023-12-14 16:52:28 +11:00
Campbell Barton
a1bee22eca Cleanup: duplicate assert left in by mistake 2023-12-14 13:58:12 +11:00
Campbell Barton
3e635c3eed GHOST/Wayland: set windows scale on creation when it's known
When the final buffer scale is known, set the window scaling on startup.

This avoids scaling immediately after creating the window which
flickers. It also resolves an paper-cut with KDE where fractional
scaling caused the window to be placed on the screen center,
then the size increased pushing the window contents off the bottom right
hand portion of the screen.
2023-12-14 13:53:18 +11:00
Campbell Barton
42e7d9fc3c GHOST/Wayland: unbreak build without threaded event handling 2023-12-14 13:53:17 +11:00
Campbell Barton
4f609a4f96 Cleanup: typo in internal ghost/wayland prefix 2023-12-14 13:53:16 +11:00
rajveermalviya
639de68aaa Fix eyedropper outside blender on mac
Support for picking colors from outside of the blender window on macOS

Pull Request: https://projects.blender.org/blender/blender/pulls/115187
2023-12-13 22:02:56 +01:00
Campbell Barton
a56d0c700c Fix GHOST/Wayland handling of out-of-order time-stamps
From what I can tell time-stamps are supposed to be monotonic
however with LIBDECOR & GNOME click events after resizing the window
can cause this to happen.

Resolve by only considering the value wrapped when the new time-stamps
wrapped difference is less than the unwrapped difference.
Also skip wrapping when the current offset is closer to the current time
than it would be with the offset applied.
2023-12-13 14:58:58 +11:00
Campbell Barton
6e0037e54d Fix #115878: build error with LIBDECOR & WITH_GHOST_WAYLAND_DYNLOAD=OFF
There were two problems here:

- libdecor_frame_get_content_* is not available in LIBDECOR v0.1.0.
- These functions aren't exposed by <libdecor.h>,
  they're only exposed by `libdecor-plugin.h`
  (intended for plug-ins that implement window decorations).

Resolve by storing the last applied size from LIBDECOR for reuse.
2023-12-13 10:17:07 +11:00
Campbell Barton
46a9530a75 Cleanup: move internal Wayland cursor API's into their own doxy section
Also resolve building when USE_EVENT_BACKGROUND_THREAD is disabled.
2023-12-13 09:59:06 +11:00
Campbell Barton
ffc84da541 Cleanup: use const variables & arguments, remove unused assignments 2023-12-10 21:24:37 +11:00
Campbell Barton
f02ebe7e2b Cleanup: correct assert to avoid null pointer deference 2023-12-10 17:34:41 +11:00
Campbell Barton
cbf1eac789 Cleanup: avoid pass-by-value on vector argument for ContextVK
Also use const arguments & values.
2023-12-10 17:33:02 +11:00
Campbell Barton
64c4b3428f Cleanup: remove redundant "contains" checks before erasing items 2023-12-10 17:14:46 +11:00
Campbell Barton
52a7555a84 Cleanup: match header/source argument naming 2023-12-10 17:14:06 +11:00
Campbell Barton
ff47eb3e37 Cleanup: minor style tweaks, surround ELEM by parenthesis 2023-12-10 17:12:53 +11:00
Campbell Barton
ded36920d7 Cleanup: spelling in comments 2023-12-10 16:33:54 +11:00
Campbell Barton
3c7b753279 Cleanup: minor changes to read_file_as_buffer logic
Assign the `chunk_first` once instead of checking & assigning
each iteration.
2023-12-10 15:53:43 +11:00
Campbell Barton
af4160de3a Cleanup: avoid redundant read(..) call in read_file_as_buffer 2023-12-10 15:22:07 +11:00
Campbell Barton
5d5fd5d676 Cleanup: make read_file_as_buffer into a generic utility function
Also use a (void *) data argument, matching `read(..)`.
2023-12-10 15:21:45 +11:00
Campbell Barton
3069d59215 GHOST/Wayland: correct fix for #106040
The previous fix for #106040 worked with GNOME, it relied on
matching GNOME's internal limits - which isn't fool proof
and could fail in the future.

Resolve by adding a `read` wrapper that reads the requested number of
bytes (when available).
2023-12-10 14:54:31 +11:00