Autoreleasepool:
- Replace outdated `NSAutoreleasePool` `init`/`drain` mechanism with
the modern `@autoreleasepool {}` block. Leading to simpler and
cleaner code, and more flexible functions return placement.
- Add missing `autoreleasepool` in code.
The rule being that in an MRR (Manual Retain-Release / non-automatic
reference counting) environments, "Cocoa expects there to be an
autorelease pool always available. If a pool is not available,
autoreleased objects do not get released and you leak memory"
(quote from Apple Dev Docs).
As we cannot make safe assumptions about function call sites, and
cannot rely on a main autoreleasepool like a standard Obj-C
application, every piece of Objective-C code that calls any sort of
Cocoa function should be wrapped in an `autoreleasepool {}` block for
eventual internal `autorelease` call to be honored.
- Add missing `release` / `autorelease`, make correct MRR pairs
A next step would be to start transitioning the Blender Obj-C codebase
from MRR to automatic reference counting (ARC).
Dot-Notation:
- Use Objective-C dot notation to follow modern Objective-C practices,
and provide a more familiar syntax to programmers coming from C/C++,
(`foo.prop` instead of `[foo prop]` for access, `foo.prop = bar`
instead of `[foo setProp:bar]` for setting).
- Exception for singleton class properties / methods
(`[NSPasteboard generalPasteboard]` instead of
`NSPasteboard.generalPasteboard`) and nested method calls that mix
property and methods.
(Example: [NSApp windowWithWindowNumber:[window_number integerValue]]`
or `[view convertRectToBacking:[view bounds]]`)
When possible, or necessary, refactored functions were simplified or
refactored, in which case the Blender code style was applied. As such
there is some overlap with PR #126770, especially when it comes to const
correctness.
Due to the fact that these two refactors are quite interlinked, and for
easier reviewing / avoiding complicated merge conflicts, they're shipped
in a single PR.
Ref #126772
Pull Request: https://projects.blender.org/blender/blender/pulls/126771
- Resource pools are shared between multiple swap chains to reduce
code complexity
- Fix issue where activating a new graphical context could still leave
the previous context rendering.
- Known issue: opening files with more windows require a redraw.
Reference: #126499
Pull Request: https://projects.blender.org/blender/blender/pulls/126961
The use of `const` for Objective-C object pointer is not standard and
generally unsound. Unlike a C++ class, which has support for const and
non-const methods. An Objective-C object will still respond to mutable
selectors even if its object pointer is const, making it semantically
useless.
Another problem with const Objective-C object is that they cannot be
properly passed into other Objective-C object selectors due to type
differences. Even if that selector didn't modify the underlying object.
For consistency with general Objective-C code style guidelines, usage of
const pointer syntax (`Class *const`) were also removed.
Ref #126772
Pull Request: https://projects.blender.org/blender/blender/pulls/126768
This PR implements #126353; In short: keep discard list as part of swap chain images. This allows
better determination when resources are actually not in use anymore.
## Resource pool
Resource pools keep track of the resources for a swap chain image.
In Blender this is a bit more complicated due to the way GPUContext work. A single thread can have
multiple contexts. Some of them have a swap chain (GHOST Window) other don't (draw manager). The
resource pool should be shared between the contexts running on the same thread.
When opening multiple windows there are also multiple swap chains to consider.
### Discard pile
Resource handles that are deleted and stored in the discard pile. When we are sure that these
resources are not used on the GPU anymore these are destroyed.
### Reusable resources
There are other resources as well like:
- Descriptor sets
- Descriptor pools
## Open issues
There are some limitations that require future PRs to fix including:
- Background rendering
- Handling multiple windows
- Improve CPU/GPU synchronization
- Reuse staging buffers
Pull Request: https://projects.blender.org/blender/blender/pulls/126353
This only impacted configurations that don't include large cursor sizes
which isn't so common.
However when it does happen the cursors are small enough that they're
difficult to see.
On X11 windowing systems there's no `MessageBox` prompt like on
win32 that could show users that they have unsupported GPUs,
this leads to confusion to them as they typically don't open
blender from a command line so none of the messages could be
available. This patch utilizes `system->showMessageBox` to display
a GUI message box telling the user that the GPU is unsupported.
Pull Request: https://projects.blender.org/blender/blender/pulls/126220
VSE has three mouse cursors defined, WM_CURSOR_LEFT_HANDLE,
WM_CURSOR_RIGHT_HANDLE, and WM_CURSOR_BOTH_HANDLES that are currently
always using our default cursor format. This format works on all
platforms but does not support multiple sizes or antialiasing. This
PR makes these use custom cursors (created by Pablo Vazquez) on the
Windows platform.
Pull Request: https://projects.blender.org/blender/blender/pulls/125252
Commit adds support for new format of RawInput packets used by
3Dconnexion devices: SpaceMouse Enterprise, Keyboard Pro and Numpad Pro
specifically. This required distinguishing processing button data
delivered as a bitmask and as a numbers array.
Basically it allows for using said devices buttons in Blender including
using these buttons in shortcuts.
Changes work only for Windows. MacOS will allow only for older format
that is bitmask.
Details:
- NDOF button event values have been moved into the public GHOST_Types.h
header and are no longer aligned to the WM event values.
This was done so the values could be changed to match hardware/drivers
without breaking key-maps stored in user preferences.
- Keyboard Pro and Numpad Pro buttons are not currently used because
they don't map to any standard keyboard events.
These could be supported, see the PR for details.
Ref: !124155
Libdecor would attempt to activate the window before it was
known to the window manager, causing the GHOST_kEventWindowActivate
event not to be sent.
Resolve by skipping window manager activation when the window has
not yet been initialized.
Quickly opening & closing windows could result in an error allocating
the EGL context.
In my tests the window would be created but not display (in GNOME)
hanging for a while although Blender could be usable again after a
while. However some users report this crashing (see #123096).
Change the behavior to match X11, where failure to set the context
makes the GHOSTWindow::getValid return false.
In my tests the Blender window is created after a short delay.
This may also resolve#123096.
Uses the OpenXR extension XR_FB_PASSTHROUGH_EXTENSION_NAME,
compatible mainly with the Meta Quest family of devices.
Currently, passthrough support over OpenXR is disabled by default
in the Quest Link app, and must be manually enabled in its settings
to use this feature.
The performance of the passthrough render varies with the quality
of the connection between the headset and the PC. For better results,
connecting the headset directly through USB to the PC, or at least
connecting the PC to the local network over ethernet, is recommended.
Thanks a lot to [KISKA](https://kiska.com/)
for their support in the development of this feature.
Pull Request: https://projects.blender.org/blender/blender/pulls/124204
Multi draw indirect is used by the overlay engine and can lead
to a validation error when multiple instances are drawn.
This PR enabled the feature. We expect that all our devices can handle
this feature.
Pull Request: https://projects.blender.org/blender/blender/pulls/124141
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
Add support for VK_EXT_dynamic_rendering_unused_attachments. Although
this is required, it needs to be registered optional for now due to
lacking support when using renderdoc.
Pull Request: https://projects.blender.org/blender/blender/pulls/123483
`VK_EXT_shader_stencil_export` isn't supported by NVIDIA devices.
This extension was recently added to support EEVEE PBR layer selection.
This PR makes this extension optional and selects the work around
when not supported by the physical device.
Fixes#114385
Pull Request: https://projects.blender.org/blender/blender/pulls/123470
Vulkan backend has recently switched to a render graph approach. Many
code was left so we could develop the render graph beside the previous
implementation. Last week we removed the switch. This PR will remove
most of the unused code. There might be some left and will be removed
when detected.
Pull Request: https://projects.blender.org/blender/blender/pulls/123422