Commit Graph

129524 Commits

Author SHA1 Message Date
Hans Goudey
fba7671205 Cleanup: Const correctness, unused variable warning in GP draw code 2023-10-19 15:03:32 +02:00
Hans Goudey
5db502a122 Fix: Build error after bounding box refactor
This function was changed in main after the buildbot built the PR.
Since we are just interested in grease pencil data here, just retrieve
the bounds from the geometry directly.
2023-10-19 15:02:15 +02:00
Jeroen Bakker
f9aca93a47 Vulkan: Add Support for sRGB Framebuffer Enablement
Allow binding of framebuffers without sRGB to linear transform.
`GPU_framebuffer_bind_no_srgb`. This Patch removes color transform
artifacts in node, image and sequence editor.

When the framebuffer is an srgb framebuffer and it is bound without
the transformation, the SRGB textures are bound as UNORM variants.

As framebuffer, render pass and subpass recreation is ensured by
`VKCommandBuffer` we don't need to mark the framebuffer dirty at
this time. Later on we can optimize this by adding a state changed
detection for framebuffers and render passes.

Pull Request: https://projects.blender.org/blender/blender/pulls/113838
2023-10-19 14:41:18 +02:00
Hans Goudey
1cbd0f5a85 Refactor: Improve access to object data bounds
Currently object bounds (`object.runtime.bb`) are lazily initialized
when accessed. This access happens from arbitrary threads, and
is unprotected by a mutex. This can cause access to stale data at
best, and crashes at worst. Eager calculation is meant to keep this
working, but it's fragile.

Since e8f4010611, geometry bounds are cached in the geometry
itself, which makes this object-level cache redundant. So, it's clearer
to build the  `BoundBox` from those cached bounds and return it by
value, without interacting with the object's cached bounding box.

The code change is is mostly a move from `const BoundBox *` to
`std::optional<BoundBox>`. This is only one step of a larger change
described in #96968. Followup steps would include switching to
a simpler and smaller `Bounds` type, removing redundant object-
level access, and eventually removing `object.runtime.bb`.

Access of bounds from the object for mesh, curves, and point cloud
objects should now be thread-safe. Other object types still lazily
initialize the object `BoundBox` cache since they don't have
a data-level cache.

Pull Request: https://projects.blender.org/blender/blender/pulls/113465
2023-10-19 14:18:40 +02:00
Hans Goudey
40080f618c Sculpt: Use C++ Set to store PBVH Node BMesh elements
Mainly to simplify code and also add some add type safety, replace
`GSet` with `blender::Set` for the storage of BMesh triangles and
vertices on each PBVH node. Some initial tests point to better
performance too, but the numbers are hard to verify so far.

Because of the larger `PBVHNode`, memory usage slightly increases
(observed a 2% increase with a 1M face grid) for regular Mesh sculpting,
but it seems `Set` is more memory efficient than `GSet`, because I also
observed a 10% decrease in memory usage for dynamic topology.
In the future nodes can be split in a more data-oriented fashion to
reduce memory usage overall.

This also makes it simpler to switch to another type in the future.

Pull Request: https://projects.blender.org/blender/blender/pulls/113907
2023-10-19 14:18:15 +02:00
Sybren A. Stüvel
395ac4c41f RNA: generate valid infinite float property default values
In `makesrna`, generate valid default values for float properties, when those
defaults are positive/negative infinity.

Blender would currently generate the strings `inff` and `-inff`, which are not
valid C++. This PR changes that to `std::numeric_limits<float>::infinity()` and
`-std::numeric_limits<float>::infinity()`.

Context: the layered animation system (see #113594) will have animation layers
with strips on them. It will have the concept of "infinite strips", where from
a user's perspective there aren't even any strips at all, and the layer seems
to directly contain the keys themselves. This is purely a UI distinction
though, where we simply won't draw the outline of infinite strips. Being able
to work with ±∞ as floating point values has clear advantages, as then the
`strip.frame_start` and `strip.frame_end` properties will always "tell the
truth".

This particular change is necessary to allow these values as defaults. It is
not intended that users will have property sliders for these properties when
their value is "infinite" (but rather a button 'make finite' or something along
those lines), so interaction with the UI code will likely be minimal.

Pull Request: https://projects.blender.org/blender/blender/pulls/113854
2023-10-19 14:15:11 +02:00
Campbell Barton
0488117548 Unbreak debug build 2023-10-19 22:43:26 +11:00
Brecht Van Lommel
488989f78e Merge branch 'blender-v4.0-release' into main 2023-10-19 13:37:18 +02:00
Alaska
37ab9bb1ed Fix unnecessary mix nodes for Principled BSDF specular tint
If the specular tint is 0 in a 3.6 file, and the base color has a
node input, then don't add a mix node in versioning.

Pull Request: https://projects.blender.org/blender/blender/pulls/113893
2023-10-19 13:36:34 +02:00
Lukas Stockner
173ba71b6b Merge branch 'blender-v4.0-release' 2023-10-19 13:26:22 +02:00
Falk David
6281d9a039 Fix: GPv3 depth buffer
Resolves #113422.

The depth buffer was rendered to, but not correctly merged
with the scene depth buffer. This lead to, e.g. the object appearing
behind the grid.

This fixes the issue by rendering a "merge" pass.

Pull Request: https://projects.blender.org/blender/blender/pulls/113779
2023-10-19 13:22:38 +02:00
Falk David
26816931c4 Fix: GPv3: Remap materials
Also fixes a crash when moving the first material of the default Grease Pencil Suzanne down by one.

Pull Request: https://projects.blender.org/blender/blender/pulls/113855
2023-10-19 13:19:41 +02:00
Lukas Stockner
c71e18054c Fix: Cycles: Non-physical layering weights can lead to negative closures 2023-10-19 13:13:48 +02:00
Jacques Lucke
a5b8a04cb0 Cleanup: remove unnecessary namespace specifier 2023-10-19 12:28:22 +02:00
Lukas Tönne
36c127805f Merge branch 'blender-v4.0-release' 2023-10-19 12:22:31 +02:00
Lukas Tönne
52e6106d28 Fix #113860: Incorrect conditionals for node group socket names
Nested conditions broken by #113924.

Pull Request: https://projects.blender.org/blender/blender/pulls/113929
2023-10-19 12:21:47 +02:00
Julian Eisel
3d97c7dbcb Merge branch 'blender-v4.0-release' 2023-10-19 12:10:23 +02:00
Julian Eisel
838aca5f18 Fix #102856: Too small draggable area of asset view template items
For historic reasons buttons don't use the full button size as draggable
area by default, only a small part of it that is assumed to contain the
icon (e.g. of a label button). This isn't what we want for the big
preview buttons used here, their entire surface should be draggable.
We already have a workaround in place for this historic behavior, so we
can just enable that.
2023-10-19 12:09:55 +02:00
Campbell Barton
661da427d7 Build: attempt to fix linking error WITH_INPUT_IME & GHOST
Always define WITH_INPUT_IME when IME is enabled so both WM and GHOST
can rely on functions existing when enabled from CMake.
2023-10-19 21:05:27 +11:00
Lukas Tönne
367320a0f5 Merge branch 'blender-v4.0-release' 2023-10-19 11:48:54 +02:00
Lukas Tönne
dfc3f75e77 Fix #113860: Nullptr checks for node socket and panel name pointers
In 3.6 the names of node group sockets were using char arrays, but now
use allocated strings. The RNA system assigns nullptr to such strings
when assigning an empty string through python (UI assignment appears to
always generate a valid string). This creates issues with many STL
functions, in particular assigning nullptr to `std::string` will crash.

We have to check for valid pointers before using them in places that
don't handle nullptrs.

Pull Request: https://projects.blender.org/blender/blender/pulls/113924
2023-10-19 11:48:08 +02:00
Antonio Vazquez
5736438b95 Cleanup: GPv2 remove duplicate matrix
The Bound box matrix was already as parameter.
2023-10-19 11:26:42 +02:00
Jacques Lucke
1c703eac2e Cleanup: use single declare function for all group nodes
The longer term plan is to allow using the same node groups in different
node tree types anyway. Also, the implicit field inputs is something that
shader nodes could benefit from soonish already.

This also fixes a bug where the geometry nodes specific declare function
was not used anymore since 38813a7441.
2023-10-19 11:13:52 +02:00
Bastien Montagne
ab91c18995 Fix linking errors when doing full debug build with ASAN: Disable ASAN for extern.
With current main code, trying to build a full debug build with ASAN
enabled will fail at linking, due to out-of-bound memory references
within the binary file, e.g.:

```
  mold: error: /usr/lib/gcc/x86_64-linux-gnu/13/crtbegin.o:(.text):
        relocation R_X86_64_32S against .tm_clone_table out of range:
        2147741344 is not in [-2147483648, 2147483648)
```

This commit works around the issue by disabling ASAN by default for the
`extern` dependencies. A new `WITH_COMPILER_ASAN_EXTERN` CMake
option is added to enable it if needed - some other components need to be
disabled then.

NOTE: This is more of an emergency band-aid to the general binary size issue,
see #113892 for on-going discussions about better solutions in the long term.

Pull Request: https://projects.blender.org/blender/blender/pulls/113891
2023-10-19 11:07:06 +02:00
Sergey Sharybin
d826bcd02f Merge branch 'blender-v4.0-release' 2023-10-19 11:02:40 +02:00
Sergey Sharybin
78b2e9071f Fix #113875: 2D Animation template's view transform set to AgX
Pull Request: https://projects.blender.org/blender/blender/pulls/113903
2023-10-19 11:02:01 +02:00
Iliya Katueshenock
e6a0b4404c Fix #110415: Crash with single point curves in Interpolate Curves node
Single point curves should be handled separately, because they don't
have any curve segments.

Pull Request: https://projects.blender.org/blender/blender/pulls/110477
2023-10-19 10:41:33 +02:00
Hans Goudey
9a458314f2 Cleanup: Use proper case for "uv_phi" class name 2023-10-19 10:37:04 +02:00
Hans Goudey
aa34e2f2aa Cleanup: Remove unnecessary namespace specification 2023-10-19 10:37:04 +02:00
Sergey Sharybin
aa8c97faeb Cleanup: Fix -Wpessimizing-move warning in curve trim
Pull Request: https://projects.blender.org/blender/blender/pulls/113923
2023-10-19 10:26:39 +02:00
Sergey Sharybin
8c0446981d Cleanup: Fix -Wformat in playanim
Depending on compiler and bitness, size_t and uint64_t can be different
types. Since uint64_t format is used explicitly cast size_t to uint64_t
to solve compiler warning.

Happens with Clang 15 on macOS.
2023-10-19 10:26:38 +02:00
Hans Goudey
a5eaf6698a Geometry Nodes: Optimize joining of instances
Restore lost performance from removing `reserve` in ff4d5b6f04
in a better way. First build offsets so we know where in the result the
source data should go, then copy the data in parallel.

Joining geometries containing 1 million instances each took 194 ms
before the change and only 15.6 ms afterwards.

Pull Request: https://projects.blender.org/blender/blender/pulls/113886
2023-10-19 10:23:59 +02:00
Hans Goudey
564c25291f Merge branch 'blender-v4.0-release' 2023-10-19 10:03:59 +02:00
Hans Goudey
f6d45d248c Fix #113894: Node tool crash with deleted group output node 2023-10-19 10:02:30 +02:00
Campbell Barton
e7e4e63313 Cleanup: spelling in comments, white-space in comments 2023-10-19 18:53:16 +11:00
Hans Goudey
eb41a7ec9d Fix: Misleading node tools popover label
Use "Hair Curves" instead of just curves, to clarify that it's just the
new curves system that's supported, not the legacy one. When the
old one is removed, the label will be changed to just say "Curves"
again.
2023-10-19 09:50:17 +02:00
Campbell Barton
4a813ba5af Cleanup: simplify checks for IME event types
Use a separate block for IME start/event/end for clarity.
2023-10-19 18:01:40 +11:00
Campbell Barton
a6e3cfce79 Cleanup: quiet clang-tidy warnings & use snake case for class members 2023-10-19 17:51:21 +11:00
Campbell Barton
a38a49b073 GHOST/Wayland: IME support using the text-input protocol
Tested with IBUS on GNOME 45.
Added a capabilities flag to GHOST since support for IME works on
Wayland but not on X11, so runtime detection is needed.
2023-10-19 17:29:32 +11:00
Jeroen Bakker
4830521a31 Cleanup: Make format 2023-10-19 08:05:27 +02:00
Jeroen Bakker
62f721467b Merge branch 'blender-v4.0-release' 2023-10-19 08:03:51 +02:00
Jason Fielder
62219f8da9 Metal: Re-enable workbench NEXT shadows
With the shift to GPU-driven rendering pipeline,
the SSBO vertex fetch paradigm used to
implement workbench shadows on Metal
instead of utilising the geometry shader
path no longer worked correctly.

This is because the draw submission
required vertex amplification up-front,
based on the expected output geometry
amount for a given input geometry.

This patch aims to resolve this
issue through addition of API to
enable the features within the
GPU driven pipeline.

Co-authored-by: Michael Parkin-White <mparkinwhite@apple.com>
Pull Request: https://projects.blender.org/blender/blender/pulls/113498
2023-10-19 08:01:17 +02:00
Richard Antalik
f62dde8b1f Merge branch 'blender-v4.0-release' 2023-10-19 02:10:24 +02:00
Richard Antalik
c7384ba6f3 Fix #110878 VSE duplicating first frame and offsetting rest.
Conversion from timeline frame to frame index was done by casting to
integer, which followed logic of ffmpeg seeking. However this is not
best approach in some cases - for example when FPS of scene and movie
differs by a very small amount. In this case the first frame could be
duplicated and all other frames will appear as offset by one frame.

In particular this may happen scene is set to 29.97 fps and movie is
encoded at 30000/1001 fps. A frame will still have to be duplicated, but
it should be frame where decimal of frame index crosses 0.5 to keep
audio and video in sync as best as possible.

Pull Request: https://projects.blender.org/blender/blender/pulls/113870
2023-10-19 02:08:20 +02:00
Richard Antalik
1d9519004a Merge branch 'blender-v4.0-release' 2023-10-19 02:03:36 +02:00
Richard Antalik
d4fd65ffc9 Fix issues when adding retiming key outside of strip boundary
When retiming key is added to frame before strip starts, this causes
crash on null dereference. After adding null check, this creates
retiming data, even though operation is not valid. To prevent creating
empty retiming data, `SEQ_retiming_data_ensure()` is only executed, when
operator actually adds a keyframe.
2023-10-19 02:02:52 +02:00
kosarev
f9a36b1548 blenloader: Refactor the write wrappers.
- Decouple the compressing and non-compressing wrappers.

- Turn the open(), close() and write() callbacks into proper virtual methods.

- Change the write() interface to take a void pointer and return
  a bool to simplify its use.

- Eliminate the need for explicit initialization of the wrappers' fields.

Co-authored-by: Ivan Kosarev <mail@ivankosarev.com>
Pull Request: https://projects.blender.org/blender/blender/pulls/113071
2023-10-19 01:54:00 +02:00
Brecht Van Lommel
813f04d704 Merge branch 'blender-v4.0-release' into main 2023-10-18 22:17:56 +02:00
Brecht Van Lommel
e11f031d62 Fix performance regression on Metal/AMD due to new BSDFs
The increased amount of BSDF code from Principled BSDF v2 and the
microfacet BSDF led to a big performance regression on Metal and AMD.
We have not been able to find a good workaround for all scenes.

This change disables the Principled Hair BSDF code when it is not used
in the scene. This makes common benchmark scenes faster, but
performance is still bad in scenes that do use it.

Ref #112596

Pull Request: https://projects.blender.org/blender/blender/pulls/113904
2023-10-18 22:17:05 +02:00
Brecht Van Lommel
bb8440e55b Merge branch 'blender-v4.0-release' into main 2023-10-18 20:42:29 +02:00