Commit Graph

12749 Commits

Author SHA1 Message Date
Sergey Sharybin
e3f14b99c3 Refactor: Convert ImBuf to C++
Pull Request: https://projects.blender.org/blender/blender/pulls/107503
2023-05-02 11:32:27 +02:00
Campbell Barton
f154d37335 BLI_path: add a size argument to BLI_path_frame
Resolves potential buffer overflow in
USDVolumeWriter::construct_vdb_file_path which passed in a smaller
fixed size buffer than FILE_MAX.
2023-05-02 17:19:48 +10:00
Campbell Barton
a0db0a5580 Cleanup: move comments wrapped with MultiLine control statements
In some cases comments at the end of control statements were wrapped
onto new lines which made it read as if they applied to the next line
instead of the (now) previous line.

Relocate comments to the previous line or in some cases the end of the
line (before the brace) to avoid confusion.

Note that in quite a few cases these blocks didn't read well
even before MultiLine was used as comments after the brace caused
wrapping across multiple lines in a way that didn't follow
formatting used everywhere else.
2023-05-02 09:54:48 +10:00
Campbell Barton
6859bb6e67 Cleanup: format (with BraceWrapping::AfterControlStatement "MultiLine") 2023-05-02 09:37:49 +10:00
Aldo Bleeker
d68ed238b9 Cycles: solve compilation errors with OptiX 7.7
* User simpler API names that accept both PTX and OptiX-IR
* New argument for optixProgramGroupGetStackSize, leave to default
* Remove OptixPipelineLinkOptions::debugLevel that does nothing

Pull Request: https://projects.blender.org/blender/blender/pulls/107450
2023-05-01 12:07:26 +02:00
Campbell Barton
46316b29dc GHOST/Wayland: remove keyboard modifier mismatch warning suppression
Detecting when to show warnings about GHOST/XKB modifier
mismatches was rather involved, remove the check as it's
unnecessary for Gnome-Shell >= v43.

Older versions of Gnome-Shell will show warnings on window activation
with modifier keys held.
2023-05-01 11:57:45 +10:00
Campbell Barton
4efacf7e85 GHOST/Wayland: use GHOST modifiers, not XKB without an active windows
Reading modifiers from XKB caused a complications in getModifierKeys(..)
when called on a window that was activated, before the keyboard enter
handler had run - because the keys held by GHOST had not yet been
updated by XKB. This caused a problem which Gnome-shell which runs
the keyboard-enter handler after window activation.

This change would have fixed the Super key being stuck, see: #107314.
Keep the previous fix since in the unlikely case GHOST & XKB get out of
sync, stuck modifier keys should still be prevented.

This change means the warning for GHOST & XKB getting out of sync
can be enabled for Gnome-shell again, as it was previously suppressed
as it happened frequently on window activation.
2023-05-01 11:57:13 +10:00
Jesse Yurkovich
97222519de Fix #106945: IES file parsing failures
There were two issues here preventing the proper display of the IES
files in question.

The primary one was that these lights are actually vertical. Their
profiles actually point upwards from 90deg to 180deg but our parser was
trying hard to adjust it to start at 0deg incorrectly.

Lastly, the files in question ended with the parser in the `eof`
state - they are "missing" the final carriage return that other IES
files tend to have but other viewers don't seem to mind. Change the
`eof` check instead for a better one that will indicate if any parsing
errors occurred along the way.

Pull Request: https://projects.blender.org/blender/blender/pulls/107320
2023-04-28 23:29:04 +02:00
Brecht Van Lommel
5b69be00a6 Fix Cycles MetalRT not working after recent oneAPI changes
Forgot to initialize the device info.
2023-04-28 19:54:49 +02:00
Xavier Hallade
252b0a023e Cycles: use intrinsics for fast_rint
MSVC can't optimize it out and even keeps an external call to CRT
function rintf: https://godbolt.org/z/Ex9vjf8vj

It does translate to a real speedup on windows on some scenes, here are the ratios I had on my 13900K:
classroom	101.53%
junkshop	100.71%
monster	100.76%
attic	107.98%
bistro	113.00%

Pull Request: https://projects.blender.org/blender/blender/pulls/107371
2023-04-28 18:49:46 +02:00
Sergey Sharybin
7738f93d56 Cycles: Support newer version of sse2neon
Since the version v1.5.0 of sse2neon the functionality for denormals
flushing is implemented in the library. This commit makes it so the
_MM_SET_FLUSH_ZERO_MODE and _MM_SET_DENORMALS_ZERO_MODE are used from
the ss2neon if available.

This solves macro re-definition when a newer sse2neon is used.

The change is implemented in a way that both current and new sse2neon
are supported.
2023-04-28 17:36:02 +02:00
Sergey Sharybin
86a14faf69 Fix CUDA/OptiX compilation error in Cycles
Apparently, it does not seem to support hex notation for
floating point values.

Pull Request: https://projects.blender.org/blender/blender/pulls/107424
2023-04-28 10:51:03 +02:00
Campbell Barton
7b8ba7f101 Fix #107314: OS key stuck when switching windows with GNOME/Wayland
Tapping the OS key to switch windows could cause the OS key to stick.

On window deactivation the OS key was considered held, activating the
window later read the XKB modifier state before the keyboard_enter &
keyboard_modifier callbacks had run.

When they ran later, the mis-match between XKB and GHOST was not taken
into account, causing the OS key to stick.
2023-04-28 16:06:37 +10:00
Sergey Sharybin
02b5c04b2b Fix intersection distance offset in Cycles
The intersection distance offset in Cycles could have returned
a denormal floating point value for the input values of 0 (and
for the denormal input value).

This could lead to a situation when ray is unable to be advanced
when it hits an edge between two triangles: the intersection will
keep bouncing between two adjacent triangles. This is because the
ray->tmin is compared inclusively, and 0 >= <denormal zero>.

The solution is to return the smallest possible normalized floating
point value from the intersection_t_offset if the input is zero
or a denormal value (which is covered by the same t == 0 check).

This fix is hard to measure on the user level. The old code did
not cause any infinite traversal loop because of the way how the
integration is organized (some kernels offset ray.P, others check
for the number of bounces). It is possible that this fixes some
corner cases of noise: i.e. if some shadow rays falsefully were
considered occluded due to reached maximum number of bounces.

The actual problematic case was discovered during working on a
prototype which had an in-lined intersection loop with the ray
tmin offset.

Pull Request: https://projects.blender.org/blender/blender/pulls/107364
2023-04-26 11:36:37 +02:00
Campbell Barton
db1af0e325 Cleanup: spelling in comments 2023-04-26 16:14:07 +10:00
Sahar A. Kashi
557a245dd5 Cycles: add HIP RT device, for AMD hardware ray tracing on Windows
HIP RT enables AMD hardware ray tracing on RDNA2 and above, and falls back to a
to shader implementation for older graphics cards. It offers an average 25%
sample rendering rate improvement in Cycles benchmarks, on a W6800 card.

The ray tracing feature functions are accessed through HIP RT SDK, available on
GPUOpen. HIP RT traversal functionality is pre-compiled in bitcode format and
shipped with the SDK.

This is not yet enabled as there are issues to be resolved, but landing the
code now makes testing and further changes easier.

Known limitations:
* Not working yet with current public AMD drivers.
* Visual artifact in motion blur.
* One of the buffers allocated for traversal has a static size. Allocating it
  dynamically would reduce memory usage.
* This is for Windows only currently, no Linux support.

Co-authored-by: Brecht Van Lommel <brecht@blender.org>

Ref #105538
2023-04-25 20:19:43 +02:00
Brecht Van Lommel
63dfbdc187 Fix mistake in Cycles float4 pow
Not currently used anywhere, so should be no user visible change.
2023-04-25 20:19:43 +02:00
Brecht Van Lommel
ca52f0fae3 Cleanup: make format 2023-04-25 20:19:43 +02:00
Jeroen Bakker
26147b29a7 Vulkan: Construct a Vulkan 1.2 Context.
Apparently we always constructed a Vulkan 1.0 Context, although we
are targetting Vulkan 1.2. This also lead to incorrect expectations
when using the Vulkan Memory allocator.

Pull Request: https://projects.blender.org/blender/blender/pulls/107300
2023-04-24 15:32:17 +02:00
Michael Jones
d0467a277a Cycles: MetalRT: Don't apply local object transform if it is baked
This patch fixes the failing shader/bevel unit test when MetalRT is enabled. The ray was being transformed into local object space even when the SD_OBJECT_TRANSFORM_APPLIED flag was set.

Pull Request: https://projects.blender.org/blender/blender/pulls/107292
2023-04-24 15:20:21 +02:00
Alaska
4259105d68 Clean up: Fix spacing on Cycles debug message "Use MNEE"
This changes the Cycles Debug message for "Use MNEE" from:
"Use MNEEFalse"
to
"Use MNEE False"

Pull Request: https://projects.blender.org/blender/blender/pulls/107269
2023-04-24 08:49:14 +02:00
AgAmemnno
bebb17a973 Vulkan: Provide Debug Utilities
This PR uses the VK_EXT_debug_utils extension, but it's only for labeling, so it doesn't rely on the VK_LAYER_KHRONOS_validation functionality.

The functions that do these things are loaded into the runtime as vulkan extensions.

Declare the function pointers in a struct and make them members of vk_context.

Pull Request: https://projects.blender.org/blender/blender/pulls/106098
2023-04-21 12:32:40 +02:00
Campbell Barton
54ce0ac922 Cleanup: use const variables when reading X11 events 2023-04-21 09:12:31 +10:00
Campbell Barton
62806012ed Cleanup: resolve uninitialized members in GHOST Window & SystemX11
While this didn't cause bugs, initialize members to avoid problems
in the future.

GHOST::SystemX11
- m_keyboard_vector
- m_keycode_last_repeat_key

GHOST::Window
- m_cursorGrabInitPos
- m_userData
2023-04-21 09:06:25 +10:00
Nikita Sirgienko
4babb7c02e Cycles: oneAPI: Fix volume intersection for Embree GPU execution 2023-04-20 21:20:33 +02:00
Nikita Sirgienko
0d9fa73b42 Cycles: oneAPI: Fix motion blur rendering for Embree GPU execution
CPU non-unified shared memory was used for shared geometry buffers.
For the Embree GPU case, we now create new geometry buffers on GPU instead.
2023-04-20 21:20:33 +02:00
Nikita Sirgienko
7e92fb92ec Cycles: oneAPI: Fix kernels preloading in case of incompatible AoT binaries
When running oneAPI with AoT binaries, on hardware that's not compatible with
these, recompilation could have been missing from the kernels loading phase and
happen during execution instead.

These changes fixes it, any kernel compilation will now happen during the
kernels loading phase.
2023-04-20 21:20:33 +02:00
Brecht Van Lommel
13d30b0481 Cleanup: fix various warnings on Windows
Ensure windows.h is included before some other headers to avoid
redefining macros.

Pull Request: https://projects.blender.org/blender/blender/pulls/107189
2023-04-20 20:46:13 +02:00
Ankit Meel
f04a7a07e3 macOS: Add open files to system recent files
Completes the TODO in GHOST_SystemPathsCocoa::addToSystemRecentFiles
Also renames the filename parameter to the more appropriate filepath.

The recently opened/saved file will now also show up in:
- Blender Dock icon > Right click.
- Three finger swipe down in Open Blender i.e., App Expose

Based on a earlier contribution by @jenkm.

Pull Request: https://projects.blender.org/blender/blender/pulls/107174
2023-04-20 23:53:08 +05:30
William Leeson
475f9a3e23 Cycles: Break up geometry.cpp and scene.cpp file into smaller pieces
Scene.cpp  and Geometry.cpp are large file it can be broken up into smaller easier to handle files. This change has been broken out from #105403 to make understanding the changes easier.

geometry.cpp is broken up into:
1. geometry.cpp
2. geometry_attributes.cpp
3. geometry_bvh.cpp
4. geometry_mesh.cpp

scene.h & scene.cpp is broken into:
1. scene.h
2. scene.cpp
3. devicescene.h
4. devicescene.cpp

Pull Request: https://projects.blender.org/blender/blender/pulls/107079
2023-04-20 12:26:02 +02:00
Nikita Sirgienko
7ce10ebbbf Cycles: oneAPI: Remove excess quotes in a capabilities output 2023-04-20 11:09:16 +02:00
Campbell Barton
335d32153e Cleanup: remove dead code, reduce variable scope 2023-04-20 13:57:31 +10:00
Campbell Barton
62cc09f267 Cleanup: match argument names between functions & declarations 2023-04-20 13:52:58 +10:00
Brecht Van Lommel
d5757a0a10 Cycles: re-enable AMD GPU binaries on Windows
Using the new HIP SDK 5.5 that includes a fix for the compiler bug.

This also enables the light tree.

For Linux the binaries are still disabled. ROCm 5.5 is planned to
include the same fix but not released yet. When that happens we
should be able to enable Linux as well.

Ref #104786
Fix #104085

Pull Request: https://projects.blender.org/blender/blender/pulls/107098
2023-04-19 18:18:05 +02:00
Sergey Sharybin
a20f45bab9 Fix unqualified access to std::move in OpenSubdiv 2023-04-19 10:02:09 +02:00
Sergey Sharybin
63c20e08c4 Fix set but unused variable in Libmv 2023-04-19 10:02:09 +02:00
Sergey Sharybin
4f7dc1e4b6 Fix set but unused variable in IK solver 2023-04-19 10:02:09 +02:00
Sergey Sharybin
8ed543c6f2 Fix set but unused variable in dualcon octree 2023-04-19 10:02:09 +02:00
Sergey Sharybin
daaed83a32 Fix set but unused variables in Cycles 2023-04-19 10:02:09 +02:00
Sergey Sharybin
7982d86117 Fix unqualified access to std::move in Cycles 2023-04-19 10:02:09 +02:00
Campbell Barton
b132118f89 Cleanup: balance doxygen grouping, minor grouping adjustment 2023-04-19 09:02:21 +10:00
Campbell Barton
88f5dd3c72 Cleanup: format 2023-04-19 08:02:42 +10:00
Campbell Barton
eb2867de90 Cleanup: spelling in comments 2023-04-19 08:02:41 +10:00
Mateusz Albecki
0fd14d659b GHOST/Wayland: Fix disposeContext with VK
During createOffscreenContext with VK backend enabled wl_surface
was not stored in the context's user data. This resulted in nullptr
dereference later on during disposeContext. Added a line that sets
user data and additionally added nullptr checks in disposeContext.

Ref !107057.
2023-04-19 07:44:06 +10:00
Xavier Hallade
4382a0b350 Cleanup: avoid warnings from gcc in oneAPI device compilation
When building using GCC and with Embree without GPU support, there were
a few unused variables and a non-defined macro.
2023-04-18 22:40:40 +02:00
Xavier Hallade
70892e82ac Cycles: oneAPI: use specialization constant to compile with/without Embree on GPU 2023-04-18 22:09:42 +02:00
Xavier Hallade
9821a2d397 Cycles: pass kernel features to get_bvh_layout_mask
This allows to selectively disable Hardware Raytracing in oneAPI
backend, depending on features used.
2023-04-18 22:09:42 +02:00
Nikita Sirgienko
3f8c995109 Cycles: add hardware raytracing support to oneAPI device
Updated Embree 4 library with GPU support is required for it to be
compiled - compatiblity with Embree 3 and Embree 4 without GPU support
is maintained.
Enabling hardware raytracing is an opt-in user setting for now.

Pull Request: https://projects.blender.org/blender/blender/pulls/106266
2023-04-18 22:09:42 +02:00
Xavier Hallade
887022257d Cycles: update DPCPP to 2022-12 release
We also backport a patch to program_manager to it as
61e51015a5
helps avoid unnecessary recompilation when enumerating available
kernels.
2023-04-18 22:09:41 +02:00
Xavier Hallade
954c6c0ae6 Revert "Cycles: move oneAPI kernels dynamic library to blender.shared"
This reverts commit df096eab77436c0191f39806b0907aeb9744bee8.
There is a corner case for when WITH_CYCLES_ONEAPI_BINARIES is set to on
and later turned off during config, in case there is no ocloc.
2023-04-18 18:48:37 +02:00