Commit Graph

13290 Commits

Author SHA1 Message Date
Campbell Barton 39295476d0 Cleanup: store const events in GHOST's event handling logic 2023-10-08 15:23:40 +11:00
Campbell Barton fc78182cc8 Refactor: use const event data, use static_casts
In some cases processing events was modifying them, as there can be
multiple event consumers, manipulating events isn't correct.
Even though in practice it didn't cause issues, it's straightforward
not to do this and makes logic easier to reason about.
2023-10-08 15:23:39 +11:00
Campbell Barton 0bf7d15fa6 Cleanup: replace strncpy with memcpy for buffers of a known size 2023-10-08 14:34:27 +11:00
Campbell Barton 8f8a9ef488 Cleanup: remove unused GHOST_kEventTimer
There was a type error assigning customdata, (wmTimer *) was expected
although this data isn't created so it was never hit.
2023-10-08 14:31:15 +11:00
Campbell Barton 0742ef808f Fix writing past struct bounds of GHOST_TEventImeData
IME editing would cast GHOST_TEventImeData to wmIMEData then read/write
an additional member that doesn't exist in GHOST_TEventImeData.

In practice it's likely struct padding prevented this from showing up
as a bug. Nevertheless it's bad practice to rely on this.

- Make GHOST_TEventImeData read-only, move the is_ime_composing boolean
  into the window.
- Add static assert to ensure both structs are the same size.
- Correct code comments.
2023-10-08 14:29:08 +11:00
Campbell Barton 519d29423d Fix building WITH_GHOST_DEBUG without NDOF 2023-10-08 14:28:25 +11:00
Campbell Barton 0c91466785 GHOST/Wayland: remove WITH_GHOST_WAYLAND_DBUS
This was only used for accessing cursor themes which only worked
with gnome and wasn't used in official releases.
Use the default theme or the theme defined by XCURSOR_THEME.

Eventually wp_cursor_shape_manager_v1 can be supported which avoids
having to access the theme.
2023-10-07 21:31:15 +11:00
Campbell Barton e8834565a3 CMake: support building GHOST/X11 without OpenGL 2023-10-07 21:22:15 +11:00
Campbell Barton f3f494fd63 macOS: fix issues building without OpenGL headers
macOS has WITH_OPENGL_BACKEND disabled but still included
`epoxy/gl.h` and defined an unused NSOpenGLContext.
2023-10-07 20:51:24 +11:00
Campbell Barton 149d80946e Cleanup: CMake formatting 2023-10-07 19:46:38 +11:00
Campbell Barton 1bb098bf44 CMake: WITH_OPENGL_BACKEND=OFF excludes EGL/EPOXY includes & libraries
This isn't complete as opensubdiv, hydra & XR still depend on OpenGL.
2023-10-07 18:30:17 +11:00
Campbell Barton a17d6efe98 Cleanup: correct enums used as booleans 2023-10-07 18:28:09 +11:00
Campbell Barton 126cf64004 CMake: quiet undefined variable use with MOLTENVK on non-apple systems 2023-10-07 18:25:44 +11:00
Brecht Van Lommel 1e567d05e9 Merge branch 'blender-v4.0-release' into main 2023-10-06 20:11:54 +02:00
Brecht Van Lommel c1b4af86b9 Cycles: Speed up principled BSDF when IOR = 1.0
Skip the specular layer of the principled BSDF when IOR=1.0
since it has no visual impact on the material.

Pull Request: https://projects.blender.org/blender/blender/pulls/111586
2023-10-06 20:09:35 +02:00
Alaska 33cbe4c108 Fix Cycles SVM not using IOR Level for Subsurface entry
Make it consistent with OSL.

Pull Request: https://projects.blender.org/blender/blender/pulls/113192
2023-10-06 19:07:59 +02:00
Alaska 61a8d1f7d0 Cycles: Use tabulated Sobol for old files, for better compatibility
This only has an effect when using Cycles debug settings.

Pull Request: https://projects.blender.org/blender/blender/pulls/112553
2023-10-06 19:07:54 +02:00
Jeroen Bakker 9a654c04de Vulkan: Wayland Windowing
Wayland WSI would crash the system when used. The reason is that the
wayland vulkan WSI doesn't provide windowing support. Vulkan gets full access
to the desktop of the OS and it is the responsibilty of the application to
do the right thing.

For OpenGL Wayland proved basic windowing support using `wayland-egl.h`.
Which essentially is a tiny wrapper that keeps track of the window position and
size.

This PR changes a few things to make the Wayland surface usable:

- Do not load debug extensions when blender isn't started with
  `--debug-gpu`.
- Recreate swapchain images when surface size changes.

Pull Request: https://projects.blender.org/blender/blender/pulls/113007
2023-10-06 14:45:09 +02:00
Xavier Hallade d26a2b09bc Cycles: oneAPI: use hardware cos
Speckles and missing lights were experienced in scenes with Nishita Sky
Texture and a Sun Size smaller than 1.5°, such as in Lone Monk and Attic
scenes.
We previously worked around these by using a more precise
software implementation of cosine.
After recent changes in Cycles, it turns out this workaround isn't
currently needed.
2023-10-06 13:10:27 +02:00
Campbell Barton 6b2f9dd71d Merge branch 'blender-v4.0-release' 2023-10-06 17:34:18 +11:00
Campbell Barton e1dac0b122 Fix glitch resizing windows with LIBDECOR on Wayland
The window contents and the window boarders were noticeably out of sync
when resizing the window quickly.

Resolve by keeping the current size as-is, rely on deferred handling
of the pending window size to apply the new size along with the contents.
2023-10-06 17:32:43 +11:00
Campbell Barton a110873f52 Merge branch 'blender-v4.0-release' 2023-10-06 17:15:15 +11:00
Campbell Barton 9ddb3143c0 Merge branch 'blender-v4.0-release' 2023-10-06 17:15:13 +11:00
Campbell Barton b9d300380f Cleanup: correct typo in assertions 2023-10-06 17:13:44 +11:00
Campbell Barton d59a79ef95 Fix redundant window activation/deactivation events under Wayland
Any window state change (resizing for e.g.) triggered
activation/deactivation events. Resolve by only sending events on state
change. The activation caused cursor motion events from #107594.
2023-10-06 17:12:32 +11:00
Campbell Barton 31dce9d11d Merge branch 'blender-v4.0-release' 2023-10-06 16:21:01 +11:00
Campbell Barton 36021021aa GHOST/Wayland: remove window activation on tablet proximity in
Activating on tablet proximity isn't needed and would activate windows
that were already active. The window manager handles activation.
2023-10-06 16:20:08 +11:00
Campbell Barton ba472eb69e Merge branch 'blender-v4.0-release' 2023-10-06 16:16:58 +11:00
Campbell Barton c413a8d183 Fix error clearing the windows libdecor state on failure on Wayland
API docs note the state should remain unchanged when accessing the state
fails.
2023-10-06 16:15:47 +11:00
Lukas Stockner 7d908ed091 Merge branch 'blender-v4.0-release' 2023-10-06 02:26:33 +02:00
Lukas Stockner 887570065f Fix #112948: Cycles: Principled Sheen over Coat should use Coat normal
Conceptually, Sheen is layered over Coat, so if e.g. a bump map is applied
to the Coat layer, it should also affect Sheen.
2023-10-06 02:22:50 +02:00
Lukas Stockner c68f568eb3 Merge branch 'blender-v4.0-release' 2023-10-05 23:01:06 +02:00
Lukas Stockner 97dfbc9a63 Fix #110183: Cycles: Numerical issues with distant area light sampling
The solid angle computation for the sampling/PDF code was running into
cancellation issues for small solid angles.
Reformulating the terms using asin() instead avoids this.
2023-10-05 22:53:33 +02:00
Brecht Van Lommel 1849e192fa Merge branch 'blender-v4.0-release' into main 2023-10-05 22:03:29 +02:00
coyo_t b0706a57ac Fix #106760: Cycles OSL boolean socket not working
Pull Request: https://projects.blender.org/blender/blender/pulls/109576
2023-10-05 21:55:10 +02:00
Jeroen Bakker 6e18bb4e3e Vulkan: Make Maintenance4 Extension Optional
`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
2023-10-05 13:40:28 +02:00
Dalai Felinto a9aa0c3fc8 Cleanup: make format 2023-10-05 10:20:09 +02:00
Jeroen Bakker 9f891b6f98 Cleanuip: Make format 2023-10-05 09:33:12 +02:00
Campbell Barton 60b2b663cc Merge branch 'blender-v4.0-release' 2023-10-05 13:16:20 +11:00
Campbell Barton c9130e38e3 Cleanup: spelling in comments 2023-10-05 13:07:58 +11:00
Germano Cavalcante bd6b7088bf Fix #112978: MacOS no longer has a path associated with the window
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
2023-10-05 02:26:11 +02:00
Germano Cavalcante d6b2b5d0c5 Fix #112978: MacOS no longer has a path associated with the window
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`.
2023-10-04 21:23:38 -03:00
Sergey Sharybin d7a21d0199 Merge branch 'blender-v4.0-release' 2023-10-04 18:10:50 +02:00
Sergey Sharybin d522938fd5 macOS: Enable secure coding for restorable state
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
2023-10-04 18:09:27 +02:00
Lukas Stockner e95ae963d9 Merge branch 'blender-v4.0-release' 2023-10-04 13:59:45 +02:00
Lukas Stockner d071e0a5fc Fix #113058: Cycles: Bump mapping causing dark edges with subsurface
The refractive entry bounce does not like being below the shading normal,
so use the existing clamping logic.
2023-10-04 13:28:20 +02:00
Campbell Barton ddad645157 Fix use after free error in recent check for EGL context
Correct error in [0].

[0]: 5ae917ffe9
2023-10-04 13:16:44 +11:00
Campbell Barton 5ae917ffe9 Fix GHOST_SystemWayland::disposeContext assuming an EGL context
Only destroy the EGL window for OpenGL contexts.
2023-10-04 10:17:36 +11:00
Brecht Van Lommel 660d8de7e4 Merge branch 'blender-v4.0-release' into main 2023-10-03 20:31:04 +02:00
Brecht Van Lommel 2f3e3cda51 Fix #113034: Cycles sheen breaks with low roughness
Also minor optimization to replace division by multiplication.
2023-10-03 20:30:40 +02:00