Commit Graph

14908 Commits

Author SHA1 Message Date
Campbell Barton
707a3aa4f9 Cleanup: remove redundant check
Missed in cleanup !137050.
2025-04-17 03:34:25 +00:00
Harley Acheson
914d2e8164 UI: Reverse Pen Y Tilt Expected Direction
It is more convenient for math reasons, for Blender to treat a pen tilt
toward the user as a positive angle. This PR just reverses all the
comments about the expected values. And also reverses the values from
WinTab, Windows Ink, and Wayland to match.

Pull Request: https://projects.blender.org/blender/blender/pulls/137636
2025-04-17 04:26:58 +02:00
Campbell Barton
64f5dee6d7 Cleanup: spelling in comments (make check_spelling_*) 2025-04-17 12:06:12 +10:00
Harley Acheson
2e1a12905d Cleanup: Remove WIN32_COMPOSITING
This PR removes unused Win32 code that we've had for about 13 years,
hidden behind a define that we've never enabled. The intent of this
optional code was to allow showing Blender windows as transparent,
something that looked pretty cool back then. The main method used was
an API call of DwmEnableBlurBehindWindow, but this function has not
done anything since Windows 8 because styles and tastes have changed.

Pull Request: https://projects.blender.org/blender/blender/pulls/137620
2025-04-16 22:01:29 +02:00
Harley Acheson
cf4778df74 UI: Remove Initial Win32 White Flash During Startup
On the Windows platform we get an initial bright white flash during
startup, before we start drawing on our canvas. This PR changes that
initial color to a mid-grey that is much less noticeable. After this
initial fill is done we then clear the background brush so Windows will
not use it later and slow down resizing by adding extra WM_PAINT
messages and fills.

Pull Request: https://projects.blender.org/blender/blender/pulls/137488
2025-04-16 19:51:45 +02:00
Clément Foucault
99cb3071c0 Fix #137598: OCIO: Broken shader compilation with specific config
The GLSL code generated by some OCIO configuration was
not MSL ready. Use our preprocessor on them in order
to make them compatible before creating the GPUShader.

Needs ac7e361f3d
2025-04-16 19:06:45 +02:00
Harley Acheson
e1e250aa84 UI: Consistent Pen Tilt Values
Pen tilt values come into Blender through ghost platforms and device
drivers with inconsistent and ambiguous directions. This PR codifies
that we consider tilt-x positive values to be rightward, negative
values as leftward. Similarly tilt-y positive is away from the user,
negative is toward the user. Comments are updated to make this clear.
This fixes Windows Ink (currently always returning left and away). This
also reverses the Wayland tily-y values to match. We might still have
to consider a user preference to swap directions if we find differences
within a platform.

Pull Request: https://projects.blender.org/blender/blender/pulls/137501
2025-04-15 20:23:32 +02:00
Jeroen Bakker
9eb0f59264 Cleanup: Vulkan: Remove obsolete extension 2025-04-15 12:16:52 +02:00
Alaska
0a7a12f873 Cycles: Print additional warnings about unsupported oneAPI driver versions to terminal
This commit adds some extra prints to terminal related to oneAPI driver
information in the situation that the driver version is considered
incompatible with the current version of Cycles.

Pull Request: https://projects.blender.org/blender/blender/pulls/137272
2025-04-15 09:03:45 +02:00
Jacques Lucke
3ae20bf166 Cleanup: remove foreach macro from .clang-format
The usage of that macro was removed in 60bec183cb,
but it was still in our .clang-format file. This lead to worse formatting when other code
used methods named `foreach`.

Pull Request: https://projects.blender.org/blender/blender/pulls/137468
2025-04-14 16:17:00 +02:00
Brecht Van Lommel
1cb2244e90 Fix: Cycles build error when WITH_CYCLES_OSL=OFF 2025-04-14 11:35:22 +02:00
Brecht Van Lommel
845776a665 Fix: OpenColorIO color processors pointers not deleted correctly
And change to reinterpret_cast in a few other places.
2025-04-14 11:35:22 +02:00
John Kiril Swenson
5a2a6da0a2 VSE: Blade Tool Cursor
This patch adds initial cursor support for the blade tool, with bitmaps
for 16x16, 24x24, and 32x32 cursors.

Additional Changes:
- Locked strips now show a "stop" icon when hovered over.
- Previously, the frame to split was truncated when clicking in between frames.
  Now, round to the closest frame.
- Previously, the blade operator was able to select padded strip handles
  outside of strip bounds. This bug has been resolved, so that selection with
  the blade tool can only happen via box-select passthrough.

Pull Request: https://projects.blender.org/blender/blender/pulls/136749
2025-04-13 22:49:18 +02:00
Campbell Barton
5affe5fc6d Cleanup: spelling in comments (make check_spelling_*) 2025-04-12 19:31:29 +10:00
Campbell Barton
d700bc5f54 Cleanup: remove use of unsafe string functions 2025-04-12 18:42:44 +10:00
Campbell Barton
3bf92a6e83 Cleanup: rename nullptr to null for null-characters 2025-04-11 23:55:00 +00:00
Clément Foucault
9990273d04 GPU: Change Type enum to use lower case values
This is to help for future resource declaration
using macros.

Rel #137261

Pull Request: https://projects.blender.org/blender/blender/pulls/137367
2025-04-11 22:39:01 +02:00
Brecht Van Lommel
c8f9fdc0c8 Fix: Cycles CUDA errors after recent changes for scene update
Broken by 86b67a20d6. Delay upload of shader data to GPU until
after kernels have been loaded.

Pull Request: https://projects.blender.org/blender/blender/pulls/137349
2025-04-11 19:14:14 +02:00
Brecht Van Lommel
86b67a20d6 Refactor: Cycles: Move scene update earlier in render iteration update
This will be needed to determine if there are volumes in the scene, before
allocation passes to aid volume sampling.

The kernels are now also loaded in the middle of scene update, at a place
where kernel features are known but before the kernels are needed for
displacement and background light evaluation..

Updating the camera to final resolution for progressive refinement still
happens later.

Pull Request: https://projects.blender.org/blender/blender/pulls/137228
2025-04-11 14:28:22 +02:00
Brecht Van Lommel
c4db213127 Refactor: Cycles: Use full resolution for viewplane bounds check
Results should be unchanged, but it's confusing if these use the progressive
refinement resolution instead of the full resolution.

Pull Request: https://projects.blender.org/blender/blender/pulls/137228
2025-04-11 14:28:22 +02:00
Sergey Sharybin
9f999adfc6 Fix #137230: Cycles OpenPGL crash with shadow catcher
The crash was caused by an overflow in the opgl_path_segment_storage
array. It happened because shadow catcher paths would write to the
segments but not clear them. This made it so the next render loop
iteration for the main path starts with non-empty segments in the
guiding data.

Disable training when megakernel is called for the shadow catcher
state.

To ensure this issue is not forgotten when the guiding is ported to
GPU add asserts in the `guiding.h`. While it is a no-op for default
GPU kernels sometimes we do compile debug kernels. But also it acts
as a plain-text reminder to the future-us in working on the code.

There is now also an assert before the main path megakernel to help
catching such cases in the future.

Pull Request: https://projects.blender.org/blender/blender/pulls/137291
2025-04-11 12:31:22 +02:00
Campbell Barton
44444a550e Fix #135039: Vulkan: Blender does not start with Wayland in GNOME
Remove logic to access LIBDECOR's underlying XDG window since it
required an "dummy-buffer" workaround which caused a crash with recent
drivers that require a DMA buffer.

This introduces a slight flicker on startup in some cases
see code-comments for details.

Ref: !136289
2025-04-11 09:44:46 +00:00
Jeroen Bakker
3da222cb9a Vulkan/OpenXR: Direct3D Bridge
Some OpenXR platforms do not support OpenGL or Vulkan. To support these
platforms we use a bridge. Blender still renders in OpenGL/Vulkan, but
will copy the render result into a D3D11 swapchain.

OpenGL doesn this by importing the D3D11 swapchain into the OpenGL
context and perfor OpenGL calls to update the swapchain. However for
vulkan that could lead to construct 3 context for OpenXR

- Blender GPU Context
- OpenXR D3D Context
- New context that imports the Blender render result and the OpenXR
  Swapchain image and copies them.

Due to Direct3D limitations importing into a vulkan context has known
issues (driver + extensions). Secondly we are not sure if we are running
on the same device as the OpenXR swapchain. The solution provided with
this PR is to only support CPU data transfers.

**SteamVR using d3d bridge**

SteamVR normally would use the Vulkan binding. But by changing the binding
priority in code you can make it select the D3D bridge.

<img width="1518" alt="Screenshot 2025-04-10 114534.png" src="attachments/f856bb2b-9ad5-4bb2-9cfd-a1412da9edd1">

It has been tested and validated to work using Mixed reality portal as well.

Pull Request: https://projects.blender.org/blender/blender/pulls/137264
2025-04-10 16:15:27 +02:00
Brecht Van Lommel
7aaa43b557 Revert "Fix: Build failures when using path with spaces on macOS"
This reverts commit be63ebd961.

This doesn't work well with MSBuild, semicolons get escaped even in
verbatim mode.
2025-04-10 13:04:34 +02:00
Jeroen Bakker
969e70fed8 Fix: Vulkan: Unable to start on WoA
Current Windows on ARM GPUs don't support
extenral memory. External memory is required
for OpenXR. So most likely OpenXR will not work
on these devices.

Most (read all) OpenXR platforms that support
vulkan also require external memory. So might
just be that those platforms won't work at all
on these devices.

In any case when not supported, the GHOST
OpenXR platform will use CPU for data transfer.
2025-04-10 10:15:23 +02:00
Jeroen Bakker
ae8665b8b2 Cleanup: Missing pragma once 2025-04-10 09:36:19 +02:00
Jeroen Bakker
6f6df389a1 Cleanup: OpenXR: Move Direct3D to its own compile unit
_No response_

Pull Request: https://projects.blender.org/blender/blender/pulls/137255
2025-04-10 09:32:48 +02:00
Jeroen Bakker
07a9306bb4 Cleanup: Vulkan/OpenXR: Pass Blender context via constructor
Similar to Direct3D.

Pull Request: https://projects.blender.org/blender/blender/pulls/137254
2025-04-10 08:51:20 +02:00
Jeroen Bakker
a564a27c1f Cleanup: OpenXR: Introduce a Direct3D base class.
For the Vulkan/OpenXR code will be shared with the OpenGL-Direct3D
bridge. This cleanup separates the OpenGL specifics in its own class.

Pull Request: https://projects.blender.org/blender/blender/pulls/137252
2025-04-10 08:50:52 +02:00
Campbell Barton
b2dbfa7d77 Cleanup: spelling in comments, use doxygen comments 2025-04-10 13:02:29 +10:00
Sergey Sharybin
30b962b3d8 Cycles: Optimize 3d and 4d noise
The goal is to reduce the affect of the fmod() used in the noise code,
which was initially reported in the comment:

    https://projects.blender.org/blender/blender/pulls/119884#issuecomment-1258902

Basic idea is to benefit from SIMD vectorization on CPU.

Tested on Linux i9-11900K and macOS on M2 Ultra, in both cases performance
after this change is very close to what it could be with the fmod() commented
out (the call itself, `p = p + precision_correction`).

On macOS the penalty of fmod() was about 10%, on Linux it was closer to 30%
when built with GCC-13. With Linux builds from the buildbot it is more like 18%.

The optimization is only done for 3d and 4d noise. It might be possible to
gain some performance improvement for 1d and 2d cases, but the approach would
need to be different: we'd need to optimize scalar version fmodf(). Maybe
tricks with integer cast will be faster (since we are a bit optimistic in the
kernel and do not guarantee exact behavior in extreme cases such as NaN inputs).

Pull Request: https://projects.blender.org/blender/blender/pulls/137109
2025-04-09 13:40:10 +02:00
Campbell Barton
bf03a2684b Fix: error with CMake checking the wrong WEBP variable 2025-04-09 10:21:37 +10:00
Sergey Sharybin
5b0ed683a0 Cycles: Make select() and mask() for vectorized float work on CPU and GPU
Pull Request: https://projects.blender.org/blender/blender/pulls/137148
2025-04-08 17:04:18 +02:00
Jeroen Bakker
7ecacbc3e6 Vulkan/OpenXR: Support VK_KHR_external_memory_win32
This PR add support to use a win32 handle to perform share render
result with the OpenXR vulkan instance. This is only possible when
the GPU matches. Otherwise a CPU roundtrip will be performed.

Pull Request: https://projects.blender.org/blender/blender/pulls/137093
2025-04-08 15:21:55 +02:00
Brecht Van Lommel
6db2c6b864 Revert: Part of "Fix: Build failures when using path with spaces"
Commit be63ebd961

This is causing issues with CUDA kernel compilation in some setups, even
though the builbot is ok. Since this isn't yet working for oneAPI anyway,
revert all the changes to Cycles kernel compilation for now.
2025-04-08 14:55:03 +02:00
Jeroen Bakker
22ae59d28d Vulkan: Include Win32 extensions definitions
Includes win32 specific extensions definitions when including
`vk_common.hh`. Inside `gpu_context.cc` vulkan needs to be
included before opengl, otherwise windows 10 builders will
report a warning.

```
[6421/7520] Building CXX object source\blender\gpu\CMakeFiles\bf_gpu.dir\intern\gpu_context.cc.obj
C:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\shared\minwindef.h(130): warning C4005: 'APIENTRY': macro redefinition
C:\Users\blender\git\blender-vexp\blender.git\lib\windows_x64\epoxy\include\epoxy/gl.h(59): note: see previous definition of 'APIENTRY'
```

Pull Request: https://projects.blender.org/blender/blender/pulls/137134
2025-04-08 14:10:01 +02:00
Jeroen Bakker
70995180ed Fix: Vulkan/OpenXR: Incorrect swapchain image layout
In the OpenXR/Vulkan specs it is mentioned that the swapchain layout
should be set to optimal color attachment. This wasn't the case and
could lead to validation errors.

Also fixes a memory size validation error. Not concerning as it was
abount already backed memory.

Pull Request: https://projects.blender.org/blender/blender/pulls/137143
2025-04-08 13:35:23 +02:00
Campbell Barton
0b369b6613 Cleanup: remove GHOST_TaskbarX11
This only worked for Ubuntu's discontinued Unity desktop.

Even though `libunity.so` can be used outside of Unity,
it's no longer actively developed.

Ref: !137128
2025-04-08 10:56:29 +00:00
Campbell Barton
3a51d140d8 Cleanup: remove WITH_X11_XF86VMODE since mode setting is no longer used
Setting the display mode was last used for the Game Engine
remove the CMake option WITH_X11_XF86VMODE and the associated code.

Ref: !137126
2025-04-08 10:56:27 +00:00
Jeroen Bakker
566c3d0846 Fix: Vulkan/OpenXR: Crash when vulkan physical device not found
When using SteamVR without starting SteamVR, the physical device cannot
be found. This isn't reported to the user nicely. This change will
tell the user why OpenXR couldn't be started.

Note that the physical device can be created when SteamVR has already
launched. OpenGL will start SteamVR automatically, but seems Vulkan
isn't able to do that.
2025-04-08 11:30:29 +02:00
Campbell Barton
f459d97dfd Cleanup: remove unused full-screen support from GHOST
Remove full-screen support from GHOST API's.
Note that this only had back-end implements for X11 and WIN32.

This was last used for the Game Engine to run games full-screen,
removing as it's unused and it doesn't seem likely to be used in the
future.

This doesn't impact making Blender full-screen from the window menu
which uses a window decoration setting.

Ref: !137050
2025-04-08 05:18:57 +00:00
Brecht Van Lommel
be63ebd961 Fix: Build failures when using path with spaces on macOS
Use VERBATIM to ensure spaces inside command line arguments don't get
escaped automatically.

On Linux and Windows the oneAPI kernel compilation still has problems.
There is an apparent bug with single quote escaping in add_custom_command
which means it's not easy to use VERBATIM.
2025-04-07 16:29:14 +02:00
Campbell Barton
0ff9a162c1 Fix: memory leak on Wayland with IME
For practical purposes this only leaks on exit,
unless seats are change at run-time.
2025-04-07 11:24:02 +00:00
Alaska
975d61daf3 Cycles: Disable MNEE on RDNA4 GPUs
At the moment MNEE locks up Cycles, or has rendering artifacts on
RDNA4 GPUs on WIndows.

This commit disables MNEE on that configuration until a fix
is avaliable.

Pull Request: https://projects.blender.org/blender/blender/pulls/136980
2025-04-05 14:06:40 +02:00
Campbell Barton
f48b4e3abf Cleanup: wrap long lines for CMake 2025-04-05 20:30:37 +11:00
Campbell Barton
e7c9ea3b27 Cleanup: correct typo in variable name & comments 2025-04-05 08:49:20 +00:00
Jesse Yurkovich
40cbc09d56 Cleanup: correct typos
_No response_

Pull Request: https://projects.blender.org/blender/blender/pulls/137009
2025-04-04 22:58:10 +02:00
Jesse Yurkovich
f60c528c48 Cleanup: Fix one-definition-rule violations for various structs
This fixes most "One Definition Rule" violations inside blender proper
resulting from duplicate structures of the same name. The fixes were
made similar to that of !135491. See also #120444 for how this has come
up in the past.

These were found by using the following compile options:
-flto=4 -Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing

Note: There are still various ODR issues remaining that require
more / different fixes than what was done here.

Pull Request: https://projects.blender.org/blender/blender/pulls/136371
2025-04-04 21:05:16 +02:00
Germano Cavalcante
3ab65cff04 Windows: show popup after crash
Implements a crash dialog for Windows.

The crash popup provides the following actions:
- Restart: reopen Blender from the last saved or auto-saved time
- Report a Bug: forward to Blender bug tracker
- View Crash Log: open the .txt file with the crash log
- Close: Closes without any further action

Pull Request: https://projects.blender.org/blender/blender/pulls/129974
2025-04-04 18:38:53 +02:00
Miguel Pozo
2d75688259 GHOST: Add GHOST_GetActiveGPUContext()
Track the (per-thread) active `GHOST_Context`.
This is required to restore the active context after creating a new one
if the current context is unknown.
(Required for creating GPU contexts in the GPU module without depending
on the WM module)

Pull Request: https://projects.blender.org/blender/blender/pulls/136992
2025-04-04 18:14:13 +02:00