Commit Graph

123511 Commits

Author SHA1 Message Date
Hans Goudey
45cecb101c Nodes: Support adding multiple nodes from search menu
Needed for the simulation zone addition to the add menu search.
Link-drag search isn't supported yet, but a similar change should be
possible there.

Now the search item exposed through the public nodes namespace returns
several items directly, and the "after add function" is just handled as
a sub-case of that for convenience.
2023-04-26 11:40:54 -04:00
Campbell Barton
f6931a9ead CMake: only generate & install the man-page when it may be outdated
Check if the man-page is missing or older than files that generate it
before re-running the generator.

Previously the install target would re-run the man-page generator
every time, even when no other changes to the build were detected.
2023-04-26 23:01:02 +10:00
Hans Goudey
bdaf8e3715 Cleanup: Avoid storing redundant information in corner normals task data
Though alignment means the size of the struct doesn't change
if the data is split up a bit more it could give further improvement.
2023-04-26 08:50:31 -04:00
Hans Goudey
803f03ae32 Cleanup: Remove redundant namespaces in mesh normals code
Also use int instead of uint.
2023-04-26 08:46:11 -04:00
Hans Goudey
93f99859bc Cleanup: Standardize mesh corner normals code
Use consistent variable names: for example "vert" instead of "mv" and
"edge" instead of "me", etc. Also use helper functions like "edge other
vert" to make the code easier to read.
2023-04-26 08:46:11 -04:00
Hans Goudey
b54398c16c Geometry Nodes: Use implicit sharing in store/capture attribute nodes
Some fields reference attributes directly. When the referenced attribute
has the requested type and domain, the captured/stored attribute can
share its array, avoiding the cost of duplication and reducing memory
usage, at least temporarily until either attribute is modified.

This only works when the attribute doesn't need validation and when
the selection input isn't used, since those potentially need to change
values in the arrays.

I saw this save 200MB and 11 ms of copying for a simple grid with
16 million points (creating the grid takes about 60ms).

Pull Request: https://projects.blender.org/blender/blender/pulls/107357
2023-04-26 14:38:56 +02: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
029ce2b656 Cleanup: remove redundant casts 2023-04-26 19:03:21 +10:00
Campbell Barton
0a3a6cd154 Cleanup: use ptrdiff_t in assertion to prevent overflow 2023-04-26 19:02:24 +10:00
Jacques Lucke
bf58af2d65 Cleanup: fix build errors/warnings 2023-04-26 10:55:45 +02:00
Jacques Lucke
8ebabac003 Cleanup: store less data per node that is already stored together 2023-04-26 10:42:46 +02:00
Joseph Eagar
c1d4b6f339 Core: Add ASAN support to BLI_mempool
This patch adds address sanitizer support to memory pools.

when ASAN is enabled the following happens:
* 32 byte red zones are inserted between pool elements.
* The BLI_mempool struct itself is marked as a red zone.
* Access to the pool goes through a thread mutex (except when compiling makesdna).

This is very useful for finding bugs in code that uses BMesh.

Pull Request: #104668
2023-04-26 01:32:41 -07:00
Jacques Lucke
536144983b Fix: group node inputs always requested unnecessarily
This triggered an assert during evaluation, because the group inputs
were first requested and later the set unused, which is not allowed.

The issue was likely introduced in 258678916f.
2023-04-26 10:10:22 +02:00
Campbell Barton
5a5c0e879c Cleanup: correct exception message & remove unused iterator variable 2023-04-26 17:51:50 +10:00
Jeroen Bakker
89afdd6f24 Vulkan: Texture Unpacking
This PR adds support for `GPU_unpack_row_length_set` to the vulkan
backend.

Texture unpacking is used when uploading a part of a texture from
host memory to device memory.

Pull Request: https://projects.blender.org/blender/blender/pulls/107360
2023-04-26 09:23:58 +02:00
Campbell Barton
6a49041be3 Fix string lookups asserting or failing with unsupported collections
A recent change from [0] added an assert when a string lookup was
performed on a collection item with no name-property,
but silently failed with release builds.

This isn't correct in a couple of ways.
The assert makes it seem like the RNA API needs to be updated when
it's in fact valid to have collection items without a name-property.
It also misleads script authors to silently fail since it implies a
key that exists would return a result.

Raise a TypeError exception when string lookups are attempted on
collections that don't support them.

This change also applies to get() & __contains__().

[0]: 5bb3a3f157
2023-04-26 16:16:19 +10:00
Campbell Barton
c81e6d3ff3 Keymap: cancel 3D viewport operations using Escape
While RMB was canceling, the check for Escape was overridden by the
modal keymap, causing Escape to confirm.

Resolve by:

- Removing Escape binding from the modal keymap, rely on hard coded
  check as Escape to cancel is an assumption made in many places.
- Move RMB hard-coded check into the modal keymap since it's non-default
  keymaps may use mouse buttons differently.
2023-04-26 16:14:07 +10:00
Campbell Barton
20f7dc46a7 Cleanup: remove redundant modal keymap items for 3D view operations
These operators already check for release events matching the event
that launched them.

Also remove hard-coded model keys (rely on the default key-map).
2023-04-26 16:14:07 +10:00
Campbell Barton
db1af0e325 Cleanup: spelling in comments 2023-04-26 16:14:07 +10:00
Campbell Barton
ca98185f84 Cleanup: quiet unused function warning WITH_OPENSUBDIV=OFF 2023-04-26 16:14:07 +10:00
Jeroen Bakker
7691d19ad2 Vulkan: Index Buffer
This PR adds the binding of index buffers.

Pull Request: https://projects.blender.org/blender/blender/pulls/107358
2023-04-26 08:09:28 +02:00
Jeroen Bakker
f0e768c198 Vulkan: Conversions between Blender and Vulkan Enums
Add conversions to convert from Blender enums to their Vulkan
counterpart.

Pull Request: https://projects.blender.org/blender/blender/pulls/107336
2023-04-26 07:56:35 +02:00
Hans Goudey
5727851d65 Cleanup: Declare field context variables const 2023-04-25 22:23:38 -04:00
Chris Blackbourn
91020ccde1 Cleanup: Simplify UV Packing storage of temporary layout 2023-04-26 11:13:38 +12:00
Chris Blackbourn
838b258b22 Cleanup: format 2023-04-26 10:37:56 +12:00
Hans Goudey
ae57d86d42 Fix #107095: Spikes during multires reshape propagation
Linear subdivision or interpolating from a lower multires level gave
spikes at some vertices. Caused by incorrect corner edge indexing.
This was simple to solve by building the old MLoop array on demand
and reverting parts of 16fbadde36.
2023-04-25 15:59:05 -04:00
Erik Abrahamsson
700d168a5c Volumes: Generate proper fog volume in Mesh to Volume node
Currently `Mesh to Volume` creates a volume using
`openvdb::tools::meshToVolume` which is then filled with the specified
density and the class set to Fog Volume. This is wrong because
`meshToVolume` creates a signed distance field by default that needs
to be converted to a Fog Volume with `openvdb::tools::sdfToFogVolume`
to get a proper Fog volume.

Here is the description of what that function does (from OpenVDB):

"The active and negative-valued interior half of the narrow band
becomes a linear ramp from 0 to 1; the inactive interior becomes
active with a constant value of 1; and the exterior, including the
background and the active exterior half of the narrow band, becomes
inactive with a constant value of 0. The interior, though active,
remains sparse."

This means with this commit old files will not look the same.
There is no way to version this as the options for external band width
and not filling the volume is removed (they don't make any sense for a
proper fog volume).

Pull Request: https://projects.blender.org/blender/blender/pulls/107279
2023-04-25 21:56:14 +02:00
Dalai Felinto
5d0595fded Suport relative path option per-asset library
This option is true by default, but it can be changed for
any asset library (that may be using Link as import method).

This also fix "Reset to Default Value" for the Import Method
since this was originally not using the defaults.

Pull Request: https://projects.blender.org/blender/blender/pulls/107345
2023-04-25 20:56:57 +02: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
Sahar A. Kashi
7026d9ac43 HIP: hipew and build system updates for new APIs, including HIP-RT
* Add HIP-RT API functions and library loading
* Add more HIP API types and functions
* Find HIP linker executable in CMake module
* New CMake module to find HIP-RT SDK

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
Brecht Van Lommel
19899a8dee Cleanup: remove removed variable from CMake config 2023-04-25 20:19:11 +02:00
Michael Kowalski
5a6db19da4 Cleanup: make format. 2023-04-25 12:48:36 -04:00
Michael Kowalski
239af1705d Fix #102594: USD Import: mask multiple prim paths.
These changes enhance the prim_path_mask USD import option to allow masking on multiple paths.

Changed the prim_path_mask import property to a string of arbitrary size.

Multiple paths may be specified in a list delimited by commas or semicolons.

Reviewed by Bastien and Matt McLin.

Pull Request: https://projects.blender.org/blender/blender/pulls/106974
2023-04-25 16:32:52 +02:00
Bastien Montagne
cbcf9058cd Fix (unreported) potential missing deletion of some linked liboverrides during resync.
The code checking whether old liboverrides which have been resynced into
new ones should be deleted was still assuming it was only working on
local liboverrides.

However, since recursive resync was implemented, this is not true
anymore, it can also handle resynced linked liboverrides.

This could have lead to missing deletion of some old linked liboverrides
after resyncing them.
2023-04-25 15:51:03 +02:00
Bastien Montagne
5f67b25c28 LibOverride: Do not attempt to resync a hierarchy when the root goes missing.
This addresses an issue here at the Blender studio, where a root
collection of a set was removed by mistake from the set library .blend file.

Since all the other linked data (sub collections, actual objects etc.)
of the set were still available, the liboverride resync code went crazy
trying to resync all these scattered pieces of a set, finding new valid
root IDs for the hierarchies, and so on.

So from now on, do not attempt to resync anything that is part of a
liboverride hierarchy which root ID linked reference has gone missing.
2023-04-25 15:51:03 +02:00
Bastien Montagne
b666d2d1bd Fix further (unreported) issues in object collection cache cleanup code.
`BKE_collection_object_cache_free` can be called from some points in
code (e.g. during ID remapping) where proper parenting relationships
between collections cannot be ensured.

Would be good to check if recursive cache cleanup is actually needed
from these points, it would almost certainly be better and safer to
instead tag parent collections as dirty too, but this will be for
another time.

For now, just add a NULL-check on the parent collection pointer.
2023-04-25 15:51:03 +02:00
Bastien Montagne
250d35928e Fix (unreported) broken code in BKE_collection_object_cache_free.
This call should be recursive, only freeing cache of immediate parents
of the collection is not enough, the whole parenting chain needs to be
processed.
2023-04-25 15:51:03 +02:00
Brecht Van Lommel
94a93b9290 Fix snap package failing to launch on some systems after core20 update 2023-04-25 15:50:26 +02:00
Julian Eisel
1fad165c1a Cleanup: Avoid unnecessary & misleading Outliner context function call
The function used to be needed for recursing the tree, as the name
indicated. But it has recently been ported to the new tree iterators
so the recursion isn't necessary anymore.
2023-04-25 15:49:25 +02:00
Jeroen Bakker
d5cd51f089 Vulkan: Add streaming buffers.
Add support for streaming buffers.

Pull Request: https://projects.blender.org/blender/blender/pulls/107335
2023-04-25 15:48:52 +02:00
Jeroen Bakker
a813b65c7d Vulkan: Command Buffer.
Changes to the internal workings of the VKCommandBuffer:
- Use state engine to track correct usage.
- Switch between render pass/no render pass automatically.

Eventually the command buffer should be rewritten to use custom command
encoding to improve performance.

Pull Request: https://projects.blender.org/blender/blender/pulls/107337
2023-04-25 15:32:41 +02:00
Jeroen Bakker
468a152fe1 Vulkan: Uniform Buffer
Add implementation to clear and bind uniform buffers.

Pull Request: https://projects.blender.org/blender/blender/pulls/107334
2023-04-25 15:30:55 +02:00
Jeroen Bakker
fd7f21af8c Vulkan: Shader Interface Attribute Extraction.
Add extraction of attributes from shader interface.

Pull Request: https://projects.blender.org/blender/blender/pulls/107333
2023-04-25 15:09:25 +02:00
illua1
70504a35dd Cleanup: Type conversions in node.cc
Make sure that function style, reinterpret_cast, and static_cast are
used for all type conversions, without of casting to void *. Some other
related minor changes: add temporal variables, lost space, asserts for
case to avoid type conversions by using `->id` way.

Pull Request: https://projects.blender.org/blender/blender/pulls/107097
2023-04-25 14:38:24 +02:00
Pratik Borhade
d742223197 Fix #107273: Group input is not listed in the node search
Group input/output nodes are not listed in search list
after cc925b9282. Similar to 5b2b114a2a
add these nodes in search list with the help of `gather_add_node_search_ops`.

Reviewed by: deadpin, HooglyBoogly

Pull Request: https://projects.blender.org/blender/blender/pulls/107323
2023-04-25 14:28:16 +02:00
Omar Emara
1c3d67d4cc Realtime Compositor: Split cache into containers
This patch refactors the static cache manager to be split into multiple
smaller Cached Resources Containers. This is a non factional change, and
was done to simplify future implementations of cached resources as they
become more elaborate.
2023-04-25 13:20:00 +02:00
Jacques Lucke
a57584e40d BLI: extract MapItem type to simplify iterating over map items 2023-04-25 12:15:02 +02:00
Jeroen Bakker
5fde2b34ba GPU: Ensure Absolute Ratio During SDF-Widget Drawing
In the GPU_SHADER_2D_WIDGET_BASE the deriviates were assumed to be
positive. This is not always the case. In Vulkan this leads to
incorrect rendering of the widgets due to incorrect SDF values.

This change will ensure that the shader make the ratio variable
absolute.

Pull Request: https://projects.blender.org/blender/blender/pulls/107327
2023-04-25 12:08:43 +02:00