Commit Graph

13457 Commits

Author SHA1 Message Date
Bastien Montagne
050d48edfc BLI_fileops: Harmonize 'rename' behaviors accross platforms.
This commit aim at making the behaviors of `BLI_rename` and
`BLI_rename_overwrite` more consistent and coherent across all
supported platforms.

* `BLI_rename` now only succeeds in case the target `to` path does not
  exists (similar to Windows `rename` behavior).
* `BLI_rename_overwrite` allows to replace an existing target `to` file
  or (empty) directory (similar to Unix `rename` behavior).

NOTE: In case the target is open by some process on the system, trying
to overwrite it will still fail on Windows, while it should succeed on
Unix-like systems.

The main change for Windows is the usage of `MoveFileExW`
instead of `_wrename`, which allows for 'native support' of file
overwrite (using the `MOVEFILE_REPLACE_EXISTING` flag). Directories
still need to be explicitly removed though.

The main change for *nix systems is the use of `renamex_np` (OSX) or
`renameat2` (most Linux systems) to allow forbidding renaming to an
already existing target in an 'atomic' way.

NOTE: While this commit aims at avoiding the TOC/TOU problem as
much as possible by using available system's primitives for most
common cases, there are some situations where race conditions
(filesystem changes between checks on FS state, and actual rename
operation) remain possible.

Pull Request: https://projects.blender.org/blender/blender/pulls/115096
2023-11-30 22:35:00 +01:00
Campbell Barton
a226b14984 Fix #114609: compose key sequences includes continuation keys on Wayland
Suppress characters typed while composing.
2023-11-30 16:42:42 +11:00
Campbell Barton
dfbda79cbd Cleanup: declare pointers const where possible 2023-11-30 16:42:40 +11:00
Campbell Barton
3b5031f1cb Cleanup: use 'r_' prefix for output arguments, order last
Also clarify some naming.
2023-11-30 10:42:18 +11:00
Hans Goudey
13c145ac02 Cleanup: Grammar in a few comments 2023-11-29 12:39:33 -05:00
Campbell Barton
278e37f8ce Cleanup: use default initializers for members of GWL_Seat 2023-11-29 16:05:30 +11:00
Campbell Barton
258a083066 Fix #115160: Keyboard layout sometimes ignored on Wayland
When using multiple keyboard layouts, the first layout would always
be used for internal keyboard layout queries.

This meant for e.g. with English layouts QWERTY & DVORAK both active
Control-C always used the QWERTY location for C even when DVORAK was
active.

Resolve by detecting layout changes & run xkb_state_update_mask
on all xkb_state's so internal queries always use the active layout.

Based on !115161, extended to detect layout changes & account for all
internal states.

Co-authored-by: Eugene Kuznetsov <eugene.kuznetsov@amd.com>
2023-11-29 15:18:42 +11:00
Campbell Barton
85e2dd66a0 Fix #113059: file selector shrinks on each display under KDE
Under KDE the initial window size includes the window decorations.
Add a workaround to enforce the requested window size for new windows
under KDE.
2023-11-29 15:18:40 +11:00
Ray molenkamp
94817f64b9 Cleanup: CMake: Modernize bf_intern_utfconv dependencies
- Remove any bf_intern_utfconv paths from INC
- Add a dependency though LIB when missing
- an empty target is created for non windows builds, so we don't have to
if(WIN32) this all over the place

context: https://devtalk.blender.org/t/cmake-cleanup/30260
Pull Request: https://projects.blender.org/blender/blender/pulls/115373
2023-11-28 01:11:15 +01:00
Brecht Van Lommel
1c50dd8bb8 Revert "Fix: Cycles: inconsistent normal checks when sampling and evaluating BSDF"
While this code is suspect, better to go back to the old state for now,
as there is no simple fix that doesn't introduce other issues.

Fix #115022
Fix #115414

This reverts commit 063a9e8964.
2023-11-27 17:01:59 +01:00
Brecht Van Lommel
3475ddce46 Fix #115424: Cycles object space normal map wrong with backfaces 2023-11-27 17:01:59 +01:00
Alaska
59a1148ac0 Fix #115206: Sheen renders incorrectly when viewed head on
Fixes an issue where the sheen would render incorrectly when
the normal of the surface is parallel to the incoming direction.

Co-authored-by: Lukas Stockner <lukas.stockner@freenet.de>

Pull Request: https://projects.blender.org/blender/blender/pulls/115286
2023-11-27 11:34:02 +01:00
Campbell Barton
f000b94a64 Cleanup: declare functions with overrides in GHOST_ContextVK 2023-11-27 10:59:54 +11:00
Campbell Barton
1eff48a838 Cleanup: spelling in code 2023-11-27 10:55:39 +11:00
Campbell Barton
27c660707d Cleanup: spelling in comments, variables 2023-11-27 09:54:36 +11:00
Campbell Barton
343b48663b Cleanup: format 2023-11-27 09:30:52 +11:00
Ray Molenkamp
1b6cd937ff Cleanup: CMake: Modernize bf_imbuf dependencies
Pretty straightforward

- Remove any bf_imbuf paths from INC
- Add a dependency though LIB when missing

context: https://devtalk.blender.org/t/cmake-cleanup/30260

Pull Request: https://projects.blender.org/blender/blender/pulls/115425
2023-11-25 23:37:24 +01:00
Ray Molenkamp
b683bcc46c Cleanup: CMake: Modernize bf_intern_clog dependencies
Pretty straightforward

- Remove any bf_intern_clog paths from INC
- Add a dependency though LIB when missing

context: https://devtalk.blender.org/t/cmake-cleanup/30260

Pull Request: https://projects.blender.org/blender/blender/pulls/115323
2023-11-24 17:12:24 +01:00
Jeroen Bakker
ec772ed2f1 Vulkan: Timeline Semaphores
This change adds timeline semaphores to track submissions. The previous
implementation used a fence.

Timeline semaphores can be tracked in more detail as it is an counter.
For each submission the counter can be stored locally and when waiting
for completion the counter can be retrieved again and checked if is
known to be succeeded by a higher value.

The timeline semaphore is stored next to the queue and can also be used
to synchronize between multiple contexts.

Pull Request: https://projects.blender.org/blender/blender/pulls/115357
2023-11-24 15:23:46 +01:00
Jeroen Bakker
d09d93febf Vulkan: Store Vertex, Index and Storage Buffers on Device Memory
Currently all buffer types were stored in host memory, which is visible to the GPU as well.
This is typically slow as the data would be transferred over the PCI bus when used.

Most of the time Index and Vertex buffers are written once and read many times so it makes
more sense to locate them on the GPU. Storage buffers typically require quick access as they
are created for shading/compute purposes.

This PR will try to store vertex buffers, index buffers and storage buffers on device memory
to improve the performance.

Uniform buffers are still located on host memory as they can be uploaded during binding process.
This can (will) reset the graphics pipeline triggering draw calls using unattached resources.

In future this could be optimized further as in:
* using different pools for allocating specific buffers, with a fallback when buffers cannot be
  stored on the GPU anymore.
* store uniform buffers in device memory

Pull Request: https://projects.blender.org/blender/blender/pulls/115343
2023-11-24 13:52:48 +01:00
Werner, Stefan
b12a87b28a Revert "Cycles: Added quality parameter for OIDN"
This reverts commit 2e2291dd83.
2023-11-23 13:50:00 +01:00
Stefan Werner
2e2291dd83 Cycles: Added quality parameter for OIDN
OpenImageDenoise has two modes, high quality and balanced. This now exposes the modes as user parameters, with viewport denoising defaulting to balanced and final frame rendering set to high quality.

Ref #115045

Co-authored-by: Werner, Stefan <stefan.werner@intel.com>
Pull Request: https://projects.blender.org/blender/blender/pulls/115265
2023-11-23 12:35:30 +01:00
Brecht Van Lommel
b9227da2db Cleanup: rename sse2 specific functions to avoid accidentally using them
Ref #115098

Pull Request: https://projects.blender.org/blender/blender/pulls/115098
2023-11-22 19:45:58 +01:00
Leon Marz
6ec0e0104a Fix build error on architectures without SSE or sse2neon
As color_srgb_to_linear is only defined for them.

Pull Request: https://projects.blender.org/blender/blender/pulls/115098
2023-11-22 19:45:53 +01:00
Leon Marz
ea1de499b3 Fix: Increase thread stack size for musl libc
Manually set the stack size to 2mb, same as with Apple

Co-authored-by: Damian Kurek <starfire24680@gmail.com>

Pull Request: https://projects.blender.org/blender/blender/pulls/115094
2023-11-22 19:37:13 +01:00
Sergey Sharybin
6207b83194 Revert "CMake: Give kernel compilation targets access to console"
The side effect which wasn't that obvious from the documentation
is that tasks in the console pool are executed sequentially. This
made the compile-gpu step to take a long time, because the parallel
compilation got disabled.

That was unintended change, so reverting the change.

Instead, for the buildbot, increase the time limit for the step.

This reverts commit 4b891b4afe.
2023-11-22 15:18:12 +01:00
Clément Foucault
a001cf9f2b EEVEE-Next: Displacement Option
This add the displacement option to EEVEE materials.
This unifies the option for Cycles and EEVEE.

The displacement only option is not matching cycles
and not particularly useful. So we decided to not
support it and revert to displacement + bump.

Pull Request: https://projects.blender.org/blender/blender/pulls/113979
2023-11-21 19:55:38 +01:00
Brecht Van Lommel
fa64573434 Cycles: clearer message when denoising in build without OpenImageDenoise
Fix #115200
2023-11-21 18:57:00 +01:00
Brecht Van Lommel
8845dba79d Fix Cycles rare assert in ensure_valid_specular_reflection
When the incoming direction is exactly orthogonal to the normal

Ref #115071
2023-11-21 18:39:56 +01:00
Jeroen Bakker
27fdfb6538 Vulkan: Memory Statistics
This PR shows the memory footprint in the statusbar when activated.
Only memory allocated on the VRAM is counted. Memory allocated on host
memory is not counted.

![image](/attachments/33cedc89-9ada-4c0a-9a94-6c1b3e22b64b)

Pull Request: https://projects.blender.org/blender/blender/pulls/115184
2023-11-20 14:08:19 +01:00
Stefan Werner
02b5e27f89 Cycles: Add Intel GPU support for OpenImageDenoise
OpenImageDenoise V2 comes with GPU support for various backends. This adds a new class, OIDNDenoiserGPU, in order to add this functionality into the existing Cycles post processing pipeline without having to change it much. OptiX and OIDN CPU denoising remain as they are. Rendering on a supported Intel GPU will automatically select the GPU denoiser.

Device support is initially limited to the oneAPI devices that are supported by Cycles, but can be extended.

Ref #115045

Co-authored-by: Stefan Werner <stefan.werner@intel.com>
Co-authored-by: Ray Molenkamp <github@lazydodo.com>
Pull Request: https://projects.blender.org/blender/blender/pulls/108314
2023-11-20 11:12:41 +01:00
Jesse Yurkovich
9eba3902c9 Fix: Allow Win32 clipboard to properly handle large images
The current code ran afoul of various arithmetic overflow conditions
when attempting to either Copy out or Paste in large images that would
overflow either the naive `w * h * 4` expression or the size of what the
DibV5 header allowed (DWORD, uint32_t).

Pull Request: https://projects.blender.org/blender/blender/pulls/115018
2023-11-18 22:46:41 +01:00
Hoshinova
0b11c591ec Nodes: Merge Musgrave node into Noise node
This path merges the Musgrave and Noise Texture nodes into a single
combined Noise Texture node. The reasoning is that both nodes
intrinsically do the same thing, which is the layering of Perlin noise
derivatives to produce fractal noise. So the patch de-duplicates code
and unifies the use of fractal noise for the end use.

Since the Noise node had a Distortion input and a Color output, while
the Musgrave node did not, those are now available to the Musgrave types
as new functionalities.

The Dimension input of the Musgrave node is analogous to the Roughness
input of the Noise node, so both inputs were unified to follow the same
behavior of the Roughness input, which is arguable more intuitive to
control. Similarly, the Detail input was slightly different across both
nodes, since the Noise node evaluated one extra layer of noise. This was
also unified to follow the behavior of the Noise node.

The patch, coincidentally fixes an unreported bug causing repeated
output for certain noise types and another floating precision bug
#112180.

The versioning code implemented with this patch ensures backward
compatibility for both the Musgrave and Noise Texture nodes. When
opening older Blender files in Blender 4.1 the output of both nodes are
guaranteed to always be exactly identical to that of Blender files
created before the nodes were merged in all cases.

Forward compatibility with Blender 4.0 is implemented by #114236.
Forward compatibility with Blender 3.6 LTS is implemented by #115015.

Pull Request: #111187
2023-11-18 09:40:44 +01:00
Patrick Mours
697114c4b6 Fix #113325: Zero-sized curve leads to OptiX error
Empty hair geometry in Cycles may still report having one curve, even when
there are no actual segments in that curve. This caused an attempt to build
an acceleration structure with zero primitives, which due to other setup
OptiX rejected with an error. Fix that by checking the number of segments
rather than the number of curves in the hair geometry, since the former will
always be zero for empty geometry.

Pull Request: https://projects.blender.org/blender/blender/pulls/115044
2023-11-17 17:20:57 +01:00
Germano Cavalcante
952d74ebbb Fix #114867: 'i' key in Turkish layout is marked as 'EVT_QUOTEKEY'
Different from most layouts. The Turkish keyboard layout treats the `i` as the lowercase `İ` and the `ı` as the lowercase `I`.

So we have 2 different types of i: `ı` and `İ`. And two different I key positions on the keyboard.

This key with a different position is mapped as special and returns the corresponding `event->type` of the US keyboard `"` (`EVT_QUOTEKEY`).

The apparently most appropriate event for this key would be `EVT_IKEY`.

This type of change needs to be treated with care, as it may alter other shortcuts that are already common to Turkish users.

Pull Request: https://projects.blender.org/blender/blender/pulls/114917
2023-11-15 15:45:45 +01:00
Michael Jones
0334ca0617 Cycles: Fix #114919: Disable MetalRT-by-default if macOS < 14.0
This PR fixes the issue of Cycles renders ending in compilation failure on base M3 machines which are still on their factory installed OS, older than14.0.

Pull Request: https://projects.blender.org/blender/blender/pulls/114920
2023-11-15 15:39:27 +01:00
Clément Foucault
3ead36a8ba GHOST: Cleanup: Remove GHOST_OPENGL_ALPHA
This is never define and has no use in current blender.

If we want to keep this functionality, we should
at the very least rename it to `GHOST_WINDOW_ALPHA`.

Pull Request: https://projects.blender.org/blender/blender/pulls/114815
2023-11-14 20:24:55 +01:00
Jeroen Bakker
4ecd6abf78 Vulkan: Make Anisotropy Sampling Optional
Anisotropy samplers are optional in Vulkan. This change will disable
anisotropy samplers when the feature isn't available on the device.

The support for anisotropy samplers is around 90% so would not expect
any compatibility issues.

Pull Request: https://projects.blender.org/blender/blender/pulls/114833
2023-11-14 12:24:46 +01:00
Hans Goudey
cda624032d Merge branch 'blender-v4.0-release' 2023-11-10 09:19:03 +01:00
Campbell Barton
4e6bca79cd Cleanup: quiet unused variable warnings in CMake
OpenMP_LIBRARIES was used when it wasn't defined.
2023-11-10 09:15:49 +11:00
Michael Jones
c30c6b2d4e Cycles: Fix Metal API validation error when Metal motion blur workaround is applied
Following #114544: When running with Metal API validation enabled, allocating a zero-sized buffer results in validation errors. This silences that.

Pull Request: https://projects.blender.org/blender/blender/pulls/114680
2023-11-09 22:23:37 +01:00
Xavier Hallade
e317831a82 Cycles: oneAPI: adjust reported device capabilities
It notably adds driver version as it can be helpful when triaging
end-user issues.
2023-11-09 21:46:27 +01:00
Brecht Van Lommel
7b26c3d517 Merge branch 'blender-v4.0-release' into main 2023-11-09 18:24:05 +01:00
salipourto
13171183fa Fix Cycles HIP RT issues with deformation motion blur
The first problem was triangles with motion blur were all grouped into
one category without separating the ones with and without triangle
motion steps.

The second problem was HIP RT uses the generic motion triangle
intersection function and this function checks prim_visibility buffer.
HIP RT doesn't provide the buffer per primitive but passes it to HIP RT
core per instance.

The buffer name was changed to prim_visibility from visibility to be
the same as what Cycles uses but when the motion triangle intersection
function is called from HIP RT kernels, the instance id is passed to
the function instead of primitive id.

Pull Request: https://projects.blender.org/blender/blender/pulls/114555
2023-11-09 18:22:59 +01:00
Campbell Barton
690d427045 Merge branch 'blender-v4.0-release' 2023-11-09 17:01:03 +11:00
Campbell Barton
391b5ac93c Fix uninitialized pending actions for Windows under Wayland
A windows pending actions wasn't cleared for new windows.
Although I'm not aware of user visible bugs, this prevents
unpredictable updates for new windows.
2023-11-09 16:57:06 +11:00
Campbell Barton
58ea0e051f Cleanup: spelling in comments 2023-11-09 09:54:28 +11:00
Campbell Barton
6bba008325 Cleanup: format 2023-11-09 09:34:49 +11:00
Werner, Stefan
b414187efb Build: Update OpenImageDenoise to 2.1.0
Major new feature in v2 is GPU support. This is not enabled yet,
this commit only changes the library version without enabling new
functionality.

Pull Request: https://projects.blender.org/blender/blender/pulls/112143
2023-11-08 10:12:05 +01:00
Michael Jones
051ce95628 Cycles: Use Metal Program Scope Global Built-ins on macOS >= 14.0
This PR simplifies the kernel entrypoints by using [Metal Program Scope Global Built-ins](https://developer.apple.com/metal/Metal-Shading-Language-Specification.pdf) when available (macOS >= 14.0).

Pull Request: https://projects.blender.org/blender/blender/pulls/114535
2023-11-07 11:20:16 +01:00