Commit Graph

12637 Commits

Author SHA1 Message Date
Brecht Van Lommel
4cb670e68f Fix #105148: Cycles Metal memory leak on AMD GPU
After NanoVDB support from 02c2970982, this line should not have been
removed.
2023-04-03 18:18:01 +02:00
Brecht Van Lommel
dbf1049d41 Cycles: bump version to 3.6.0 2023-04-03 17:32:35 +02:00
Brecht Van Lommel
861debcb10 Fix Cycles standalone and Hydra build issues in some configurations
Bring the build in sync with the Cycles standalone repo.
2023-04-03 17:32:35 +02:00
Alex Fuller
4f0092c1ff Refactor: add native Cycles Normalize option on lights for Hydra
Make it a native Cycles light option instead of counter-acting the inverse
area calculation in Hydra.

Differential Revision: https://developer.blender.org/D16838
2023-04-03 17:23:46 +02:00
Alex Fuller
945579c203 Fix Cycles build issue with USD 23.02
HdRenderDelegate got a change with the interface, adding gpuSupported. It
currently is just a dummy implementation without checking for anything
GPU-related.

Differential Revision: https://developer.blender.org/D17207
2023-04-03 17:23:46 +02:00
Alex Fuller
cbf3bd0efc Fix Cycles missing geometry header in object header, causing crashes
The problem is that `set_geometry()` otherwise ends up implicitly
casting `Geometry*` to bool. In Blender this worked because the
geometry header was always included before the object header.

Differential Revision: https://developer.blender.org/D16737
2023-04-03 17:23:46 +02:00
Hans Goudey
4bcd59d644 Cycles: Avoid overhead from RNA when extracting mesh data
Use raw Blender structs and mesh data rather than using the RNA API.
There isn't any benefit from using the RNA when Cycles is compiled
with Blender anyway, and a profile showed that the majority of time
was spent in Blender RNA API functions.

This gives a significant improvement in performance when ingesting
meshes. Here are some tests of the runtime of the `create_mesh`
function (in seconds):

|                           | Before | After |
| ------------------------- | ------ | ----- |
| Grid                      | 0.66   | 0.11  |
| Many realized cubes       | 2.60   | 0.48  |
| Large curve to mesh setup | 4.18   | 1.14  |

Also change to resizing the arrays and filling them by index rather
than appending. This makes the parallel aspect of the logic clearer,
and makes the loops easier to parallelize in the future, and makes
it easier to have a performance benefit when an attribute like
`sharp_face` doesn't exist.

Pull Request: https://projects.blender.org/blender/blender/pulls/106275
2023-04-03 17:04:58 +02:00
Weizhen Huang
f692010ae1 Cleanup: remove redundant call to #free() for light tree arrays 2023-04-03 11:48:09 +02:00
Weizhen Huang
1205111fe9 Refactor: move #object_usable_as_light() from #LightManager class to #Object
so that the function can also be used by other classes.
Also change `!bounds.valid()` to `!is_traceable()` so zero-sized objects
are skipped.
2023-04-03 11:16:00 +02:00
Campbell Barton
cde99075e8 GHOST/Wayland: add fractional-scale interface support
Previously, fractional scaling was detected but set an integer buffer
scale which the compositor would down-scale causing blurry output.

Now the fractional scaling interface is used when available to set the
DPI and set the internal buffers size & viewport transformation to
ensure 1:1 pixels from Blender to the Wayland output.

Tested to work with multiple monitors with mixed
fractional/non-fractional scale.

Note that this change causes a regression for when fractional scaling
is set on a compositor without support for fractional-scale-v1.
Supporting fractional scaling in both cases is possible but overly
complicated. This case already wasn't working so well - with blurry
output due to image scaling, now the DPI wont be accurate in this case
although Blender is still usable.
2023-03-31 13:03:50 +11:00
Sergey Sharybin
a12a8a71bb Remove "All Rights Reserved" from Blender Foundation copyright code
The goal is to solve confusion of the "All rights reserved" for licensing
code under an open-source license.

The phrase "All rights reserved" comes from a historical convention that
required this phrase for the copyright protection to apply. This convention
is no longer relevant.

However, even though the phrase has no meaning in establishing the copyright
it has not lost meaning in terms of licensing.

This change makes it so code under the Blender Foundation copyright does
not use "all rights reserved". This is also how the GPL license itself
states how to apply it to the source code:

    <one line to give the program's name and a brief idea of what it does.>
    Copyright (C) <year>  <name of author>

    This program is free software ...

This change does not change copyright notice in cases when the copyright
is dual (BF and an author), or just an author of the code. It also does
mot change copyright which is inherited from NaN Holding BV as it needs
some further investigation about what is the proper way to handle it.
2023-03-30 10:51:59 +02:00
Campbell Barton
0fcecc5c1e Cleanup: use methods to convert to/from window scale
Simplifies adding support for the fractional-scale protocol which
requires events to be fractially scaled.
2023-03-30 17:36:31 +11:00
Campbell Barton
a62f6c8290 Fix out-of-bounds array access when building with GHOST_OPENGL_ALPHA
While this is off by default, best replace hard coded sizes to avoid
out of bounds access if the enum is expanded.
2023-03-30 09:51:44 +11:00
Michael Jones
5f61eca7af Cycles: Exploit non-uniform threadgroup sizes on Metal
This patch replaces `dispatchThreadgroups` with `dispatchThreads` which takes care of non-uniform threadgroup bounds. This allows us to remove the bounds guards in the integrator kernel entry points.

Pull Request: https://projects.blender.org/blender/blender/pulls/106217
2023-03-29 21:46:11 +02:00
Michael Jones
944a5854c6 Cycles: Fix MetalRT shadow all hit bug
This patch fixes a MetalRT issue where viable shadow hits are discounted based on the false assumption that hits are ordered by distance. With this patch, the following unit tests now pass:

- openvdb smoke
- shadow catcher pt transparent lamp only 0.8
- shadow catcher pt transparent lamp only 1.0

Pull Request: https://projects.blender.org/blender/blender/pulls/106276
2023-03-29 20:20:07 +02:00
Sergey Sharybin
d32d787f5f Clang-Format: Allow empty functions to be single-line
For example

```
OIIOOutputDriver::~OIIOOutputDriver()
{
}
```

becomes

```
OIIOOutputDriver::~OIIOOutputDriver() {}
```

Saves quite some vertical space, which is especially handy for
constructors.

Pull Request: https://projects.blender.org/blender/blender/pulls/105594
2023-03-29 16:50:54 +02:00
Campbell Barton
c0a252b833 Fix #105895: UI scaled down with 125% fractional scaling on Wayland
The DPI returned by the GHOST/Wayland didn't account the buffer being
rendered at a higher (non-fractional) resolution, then scaled down.

This caused the software cursor and UI to rendered very small.
A fractional scale of 101% would show the UI just over 50% of the size
(making the UI to be close to half the scale it should have been).

Resolve by accounting for down-scaling of the buffer to it's
fractional size.
2023-03-29 17:48:53 +11:00
Campbell Barton
35f770a689 Cleanup: duplicate words in comments 2023-03-29 14:17:32 +11:00
Brecht Van Lommel
8d16e8f726 Merge branch 'blender-v3.5-release' 2023-03-28 16:33:34 +02:00
Sebastian Herholz
ac0ed09735 Fix #104329 viewport render with path guiding crashes
This is a workaround fix for Open PGL 0.4.1 when the first volume
samples are collected in a later training iteration.

The problem is fixed in Open PGL > 0.5.0 and the workaround
can be removed after upgrading Open PGL.
2023-03-28 14:45:35 +02:00
Kazashi Yoshioka
a64877f045 Vulkan: Added prerequisite checks for using VK_Layer_Validation
This PR adds pre-checks when enabling validation layers.

For validation layers to work some platforms require that
the Vulkan SDK is installed. Validation layers are activated
when running blender with `--debug-gpu`.

Sometimes we expect users to run with `--debug-gpu` for
narrowing down an issue and we cannot expect them to have
the Vulkan SDK installed.

This patch will check if the `VK_LAYER_PATH` is available
and that the configuration file of the validation layer is
present. If this isn't the case we don't activate the
requested validation layer.

Pull Request: https://projects.blender.org/blender/blender/pulls/105922
2023-03-28 10:45:44 +02:00
Campbell Barton
a88c77eaac Cleanup: use struct comments for gwl_registry_handlers declaration 2023-03-28 17:05:25 +11:00
Campbell Barton
3071ec486b GHOST/Wayland: support window activation
Calling render (for example) with an existing window open now activates
the window on Wayland. Tested to work on GNOME & KDE.

Use the xdg-activation protocol which typically brings the
window to the foreground.

Partially resolves #102985.
2023-03-28 16:08:10 +11:00
Campbell Barton
8132b4a927 GHOST/Wayland: GWL_Seat::data_source_serial when modifiers are set
All keyboard/cursor events should set the data_source_serial,
also update doc-string.
2023-03-28 16:05:32 +11:00
Campbell Barton
4ee705ca4f Cleanup: use a system method to access the APP_ID
Move the app-id out window initialization code.
Make it possible for other methods to access the APP_ID.
2023-03-28 16:05:31 +11:00
Campbell Barton
4bead379c6 Cleanup: remove redundant (void) in C++ function declarations 2023-03-28 15:57:48 +11:00
Campbell Barton
2ec4ce18ae Cleanup: use 'override' specifier for GHOST: X11, SDL & None with CLANG
Clang would warn about failure to use 'override' when a single
method was added that used 'override' when none of the other methods
did.

This meant a single correct use of override caused noisy compiler
warnings (for CLANG but not GCC).
Avoid this by using 'override' where appropriate.
2023-03-28 15:57:48 +11:00
Campbell Barton
bb2dc141f2 Cleanup: spelling in comments 2023-03-27 12:08:14 +11:00
Campbell Barton
99d7816d06 Cleanup: suppress clang-tidy warnings in GHOST_Types.h 2023-03-27 11:07:27 +11:00
Campbell Barton
4e51008a82 GHOST: replace multiple functions with a single capabilities flag
Adding checks for platform capabilities involved adding functions
to multiple classes and was too involved.

Replace this with a single GHOST_System::getCapabilities() function.
2023-03-27 11:01:20 +11:00
Hans Goudey
cef82a1d39 Cleanup: Grammar: "it's" vs "its" 2023-03-24 08:34:21 -04:00
Campbell Barton
03cfa75bcc Merge branch 'blender-v3.5-release' 2023-03-24 22:42:33 +11:00
Campbell Barton
cb4f7cac24 Fix #106040: pasting long text fails in Gnome-Shell/Wayland
Workaround gnome-shell including uninitialized memory when pasting
from the clipboard. Where `read` would not write data into the range
return by the length.

Reading from the pipe into a power-of-two buffer
works around the problem.

It's not clear why this only impacts gnome-shell - as there is no
significant down-side to changing the buffer size, apply a workaround.

Ref !106091.
2023-03-24 22:25:26 +11:00
Campbell Barton
a016d142e8 Fix #106040: pasting long text fails in Gnome-Shell/Wayland
Workaround gnome-shell including uninitialized memory when pasting
from the clipboard. Where `read` woud

Reading from the pipe into a power-of-two buffer
works around the problem.

It's not clear why this only impacts gnome-shell - as there is no
significant down-side to changing the buffer size, apply a workaround.
2023-03-24 17:12:02 +11:00
Campbell Barton
3dcd4df70c UI: support the primary clipboard for console & 3D text selection
Only the text editor supported the primary clipboard & only for modal
selection. Now selecting text in the console & 3D text editing also
sets the primary clipboard under X11 & Wayland.

Notes:

- Pasting from the primary clipboard isn't yet exposed in the key-map
  so in practice it's only useful for pasting text outside of Blender.
- Use skip-save option when pasting from the primary selection
  so this is never used by the regular paste shortcut.
- This commit adds a primary-clipboard flag to WM_capabilities_flag() so
  creating the the copy-buffer is only performed when necessary.
2023-03-24 17:09:39 +11:00
Weizhen Huang
1111ce3472 Fix rotate around zero vector in #OrientationBounds 2023-03-23 18:42:39 +01:00
Jeroen Bakker
fda65ad5ca GPU: Renderdoc Frame Capturing
This PR uses renderdoc for frame capturing when enabled.
It enabled an easier workflow for frame capturing.

- Capture GPU API calls from test cases
- Capture GPU API calls from background threads
- Capture GPU API calls from background rendering.

Renderdoc is an important GPU debugger used by the Eevee/
Viewport module. Previously we needed to change code in
order to record background rendering, that could on its own
lead to other side-effects.

The integration with renderdoc can be enabled using
`WITH_RENDERDOC=On` compiler option. `GPU_debug_capture_begin`
and `GPU_debug_capture_end` can be added to the section
of the code you want to debug. When running Blender inside
renderdoc this part will automatically be captured.

All GPU test cases are now guarded by these calls. In order
to capture the test cases you need to start the test cases
from renderdoc and the captured GPU API calls will appear
where each capture is a single test case.

Pull Request: https://projects.blender.org/blender/blender/pulls/105921
2023-03-23 16:37:52 +01:00
Weizhen Huang
e77b666ae9 Fix normalize zero vector in light tree #OrientationBounds
was assuming such cases are already handled before this function is
called, but seems to be broken on windows and linux. Do
`safe_normalize()` so the tests pass, will check the problem afterwards.
2023-03-23 12:38:25 +01:00
Weizhen Huang
791f35e2c0 Fix rotation axis not normalized in light tree #OrientationBounds 2023-03-23 11:11:54 +01:00
Sergey Sharybin
b77e6aaa0f Fix warnings in Cycles graph test output
Harmless, but is quite noisy and easy to avoid.

Pull Request: https://projects.blender.org/blender/blender/pulls/105985
2023-03-23 09:55:54 +01:00
Campbell Barton
ebd7298594 Cleanup: avoid repeating defaults for pointer scroll under Wayland 2023-03-23 15:19:00 +11:00
Campbell Barton
e39b358a2f Guarded allocator: print memory-in-use as a size_t, not uint
There is no reason to cast to a smaller value which could overflow.
2023-03-23 14:20:14 +11:00
Brecht Van Lommel
16b93486ca Fix Cycles CUDA compiler warnings with if constexpr 2023-03-22 15:57:06 +01:00
Brecht Van Lommel
410ef5342e Fix Cycles build warning on Windows with unused argument 2023-03-22 15:57:06 +01:00
Campbell Barton
e4300bbf2d Cleanup: quiet warnings by using system-includes for ./extern/
extern/json & extern/fmtlib reported warnings with GCC 12.2.1.
As these libraries aren't maintained as part of Blender, treat them as
system-includes.
2023-03-22 14:18:14 +11:00
Campbell Barton
3afe88b6c7 Cleanup: cmake indentation 2023-03-22 14:14:15 +11:00
Campbell Barton
d3bab78d05 Merge branch 'blender-v3.5-release' 2023-03-22 12:25:26 +11:00
Campbell Barton
2ba1556e69 Cleanup: spelling in comments, use doxygen syntax 2023-03-22 12:22:55 +11:00
Campbell Barton
cf82e5fe57 Fix incorrect cursor size on Wayland with the RIVER compositor
Use XCURSOR_THEME & XCURSOR_SIZE environment variables for Wayland.
While this isn't an official part of the spec, many Wayland compositors
& applications use these variables.
2023-03-22 11:17:24 +11:00
Aras Pranckevicius
ed7c90c13b Cycles: fix build failure due to lack of std:: specifier 2023-03-21 18:15:45 +02:00