Commit Graph

108765 Commits

Author SHA1 Message Date
Jeroen Bakker
9fa6ac6976 GPU: Fix out of bound write when logging system paths
Blender expects that only the filename is provided which is true
for internal shader sources.

Metal shaders can error and return a full path to a system shader.
This doesn't fit inside the reserved memory that Blender reserved
for logging filename and line number.

This out of bound write can be triggered when using `min`
where the parameters aren't of the same kind.
`uint min(uint, int)` for example.

This PR reserves more space to store the filename.

Pull Request: https://projects.blender.org/blender/blender/pulls/120967
2024-04-23 12:50:50 +02:00
Jacques Lucke
cefe1c668d Fix #120970: viewer geometry still visible even if modifier is disabled 2024-04-23 12:43:57 +02:00
Jeroen Bakker
17c84451b9 Vulkan: Pipeline pool
In Vulkan, a Blender shader is organized in multiple
objects. A VkPipeline is the highest level concept and represents
somewhat we call a shader. A pipeline is an device/platform optimized
version of the shader that is uploaded and executed in the GPU device.
A key difference with shaders is that its usage is also compiled
in. When using the same shader with a different blending, a new pipeline
needs to be created.

In the current implementation of the Vulkan backend the pipeline is
re-created when any pipeline parameter changes. This triggers many
pipeline compilations. Especially when common shaders are used in
different parts of the drawing code.

A requirement of our render graph implementation is that changes
of the pipeline can be detected based on the VkPipeline handle.
We only want to rebind the pipeline handle when the handle actually
changes. This improves performance (especially on NVIDIA) devices
where pipeline binds are known to be costly.

The solution of this PR is to add a pipeline pool. This holds all
pipelines and can find an already created pipeline based on pipeline
infos. Only compute pipelines support has been added.

# Future enhancements
- Recent drivers replace `VkShaderModule` with pipeline libraries.
  It improves sharing pipeline stages and reduce pipeline creation times.
- GPUMaterials should be removed from the pipeline pool when they are
  destroyed. Details on this will be more clear when EEVEE support is
  added.

Pull Request: https://projects.blender.org/blender/blender/pulls/120899
2024-04-23 12:39:41 +02:00
Clément Foucault
5b065b4b9d Fix: EEVEE-Next: Missing shadows in reflection probes
This was caused by the tagging pass not using the right
depth texture format.

This commit changes the opaque tagging pass to use the HiZ
buffer instead so that the shader is not relying on the
depth buffer anymore.

Pull Request: https://projects.blender.org/blender/blender/pulls/120965
2024-04-23 12:21:04 +02:00
Brecht Van Lommel
05048f8115 Fix: GPv3: Wrong reading of GP drawing ID reference
Datablock pointers are resolved in lib linking stage, not here.

Pull Request: https://projects.blender.org/blender/blender/pulls/120946
2024-04-23 12:11:22 +02:00
Jacques Lucke
5f3ad33f38 Geometry Nodes: decentralize headers for some nodes
`NOD_zone_socket_items.hh` contained code for different nodes. It's better to
split this into headers per node, because that scales better. Also it helps to
keep the code for each individual node more closely together.

Pull Request: https://projects.blender.org/blender/blender/pulls/120945
2024-04-23 11:13:27 +02:00
Campbell Barton
91cf938e40 Fix #120859: Script errors longer jump to the line in the text-editor
Since upgrading to Python 3.11, errors (other than syntax errors)
no longer jumped to the location of the error as they used to.

This was caused by the line number being unset, relying on the
attribute access to return the actual value.

Resolve by using attribute access when the struct member can't be used.
2024-04-23 18:18:49 +10:00
Campbell Barton
07e365fcbf Cleanup: remove unused variable 2024-04-23 18:18:47 +10:00
Christoph Lendenfeld
c30647a6fc Refactor: remove ReportList argument from insert_key
The insert key function in `animrig/keyframing.cc` took a `ReportList`
argument which it used to print messages in case of failures.

Instead this now returns a `CombinedKeyingResult` and the caller is
responsible for creating reports out of that.

To make that simpler the `ID` argument has been changed from a pointer to a reference.
The calling functions now make sure that it's not a `nullptr`.

This has the effect that there will be less messages printed in the Info panel when e.g. inserting keys with a keyingset.
This still doesn't make an error message pop up though.

Related to #119776

Pull Request: https://projects.blender.org/blender/blender/pulls/120784
2024-04-23 10:10:23 +02:00
Campbell Barton
802a45902a Fix flag value overlap EFFECT_POST_BUFFER/EFFECT_NORMAL_BUFFER
These enums used the same value.

---

This looks like an oversight, if it's intentional that both flags share a value it should be noted in code-comments.

Pull Request: https://projects.blender.org/blender/blender/pulls/120961
2024-04-23 09:55:55 +02:00
Omar Emara
614e5ecf7d Fix #120857: Blender crashes for huge compositor images
Blender crashes when the user scales up an image into huge scales. This
is due to integer overflow when doing memory allocations. So we fix this
by using larger integers when doing math on memory allocations and
indexing.

Note that while this solves the random crashes, users scaling up images
to huge scales will face things like the OOM killer activating or at
best significant slow downs due to swapping.

It is not clear how to handle such cases, but something like a global
maximum size option that is set to 16k by default might be worth adding.

Pull Request: https://projects.blender.org/blender/blender/pulls/120921
2024-04-23 09:44:33 +02:00
Jeroen Bakker
191b4fea5b GPU: Better hash for specialization constants
Due to an error in the hash function the specialization constants hash
wasn't optimal. This PR fixes the hash function implementation by replacing
the addition with an xor.

Pull Request: https://projects.blender.org/blender/blender/pulls/120964
2024-04-23 09:44:08 +02:00
Jeroen Bakker
07dd09aa55 Vulkan: Add reset method to resource access info.
Resource access info contains lists in a future setup the resource access info
will be kept in the VKContext and reused. This requires a reset function to
cleanup the instance for reuse.

Pull Request: https://projects.blender.org/blender/blender/pulls/120962
2024-04-23 08:23:12 +02:00
Campbell Barton
edfba89d1e Fix potential buffer read overflow in the splash screen
Since [0], checking if the user preferences exists used an uninitialized
string in the unlikely situation that the users configuration directory
couldn't be found.

[0]: 0c62906a41
2024-04-23 16:09:46 +10:00
Campbell Barton
ce05eb98c9 Cleanup: use const pointer arguments 2024-04-23 16:09:45 +10:00
Campbell Barton
e082049dff Cleanup: use early return, avoids passing uninitialized argument
An uninitialized `msg` string could be passed into ED_area_status_text
however the argument wasn't used when the area was null.

Even though this isn't a bug it relies on the `area` check in the
implementation to ignore the uninitialized argument.

Simplify logic by returning early when area is null.
2024-04-23 15:44:16 +10:00
Campbell Barton
2a2579e69c Cleanup: use const pointers 2024-04-23 15:41:55 +10:00
John Swenson
cff532e134 VSE: Implement Snapping to Markers
This patch adds the ability to snap strips to markers. Previously, there
only existed options to snap to hold offsets and the current frame.

This snap type works identically to other snapping options by checking
for the relevant bit (here `SEQ_SNAP_TO_MARKERS`) and adding the marker
frame numbers to `snap_data->target_snap_points` within
`seq_snap_target_points_build()`.

To enable `seq_get_snap_target_points_count()` to have access to marker
information, the current Scene object is now passed to the function.

Pull Request: https://projects.blender.org/blender/blender/pulls/120450
2024-04-23 01:54:14 +02:00
Clément Foucault
5644a0c621 Fix: EEVEE-Next: Sphere probe disregard the custom parallax checkbox
Fixes #120782
2024-04-22 23:33:08 +02:00
Clément Foucault
8d740b6ea3 Cleanup: DRW: Remove unused legacy function 2024-04-22 23:23:04 +02:00
Clément Foucault
2babe2d678 Fix: EEVEE-Next: Volume objects gets incorrectly culled
Infinite projection matrices do not work with the
current culling pipeline. Since it is expected to have
relatively few volume objects per scene, disabling the
culling for now as fixing it is more involved.

Also only meshes producing fragments will actually
be computed.

Fixes #115595
2024-04-22 23:23:03 +02:00
Clément Foucault
f86135dc6e Fix: EEVEE-Next: GBUffer: Wrong normal layer load
This was because the normal layer code was assuming no missing
closure inside the GBuffer. Now use bin indexing and
fix `gbuffer_read_bin` and `gbuffer_pack`.

Also add test cases for this.

Fixes #120756

Pull Request: https://projects.blender.org/blender/blender/pulls/120779
2024-04-22 21:36:40 +02:00
Hans Goudey
cb639d5d1d Cleanup: Rename "is_mode_active" to "edit_mode_active"
"is_mode_active" doesn't really make sense because some mode
is always active technically. This always referred to edit mode anyway.
2024-04-22 15:31:55 -04:00
Clément Foucault
d44ee7bf11 EEVEE-Next: Make light clamping consistent
This adds clamping at the light combine stage for both direct
and indirect light.

This allows for clamping direct and indirect light separately.
While direct light clamping might not be very desirable in
EEVEE, it might be wanted to reduce the flickering from distant
shiny bumpy surfaces, or for artistic reason.

This happens after applying the BSDF throughput just like cycles.
This is done in order to minimize the performance impact and
allows to split the clamp for direct light and indirect light.

The indirect light clamp value is still used in the ray-tracing
pipeline to clamp the ray intensity. But this differs from cycles
as we clamp the ray without the BSDF throughput here. Sphere probe
have the same issues. Some more energy loss is expected compared
to the direct light clamp.

Note that we still clamp the indirect light after applying BSDF
in case the BSDF is scaling the energy up above the threshold.

This also corrects the clamping for volume that now clamps after
applying the scattering term.

Also adds clamping to volume indirect lighting.

Since we use light probe volumes for both surface and volume
indirect lighting, we need to clamp them at sampling time.

Pull Request: https://projects.blender.org/blender/blender/pulls/120866
2024-04-22 21:19:00 +02:00
Habib Gahbiche
f1d4859e2a Compositor: implement bicubic spline for CPU compositor
Affected nodes:
- Rotate
- Translate
- Stabilize 2D node

Pull Request: https://projects.blender.org/blender/blender/pulls/120886
2024-04-22 20:58:43 +02:00
Jeroen Bakker
3f6e2ea915 Vulkan: Shader interface access mask
When building the resource access used when adding dispatch/draw commands
to the render graph, the access mask is required. This PR stores the
access mask in the shader interface. When binding the resources referenced
by the state manager, the resource access info struct is populated with
the access flags.

In the near future the resource access info will be passed when adding
a dispatch/draw node to the render graph to generate the links.

Pull Request: https://projects.blender.org/blender/blender/pulls/120908
2024-04-22 20:47:30 +02:00
Jacques Lucke
3bddde1b30 Cleanup: update comment regarding blend expand callback 2024-04-22 20:13:06 +02:00
Iliya Katueshenock
d1f26dad9b Fix #120874: Geometry Nodes: propagate attribute usage through muted node
For example, the `Bake` node generally does not propagate any anonymous
attributes. That's true regardless of whether it is baked or not. However, if it
is muted, the attributes should be propagated.

Pull Request: https://projects.blender.org/blender/blender/pulls/120887
2024-04-22 20:11:21 +02:00
Jesse Yurkovich
32ed9bb107 Collection Export: Enable STL and PLY exporters
Enables the STL and PLY formats for Collection export.

Changes
- Set the export operator on the File handlers
- Plumb through the `collection` property and make use of it while
  building the depsgraph
- Skip drawing the "Selection only" and "Batch" mode options when used
  with collections

Pull Request: https://projects.blender.org/blender/blender/pulls/120944
2024-04-22 20:05:34 +02:00
Harley Acheson
49bd285529 UI: Collapse XYZ Operations in Status Bar
Reduce the number of duplicated modal operator keymap entries by just
showing "XYZ Axis" rather than "X X Axis", "Y Y Azis", etc. This allows
more items to be shown on the status bar. Note this only does so if the
keymap contains all of X, Y, & Z.

Co-authored-by: Brecht Van Lommel <brecht@blender.org>
Pull Request: https://projects.blender.org/blender/blender/pulls/120148
2024-04-22 20:03:11 +02:00
Laurynas Duburas
3d9519544d Transform: support properly transforming implicitly shared curves positions
The issue was that the transform code kept non-const pointers into the
position arrays of `CurvesGeometry` for an extended period if time and
changed the positions through those pointers. This is not safe, because
the underlying position array may become shared (e.g. with the
corresponding evaluated object), in which case it's not allowed to change
the position array anymore without making a copy.

Generally, the scope at which some code has multiple access to data
should be as small as possible to avoid this kind of issue.

The solution is to store the positions that are modified by the transform
code in a new array and to copy those back into the `CurvesGeometry`
in one go. This way, the program scope in which the positions may be
modified is more obvious and much smaller.

Pull Request: https://projects.blender.org/blender/blender/pulls/120824
2024-04-22 20:02:52 +02:00
Jacques Lucke
d7d8cefd72 Fix: incorrect safe float4x4 to quaternion conversion
The issue was that when a 4x4 matrix is normalized, it does not
always mean that any inner 3x3 matrix is normalized too.
2024-04-22 19:52:47 +02:00
Iliya Katueshenock
ed9921185a Geometry Nodes: more detailed socket tooltips for multi-input sockets
Tooltip for multi-input socket. This kind of inspection can help to
see what data are passed into a node. Any invalid, muted or dangling
link will not be taken into account. This feature reuse the already
existing tooltip formatting and just add column indentation in multi-line case.

Pull Request: https://projects.blender.org/blender/blender/pulls/104468
2024-04-22 19:48:57 +02:00
Hans Goudey
8c1bd99c28 Fix: Missing active layer assert in mesh tangent calculation
When there is no tangent layer with the active UV name we can't set
anything active. Better to do nothing than assert.
2024-04-22 13:27:47 -04:00
Falk David
cf59d2a385 GPv3: Expose Shader FX in the UI
Enables GPv3 in the UI poll functions for shader FX.
2024-04-22 18:26:00 +02:00
Clément Foucault
5f1faec6ff Fix: EEVEE-Next: Tangent normal map node affected by object scale
Use the same approach as Legacy EEVEE and normalize the
normal before interpolation.
Fix #120455
2024-04-22 16:38:13 +02:00
Sergey Sharybin
048c7da4e9 Fix: Difficult to LMB-click-drag motion tracking tracks
When using RMB selection and RMB-click-drag from a track border it
did not initiate translation of the track.

This i because the selection operator does not return PASSTHROUGH
for such selection. The code which was responsible for this has
been ported from the tools branch to minimize the code difference,
but it is not possible to detect condition under which the new
operator behavior is needed without modifying the keymap.

Simple solution: remove the code which was doing the wrong
assumption in the main branch.

Ref #119773

Pull Request: https://projects.blender.org/blender/blender/pulls/120940
2024-04-22 15:46:18 +02:00
Falk David
563ad616f0 Cleanup: GPv3: Improve readability in AnimDataConvertor
The class `AnimDataConvertor` was implementing `operator bool`
to indicate "if this AnimDataConvertor is valid, i.e. can be used to process animation data from source ID".
The cleanup replaces this with a `is_vaild` function, making the
code easier to read and allowing to jump to the function definition
of `is_valid`.
2024-04-22 15:30:43 +02:00
Clément Foucault
3182ce2393 DRW: Add asserts for nullptr binding
These will crash at submission time anyway and will
be hard to track back to the actual resource causing
the issue. Better fail earlier.
2024-04-22 15:26:48 +02:00
Bastien Montagne
fc08f7491e Fix: GPv3: Conversion of 'thickness adjustment' not clamping radius to 0
Legacy GPv2 code seems to clamp the final computed radius to `0` (at
least in some cases, see e.g. line 3992 in
`gpencil_stroke_perimeter_ex`).

Add a clamping node to the generated geometry node used to mimmic the
legacy thickness adjustment in GPv3 converted data.

NOTE: There are still some artifacts in testfile used to investigate
this issue (`(Anim) 10 Picknick by Susanne Weise.blend`), that looks
like invalid radius handling on some curves ends... Clamping _may_ be
needed in other places maybe?

Pull Request: https://projects.blender.org/blender/blender/pulls/120840
2024-04-22 15:03:06 +02:00
Jeroen Bakker
cfaa91296f Fix #120918: EEVEE-Next world volume on iGPU HD530
When using world shaders with volume, older hardware could create
errors when the world background wasn't behind a surface. The reason
is that the world volume shader had a color attachment attached, but
none were defined by the shader interface. This lead to undefined
behavior.

This PR fixes this by attaching the occupancy frame buffer. This
framebuffer only contains a depth attachment.

Pull Request: https://projects.blender.org/blender/blender/pulls/120927
2024-04-22 14:59:30 +02:00
Sybren A. Stüvel
910360637b Fix #120574: Broken animation when saving file with NLA tweak mode entered
Fix linking & library-overriding with NLA Tweak Mode enabled. This is a
two-pronged approach:

- When linking an animated ID from a library file, and it happens to be
  in NLA Tweak Mode, it is forced out of tweak mode. This ensures that
  the correct Action is loaded, and that all the NLA flags are set
  correctly to display the NLA animation (instead of only the tweaked
  strip).
- For library overrides there is now a post-process step that runs after
  all 'apply' functions have been run. This is necessary to ensure that
  all the flags and pointers that NLA Tweak Mode depends on are actually
  set correctly and consistently.

This also adds one utility function `BKE_nla_debug_print_flags()` that
is by now unused. It was very useful in debugging this, though, and I
think it'll be useful in the future as well.

Design task: #120573

Pull Request: https://projects.blender.org/blender/blender/pulls/120830
2024-04-22 14:56:05 +02:00
Sergey Sharybin
a48f685e2e Fix tracking slide zones are not intuitive under certain UI scale/zoom
This is a regression caused by some previous refactor of the code,
which was preparing it for transition to a tool-based tracking
workflow. Some of the hot zones got tweaked, and a change in the
behavior was done so that when click happens far away from any
slidable marker "widget" all markers gets de-selected (which
matches behavior in 3D viewport).

The pixel tolerance did not apply UI scale factor, and applied
zoom level after squaring (which is wrong calculation of pixel
space in screen space).

Ref #119773

Pull Request: https://projects.blender.org/blender/blender/pulls/119971
2024-04-22 14:44:42 +02:00
Aras Pranckevicius
91f0368fe2 Fix #120871: VSE crashes when sound strip has hold start offset larger than start
Caused by addition of new code in 4e10aa6e71, which was not guarding
against negative frame values. The only other place that called
BKE_sound_set_scene_sound_pitch_constant_range guarded against negative
frames (added in 1fb692e896 + 49a0502f35), but generally it looks like
negative frames are a "no no" in audaspace, so just move the value
sanitization into BKE_sound_set_scene_sound_pitch_constant_range itself.

Pull Request: https://projects.blender.org/blender/blender/pulls/120891
2024-04-22 14:44:05 +02:00
Sietse Brouwer
4fbef3dc6b GPv3: Cutter tool
This PR implements the Cutter Tool for GPv3. The Cutter tool deletes
points in between intersecting strokes. New points are created at the
exact intersection points, so as a result the cutted strokes will fit
perfectly.

For feature parity, the tool follows the GPv2 behavior:

- The cutter tool works on all editable layers.
- Intersections are only detected for curves on the same layer,
so intersection of curves on _seperate_ layers are not handled.

Technical notes
The implementation uses the `compute_topology_change` function
created for the Hard Eraser. So at intersection points, point
attributes will be interpolated.

Pull Request: https://projects.blender.org/blender/blender/pulls/113953
2024-04-22 14:05:22 +02:00
Jacques Lucke
ed111e1907 Fix: assert when opening debug build with OpenGL backend
Can't use `GPU_type_matches` there, because it requires `GPG.init` to be called beforehand.

Pull Request: https://projects.blender.org/blender/blender/pulls/120928
2024-04-22 13:57:18 +02:00
Jacques Lucke
1609541bbf Fix #120875: crash when deleting all group output nodes
This didn't take `geometry_nodes_default_cpp_value` into account properly.
2024-04-22 13:29:51 +02:00
Jeroen Bakker
0c2085a316 GPU: Remove GPU_compute_shader_support
Compute shaders are required since 4.0. There was one occasion where
an older AMD driver failed and support was turned off. This driver
is now marked unsupported.

This PR includes:
- removing the check in viewport compositing
- remove properties from system info
- always construct draw manager.
- remove unused pass logic in draw hair/curves
- add deprecation warning when accessed from python

Pull Request: https://projects.blender.org/blender/blender/pulls/120909
2024-04-22 13:28:10 +02:00
Lukas Stockner
cc541f2c07 UI: Add Wavelength unit for scene-independent nanometer-scale inputs
Currently this is only used for the Wavelength node, but it will also be relevant for the Thin Film Interference support in the Principled BSDF.

Pull Request: https://projects.blender.org/blender/blender/pulls/120900
2024-04-22 13:10:16 +02:00
Pratik Borhade
f4894c098f Fix #120920: Can not edit strokes/points when materials array is empty
Return entire points/curves range if object has no material.

Pull Request: https://projects.blender.org/blender/blender/pulls/120923
2024-04-22 13:04:15 +02:00