`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
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
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`.
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
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.
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.
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).
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
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.
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
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
Problem caused by [0], resolve by only printing error messages
when none of the GHOST back-ends are able to start.
[0]: f58d596c36c81245ed8c5723e5fa8369106a7a80
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
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.
- GHOST_SystemPathsCocoa::getUserSpecialDir
used `strncpy` without ensuring the string was null terminated.
- GHOST_SystemPathsCocoa::getBinaryDir
used `strcpy` without checking the destination buffer size.