This PR disables HDR when driver doesn't support
`VK_EXT_swapchain_colorspace`. It could be that Windows detect support
(DirectX) and allow users to enable HDR. But that it isn't supported by
the Vulkan part of the driver.
In case of Windows there might be an issue with using SRGB non
linear on F16 swapchains where somewhere an additional transform is
being performed. After adding support for other color spaces we should
remove the support of this swapchain configuration.
Pull Request: https://projects.blender.org/blender/blender/pulls/145325
* Improve accuracy of warning when HDR display is not supported, taking into
account HDR mode on/off on Windows.
* When HDR mode is disabled on Windows, don't create a HDR swapchain. This
saves memory, and avoids a color difference on NVIDIA. That's because NVIDIA
is the only GPU we've tested that allows a HDR swapchain when HDR mode is
off, and we don't currently know the expected transforms for that case.
* Recreate swapchain when HDR mode on/off switch is detected.
* Update HDR info when window gains focus.
Note this means there is no wide gamut when Windows HDR is off, but it was
already not working. For that we may need to add support for something like
10bit VK_COLOR_SPACE_DISPLAY_P3_NONLINEAR_EXT, or whatever is commonly
available outside of HDR mode.
Pull Request: https://projects.blender.org/blender/blender/pulls/144959
This PR adds a slip tool in the toolbar with its own custom icon for
applying slips using the mouse. This is useful for e.g. tablets where a
keyboard is not handy and a button would be best to activate the
operator.
There is also a custom cursor that appears when hovering over valid,
slippable strips (and a "stop" icon when the strip cannot be slipped).
Alt may be used in order to ignore slipping connected strips when using
the tool, similar to selection logic. The slip tool only performs its
sole function of slipping and as such does not change the selection
state.
In the future, we can also add "slide" functionality to the same tool,
giving it multiple functions.
Pull Request: https://projects.blender.org/blender/blender/pulls/143513
This PR adds HDR support for Windows for `VK_COLOR_SPACE_EXTENDED_SRGB_LINEAR_EXT`
on `VK_FORMAT_R16G16B16A16_SFLOAT` swapchains .
For nonlinear surface formats (sRGB and extended sRGB) the back buffer is blit into the swapchain,
When VK_COLOR_SPACE_EXTENDED_SRGB_LINEAR_EXT is used as surface format a compute shader
is used to flip and invert the gamma.
SDR white level is updated from a few window event changes, but actually
none of them immediately respond to SDR white level changes in the system.
That requires using the WinRT API, which we don't do so far.
Current limitations:
- Intel GPU support
- Dual GPU support
In the future we may add controls inside Blender for absolute HDR nits,
across different platforms. But this makes behavior closer to macOS.
See !144565 for details
Co-authored-by: Brecht Van Lommel <brecht@blender.org>
Pull Request: https://projects.blender.org/blender/blender/pulls/144717
First advance to the next frame and use the same index for all
resources. Previous implementation used a fence of the next frame, what
added confusion why that was actually needed.
Should not make a change in functionality or performance.
Pull Request: https://projects.blender.org/blender/blender/pulls/144615
Blender had some support for using MoltenVK. However there are some key
issues why MotlenVK cannot be used. Bugs have been reported up-stream.
As it doesn't work and holds back regular developments it will be removed
from the main branch.
Any efforts on making Vulkan run on Apple (including KosmicKrisp)
is considered a community effort and can be done in a development
branch.
Pull Request: https://projects.blender.org/blender/blender/pulls/144602
Add a command line argument --gpu-vsync on/off/auto.
Prefer command line arguments for GPU settings,
as it means the value is error checked and set when Blender starts.
Also refactor GHOST_Context to take a parameter argument which
includes the stereo-visual & debug arguments and includes the newly
added vsync setting. This makes it possible to add GPU context
parameters more easily in the future.
It also removes redundant parsing & setting the VSync setting for
off-screen contexts.
Changes to recent PR !143049.
Ref !144473
Use RAII for `GHOST_WindowClass`.
For the main Blender executable, only one `GHOST_System` is ever
created. But when running tests, this can happen multiple times (eg,
GPUOpenGLTest and GPUOpenGLWorkaroundsTest).
This results in `GHOST_SystemWin32` trying to register
`GHOST_WindowClass` multiple times, so `RegisterClassW` fails with
`ERROR_CLASS_ALREADY_EXISTS`.
Pull Request: https://projects.blender.org/blender/blender/pulls/144231
With 5.0 we start requiring this extension for GL and VK.
All of our target hardware supports it with up to date
drivers.
Some old drivers were disabling this extension because of
buggy behavior. We simply drop support for them in 5.0.
This allows us to remove a lot of code and the last
shader create info override done at startup. This will
unlock more refactoring of the shader create info into
static classes to reduce binary size and other benefits.
## TODO:
- [x] Remove checks for ARB_shader_draw_parameters
- [x] Remove checks for ARB_clip_control
- [x] Check for the extension on startup for OpenGL
- [x] Check for the extension on startup for Vulkan
- [x] ~~Add user facing popup message about minimum
requirements not being met.~~ Done using the same
popup as old hardware.
Pull Request: https://projects.blender.org/blender/blender/pulls/142334
This PR will swap device local memory to system ram. It relies on
VK_EXT_external_memory and VK_EXT_pageable_device_local_memory
extensions to be supported by the system.
Most platforms support these extensions.
Pull Request: https://projects.blender.org/blender/blender/pulls/144422
* GHOST is an implementation detail, Blender environment variables should
have the BLENDER_ prefix.
* Don't put links in command line help output. We don't do this for other
arguments either, and it's trivial to search for this online.
* Make description more straightforward and line wrap.
* Use CLOG for logging.
Ref #143049
Pull Request: https://projects.blender.org/blender/blender/pulls/144349
This PR proposes to add an environment variable for forcing vsync to
be on or off. My primary use case was to disable vsync for forcing
viewport rendering performance tests not to be capped at the display
refresh rate when #142984 is used for removing animation frame rate
limits.
I initially added the environment variable "GHOST_VSYNC_OFF", but
found "GHOST_VSYNC=0/1" to be more easily understandable.
Usage:
- GHOST_VSYNC=0 => Vsync is forced off
- GHOST_VSYNC=1 => Vsync is forced on
Pull Request: https://projects.blender.org/blender/blender/pulls/143049
Resolve regression in [0] where setting the cursor wasn't checking
if a software cursor was used. This would then show the hardware &
software cursors.
[0]: 232b106e64
Swapchain handling of minimized windows wasn't correct. On some
platforms it still tried to create images with no surface.
This PR will discard swapchains of minimized windows, but still being
able to flush the render graph and free resources.
Pull Request: https://projects.blender.org/blender/blender/pulls/144189
Vulkan 1.0 render passes have been replaced by dynamic rendering in 1.2.
Blender Vulkan backend was implemented with dynamic rendering in mind.
All our supported platforms support dynamic rendering. Render pass support
was added to try to work around an issue with legacy drivers. However these
drivers also fail with render passes.
Using render passes had several limitations (blending and some workbench
features were not supported). As no GPU uses it and it is quite some code
to support it is better to remove it.
Pull Request: https://projects.blender.org/blender/blender/pulls/144149
This PR removes the deferred allocation of swapchain images. A lot of layers
don't support this and will crash when used.
Thanks to Jorn Visser to point out the potential issue.
Pull Request: https://projects.blender.org/blender/blender/pulls/143924
Generate mouse events from touch devices on Wayland.
The code tracks a single contact point and converts it to mouse moves,
LMB presses & releases. Multi-touch, pinch & swipe aren't yet supported.
Addresses #121449.
Ref !143416
Co-authored-by: Campbell Barton <campbell@blender.org>
This commit renames the GHOST Metal graphic context class and related
files / references from `GHOST_ContextCGL` to `GHOST_ContextMTL`. When
the Metal backend was first introduced, this context file contained
both the old OpenGL context (CGL, for macOS Core OpenGL API), and the
newer Metal context. Since #110185 all CGL related code was removed
from the class, making it Metal only, and thus rendering the old class
name outdated and potentially misleading. In addition to the rename,
unused OpenGL related forward declarations and old TODOs were also
removed.
Pull Request: https://projects.blender.org/blender/blender/pulls/142519
This PR allows blender to be compiled with OpenXR, but without
OpenGL support.
For investigating a bug we needed to compile Blender without
OpenGL (`WITH_OPENGL_BACKEND=OFF`) but it would fail to
compile OpenXR (`WITH_XR_OPENXR=ON`). This PR tweakes
the preprocess directives to compile the openxr graphics
binding without OpenGL.
Co-authored-by: Jonas Holzman <jonas@holzman.fr>
Pull Request: https://projects.blender.org/blender/blender/pulls/141668
- Cursors in wayland are expected to use pre-multiplied alpha.
Note that cursor generators create straight alpha,
pre multiplier in the wayland backend.
- Invert cursor colors on Wayland since dark cursors are often default,
this could use dark theme settings in the future.
Support showing vector cursors at the appropriate size based on each
monitors DPI.
This solves incorrectly sized cursors with Hi-DPI outputs as well as
supporting outputs with different DPI's.
Instead of passing pixel data, pass an object that can generate cursors,
GHOST/Wayland can then ensure the correct size is used based on the
display the cursor is shown on.
While may sound overly complicated it actually simplifies displaying
cursors on Wayland, especially for multiple monitors at different DPI's.
Showing cursors at higher or lower resolutions than the monitor's DPI
also behaves differently on GNOME & Plasma, resulting in situations
where the cursor would show larger/smaller than expected.
Details:
- Take advantage of the recently added SVG cursors & BLF time cursor
!140990 & !141367.
- Setting bitmap cursors via GHOST_SetCustomCursorShape is now a no-op
for Wayland since it's no longer used. This was supported in an
earlier version of this PR and could be restored if needed.
- While fractional scaling works it relies on the compositor downscaling
the cursors. Ideally they would be rendered at the target size but
this isn't a priority as the difference isn't noticeable.
Ref !141597