Commit Graph

2942 Commits

Author SHA1 Message Date
Jeroen Bakker
dc6bd96eeb Fix #131315: Vulkan: Provoking vertex incorrect
In OpenGL the last vertex is the provoking vertex. In Vulkan the first
vertex is the provoking vertex. This PR uses `VK_EXT_provoking_vertex`
to use the last vertex as the provoking vertex.

Pull Request: https://projects.blender.org/blender/blender/pulls/131412
2024-12-05 11:03:29 +01: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
Guillermo Venegas
7f7f9e987f Fix #130817: Make resource pool to cycle when swapchain images are presented
Its not standard how `Present Engines` return images for presentation, and
currently is expected that they cycle between swap-chain images with each
`vkAcquireNextImageKHR` call.

However present engines could return any available image, that can mean
to reuse the last presented one if available. (This seem to be the behavior
using `Layered on DXGI Swapchain` the default `Present Method` used
with latest NVIDIA drivers on Windows).

Since resource pools expects to images to cycle in a sequential order, if any
present engine always return the same image for presentation only a single
resource pool would be used for each rendered frame, and since resources
are only released by cycling between resource pools, this resource pool would
overflow since it never releases any resource.

This changes makes resource pools to cycle each time a image is presented.

Pull Request: https://projects.blender.org/blender/blender/pulls/131129
2024-11-29 12:35:44 +01:00
Harley Acheson
0193579e90 UI: Win32 - Clipboard Image Paste from File Path
On the Windows platform allow pasting an image into the Image Editor
based on a filepath in the clipboard. For example, selecting "copy" on
the context menu in the file system. This checks for CF_HDROP format
and should work for all image formats we support.

Pull Request: https://projects.blender.org/blender/blender/pulls/127782
2024-11-27 23:55:18 +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
Jeroen Bakker
69f94df026 Fix #130164: Vulkan: Freeze when resizing window
When resizing window some platforms could freeze. The cause was that
depending on a platform the swap chain could get out of date when
acquiring the next swapchain image or when presenting the swap chain
image to the queue.

We only covered one scenario. This PR implements the scenario to
recreating the swap chain when the image could not be acquired.

Pull Request: https://projects.blender.org/blender/blender/pulls/130909
2024-11-25 15:31:09 +01:00
Jeroen Bakker
c2695e2dcc Vulkan: Add support for legacy platforms
Dynamic rendering is a Vulkan 1.3 feature. Most platforms have support
for them, but there are several legacy platforms that don't support dynamic
rendering or have driver bugs that don't allow us to use it.

This change will make dynamic rendering optional allowing legacy
platforms to use Vulkan.

**Limitations**

`GPU_LOADACTION_CLEAR` is implemented as clear attachments.
Render passes do support load clear, but adding support to it would
add complexity as it required multiple pipeline variations to support
suspend/resume rendering. It isn't clear when which variation should
be used what lead to compiling to many pipelines and branches in the
codebase. Using clear attachments doesn't require the complexity
for what is expected to be only used by platforms not supported by
the GPU vendors.

Subpass inputs and dual source blending are not supported as
Subpass inputs can alter the exact binding location of attachments.
Fixing this would add code complexity that is not used.

Ref: #129063

**Current state**

![image](/attachments/9ce012e5-2d88-4775-a636-2b74de812826)

Pull Request: https://projects.blender.org/blender/blender/pulls/129062
2024-11-19 16:30:31 +01:00
Jeroen Bakker
1a6c586e81 Vulkan: Use Vulkan 1.1 feature enablement
Shader draw parameters was enabled by query-ing the extension. The
feature is core in Vulkan 1.1, and our minimum requirement is Vulkan
1.2. In stead of querying the extension we should use enable the
feature via `VkPhysicalDeviceVulkan11Features`.

This was detected when working on !129062

Pull Request: https://projects.blender.org/blender/blender/pulls/130441
2024-11-18 15:11:42 +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
Jonas Holzman
263212c4fa Merge branch 'blender-v4.3-release' 2024-11-09 01:35:36 +01:00
Jonas Holzman
574e08272c Cleanup: make format 2024-11-09 01:33:16 +01:00
Jonas Holzman
13c31f3912 Fix #129424: macOS Image Editor Copy/Paste upside down
This commits fixes a bug where the new macOS Image Editor image copy
paste feature was correctly pasting images from macOS to Blender, but
wrongly copying image from Blender to other software upside-down.
This was fixed by porting the row inversion logic present in
GHOST_SystemCocoa::getClipboardImage to the putClipboardImage function.

Pull Request: https://projects.blender.org/blender/blender/pulls/129938
2024-11-09 01:30:03 +01:00
Jonas Holzman
5b30f82d2c Fix #129424: macOS Image Editor Copy/Paste upside down
This commits fixes a bug where the new macOS Image Editor image copy
paste feature was correctly pasting images from macOS to Blender, but
wrongly copying image from Blender to other software upside-down.
This was fixed by porting the row inversion logic present in
GHOST_SystemCocoa::getClipboardImage to the putClipboardImage function.

Pull Request: https://projects.blender.org/blender/blender/pulls/129938
2024-11-08 23:28:53 +01:00
Campbell Barton
e46c58df7c Merge branch 'blender-v4.3-release' 2024-11-02 15:44:22 +11:00
Campbell Barton
99387c0749 Cleanup: spelling in comments, docs & error 2024-11-02 15:43:27 +11:00
Campbell Barton
650acfd167 Merge branch 'blender-v4.3-release' 2024-11-02 15:27:53 +11:00
Campbell Barton
d9badb73ca GHOST/SDL: map the GrLess key 2024-11-02 15:10:05 +11:00
Clément Foucault
47f7aaa2cc Merge branch 'blender-v4.3-release' 2024-11-01 12:16:38 +01:00
Jason Fielder
7fbc9e9428 Fix: Metal: Memory leaks identified by Instruments and Xcode memory graph.
Running Xcode memory graphs and the Instruments tools revealed
memory leaks caused, in the main, by over-retained objects.
This removes the unnecessary 'retains' and adds some asserts
to guard against over-retaining in the future.

There are a few memory leaks remaining involving PyUnicode_DecodeUTF8
but I am unable to identify the cause of these at this time.

Authored by Apple: James McCarthy

Pull Request: https://projects.blender.org/blender/blender/pulls/129117
2024-11-01 11:56:51 +01:00
Campbell Barton
9dcf890934 Cleanup: remove unused include, redundant (void) 2024-10-29 23:40:08 +11:00
Campbell Barton
fc6ec4a6c0 GHOST/Wayland: cache the result of hasClipboardImage
Avoid potentially expensive file-system checks when the data-offer
has not changed.
2024-10-29 23:33:38 +11:00
Campbell Barton
f2b5b6eb9d Merge branch 'blender-v4.3-release' 2024-10-29 23:23:56 +11:00
Campbell Barton
44e719cdf6 Fix missing lock in GHOST_SystemWayland::hasClipboardImage 2024-10-29 23:21:15 +11:00
Campbell Barton
70ccc74628 Cleanup: assert that mime type overrides are exist on Wayland
Ensure the API is used as intended.
2024-10-29 23:06:31 +11:00
Campbell Barton
70657e7638 Cleanup: rename text/uri-list variable for clarity 2024-10-29 23:01:46 +11:00
Campbell Barton
f4fb3b2d51 Docs: clarify why locking isn't needed for Wayland data offer 2024-10-29 23:00:47 +11:00
Campbell Barton
8682e4087b GHOST/Wayland: support pasting images from a copied file
Support pasting images into Blender which have been copied from a
file manager (matching macOS).
2024-10-28 13:40:26 +11:00
Campbell Barton
d367e6e2b5 Cleanup: share clipboard paste logic between text & image paste
De-duplicate low level logic that reads the clipboard in a thread.

Instead, expand the utility function for reading from the clipboard
with arguments so it can be used for images & text.
2024-10-28 13:40:25 +11:00
Campbell Barton
eb83158325 Cleanup: move URI range extraction into its own a function 2024-10-28 13:40:23 +11:00
Campbell Barton
e31366c3bb Merge branch 'blender-v4.3-release' 2024-10-28 13:33:28 +11:00
Campbell Barton
d6d612dc46 Fix memory leak pasting images in Wayland 2024-10-28 12:38:22 +11:00
Campbell Barton
f9ba08d14c Merge branch 'blender-v4.3-release' 2024-10-25 14:08:40 +11:00
Leon Marz
1a872e69f3 Fix terminating the EGL connection without a valid display
When wl_display_connect fails don't attempt to disconnect EGL,
no connection will have been made.

Ref: !129301
2024-10-25 13:55:06 +11:00
Jonas Holzman
ecddcdd455 Cleanup: Objective-C: Replace usages of Nil with nil
In Objective-C, both the `Nil` and `nil` macros can be used to designate
Nullabity. However, only `nil` (with a lower case n) is commonly used,
as can be seen in documents such as the Google Objective-C Style Guide.

In this sense, this commits replaces instances of `Nil` with `nil` for
greater consistency.
2024-10-20 14:46:49 +02:00
Campbell Barton
120a178158 Merge branch 'blender-v4.3-release' 2024-10-19 22:58:06 +11:00
Campbell Barton
cf3a6697d2 Fix #129231: GrLess key not supported on Wayland 2024-10-19 22:43:19 +11:00
Campbell Barton
c8c00f2e1a Merge branch 'blender-v4.3-release' 2024-10-17 18:17:01 +11:00
Campbell Barton
fd63b3d725 Fix #129095: Crash on wayland on startup without a "seat"
Running in a headless weston session was asserting, then crashing,
causing WITH_UI_TESTS to fail.

Resolve by accounting for a wayland sessions without a seat.
2024-10-17 18:02:07 +11:00
Jeroen Bakker
399060aa0e Merge branch 'blender-v4.3-release' 2024-10-14 15:45:34 +02:00
Jeroen Bakker
af151e89a7 Fix: Vulkan: Unguarded Access Device Queues
Multiple threads can access the same device queue from different
threads. This could happen when doing a cycles preview render, baking
eevee volume probes or generating material previews.

This PR adds a mutex around access to the device queues.

Detected when researching #128608

Pull Request: https://projects.blender.org/blender/blender/pulls/128974
2024-10-14 15:30:11 +02:00
Campbell Barton
3350eeba62 Merge branch 'blender-v4.3-release' 2024-10-12 22:48:08 +11:00
Campbell Barton
15be0030f6 Cleanup: various non-functional C++ changes
- Avoid shadowing.
- Use default functions.
- Remove unused struct member from GpencilBatchCache.
2024-10-12 22:44:19 +11:00
Campbell Barton
0cec2462cd Cleanup: remove redundant checks in Wayland drag & drop
Since #128766 was fixed, there is no need for an `in_use` check.
2024-10-10 09:14:25 +11:00
Campbell Barton
930a8b199b Merge branch 'blender-v4.3-release' 2024-10-09 22:37:38 +11:00
Campbell Barton
20756a07cd Fix #128766: crash dropping files with Wayland
Dropping files could crash ~10% of the time on some systems,
although I wasn't able to reproduce the error.

The ownership of GWL_Seat::data_offer_dnd wasn't handled correctly,
where the value could be handled by both wl_data_device_listener::leave
& drop callbacks.

Resolve by ensuring the data-offer is handled by the drop callback.
2024-10-09 22:29:16 +11:00
Campbell Barton
7dc92ab0d1 Merge branch 'blender-v4.3-release' 2024-10-09 15:36:23 +11:00
Campbell Barton
8d7c98a3c8 GHOST/Unix: always use getpwuid for home directory access
getpwuid for accessing home wasn't used when looking up the path
for older Blender versions. There is no reason for the code-paths
to differ. Use a shared utility function to access home.
2024-10-09 15:34:07 +11: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
Campbell Barton
c1f18be1ba Merge branch 'blender-v4.3-release' 2024-10-07 13:05:28 +11:00
Campbell Barton
6039cb17e6 Unix: use getpwuid() to access home when the variable/tilde expand fails
This was already done in GHOST, but not BKE_appdir_folder_home.

Also null check the return value from getpwuid() as it's not
guaranteed to be non-null.
2024-10-07 13:00:56 +11:00