Commit Graph

120055 Commits

Author SHA1 Message Date
Jeroen Bakker
e6fad4b779 Vulkan: Fix memory leak in render graph
There was a memory leak in the render graph where nodes where freed,
but not the data it could keep. Detected during adding support for
compute shaders and running the draw tests.

Pull Request: https://projects.blender.org/blender/blender/pulls/120906
2024-04-22 06:22:31 +02:00
Hans Goudey
3539cdfbdd Cleanup: Use const for sculpt automasking cache 2024-04-21 20:21:22 -04:00
Jeroen Bakker
1d9d0f0056 Vulkan: Missing include when compiling draw tests
MoltenVK includes are not found when compiling draw tests on certain
configurations. It has to do with the number of ways the VulkanSDK and
MoltenVK can be configured. Other executables the molten vk was included
to the system includes, except when compiling drawing tests.

This PR will equalize the includes how MoltenVK between the different
binaries

Pull Request: https://projects.blender.org/blender/blender/pulls/120888
2024-04-21 17:39:08 +02:00
Jeroen Bakker
463a4c6211 Cleanup: Move specialization constant default hash
The specialization constant default hash was implemented in gl_shader.hh
But the same implementation is needed for vulkan. This PR moves the
default hash to a common place where both backends can use it.

Pull Request: https://projects.blender.org/blender/blender/pulls/120889
2024-04-21 16:56:00 +02:00
Fermin
821b773d95 FIX #109121: VR: Render controllers only if they are active
When turning on VR mode, if no controllers are available,
a fallback model (a sphere) is rendered in the middle of the VR area.

This change uses the OpenXR API to check if the controllers are
available, sets new properties in `GHOST_XrPose` and `wmXrController`
that store if each controller is active or not, and uses
those properties to render the controllers in the VR view only
when they are active.

NOTE: in `wmXrController`, two state properties have been included,
but only `grip_active` is currently used. `aim_active` has been
included for consistency, but it could be removed.

Pull Request: https://projects.blender.org/blender/blender/pulls/119989
2024-04-21 03:28:35 +02:00
Aras Pranckevicius
689fce50bd Fix #120789: Slowness when using image vectorscope opacity slider
Since image vectorscope RGB mode addition (567455124d), changing
the opacity was causing the scope to get recalculated from scratch,
because opacity value was put into vecscope_rgb data directly.

Instead of that, make vecscope_rgb data only contain RGB, and fill in
the GPU vertex buffer alpha values when creating the GPU batch.

Now tweaking the scope opacity slider feels at about the same
performance as in 4.0.

Pull Request: https://projects.blender.org/blender/blender/pulls/120854
2024-04-20 17:08:56 +02:00
Sybren A. Stüvel
933f74ca02 Anim: Baklava, add Animation data-block to anim filtering code
Add minimal support for the `Animation` data-block to the anim filtering
code. This means:

- F-Curves in the `Animation` data-block are shown in the Dope Sheet and
  Graph Editor.
- The `Animation` is shown underneath each animated data-block, just
  like an `Action` would be.
- Contrary to Actions, the expanded/collapsed state is stored on
  `id->adt` and not on `Animation`. Because an `Animation` is intended
  to be used by multiple data-blocks, they each should have their own
  flag for this.
- In the filtering code, this PR adds the 'fillanim' channel type. This
  is simply mimicking the name from the Action's 'fillact' type.

Limitations:

- Deleting of F-Curves is explicitly blocked, as that'll be introduced
  in a later PR. The block prevents Blender from crashing.
- The Dope Sheet doesn't have an Animation mode yet, that'll be for a
  later PR too.

Pull Request: https://projects.blender.org/blender/blender/pulls/120654
2024-04-20 12:19:16 +02:00
Sybren A. Stüvel
075b4c178a Refactor: Anim, clarify a bit of NLA drawing code
Clarify the code in `nla_draw_strip()` by extracting some flags into
booleans, and renaming some variables.

- `solo` is flipped in value, and renamed to `is_other_track_soloed`, as
  this is what is actually modelled by the variable.
- The check for the `NLASTRIP_FLAG_INVALID_LOCATION` flag is stored in a
  `const bool` to aid in debugging.

No functional changes.

Pull Request: https://projects.blender.org/blender/blender/pulls/120828
2024-04-20 11:25:39 +02:00
Pratik Borhade
eea73bffb4 UI: Fade all non-ID children if parent is hidden in outliner
Part of !120397.
For non-id tree elements, call `element_should_draw_faded` and get the
fade status of their parent. For example, this will fix the fading of
modifier, actions, bones, etc. in outliner.

Pull Request: https://projects.blender.org/blender/blender/pulls/120813
2024-04-20 10:46:12 +02:00
Clément Foucault
df064270a1 Fix: EEVEE-Next: Light: Missing shadows inside sphere light
The function `light_sphere_disk_radius` was misbehaved inside
the sphere. The LTC code has a early return but the shadow
code has not. In any cases, this patch avoids NaN issue.
2024-04-20 09:01:03 +02:00
Guillermo Venegas
1587abc148 Fix #119854: Avoid unsetting HIDDEN flag on properties
Ref !119881
2024-04-20 14:59:32 +10:00
Campbell Barton
fd589fdca4 Cleanup: various non functional C++ changes 2024-04-20 13:46:14 +10:00
Campbell Barton
c6a9b11ef6 Cleanup: use const pointers 2024-04-20 12:41:23 +10:00
Sean Kim
285cbf9ee4 Cleanup: Fixup naming for sculpt_project.cc
This PR removes some unnecessary type and
function prefixes from `sculpt_gesture.cc`

Pull Request: https://projects.blender.org/blender/blender/pulls/120847
2024-04-20 04:04:29 +02:00
Harley Acheson
d8f6ae7919 UI: Outliner "File Mode" Manage User Count
In Outliner "Blender File Mode" view, show user counts, and allow
removing and adding fake user, requested in #118655.

Pull Request: https://projects.blender.org/blender/blender/pulls/118691
2024-04-20 02:50:12 +02:00
Hans Goudey
026f8e8bdf Fix: Missing include in previous commit
55c1abb8a0
2024-04-19 14:36:10 -04:00
Clément Foucault
9dd164e1ad EEVEE-Next: Rename screen trace max roughness
Remove "screen" from the name as it is not limited to
screen trace.
2024-04-19 20:27:24 +02:00
Pratik Borhade
d7cd25fc94 Fix #120731: sculpt trim tool crash
Caused by f7d5ec8661
`initialize_cursor_info` requires `gesture_data.operation` initialized.
So move allocation outside of `init_operation`

Pull Request: https://projects.blender.org/blender/blender/pulls/120733
2024-04-19 20:27:02 +02:00
Hans Goudey
55c1abb8a0 Cleanup: Unused variable warning 2024-04-19 14:25:09 -04:00
Bastien Montagne
2736446d65 Fix #119999: RNA copy failure due to improper handling of unset dynamic RNA properties.
A fully unset (i.e. null IDProperty storage pointer) dynamic RNA
property would not be properly handled by RNA copy code path. This led
to having a type mismatch (because dynamic RNA booleans are stored in
integer IDProperies) betwen source and destination RNA properties.
Since the fix in 6adf5adb7f, such type mismatch will abort the copying
process.

This is fixed by updating the `PropertyRNAOrID` internal struct to also
store whether the given property is actually a dynamic RNA one with
IDProperty storage.

NOTE: Potential side-effects: That kind of change is very difficult to
fully analyse, but no side-effects from this fix are expected. The only
code which behavior is changed is `rna_ensure_property_realdata`, which
is only used by `RNA_property_copy` currently.

This change to `PropertyRNAOrID`/`rna_property_rna_or_id_get` _may_ be
useful in the future though, e.g. in liboverride codepath...
2024-04-19 15:52:17 +02:00
Clément Foucault
c450200873 Fix: EEVEE-Next: Fix wrong space transformation for default thickness
The previous code was applying translation to a direction vector
making the thickness dependant on the object position.
2024-04-19 15:08:33 +02:00
Hans Goudey
7f5dd29abd Subdiv: Make OpenSubdiv_TopologyRefiner into a C++ class
Replace the C-class pattern function pointers with actual class methods.
Other than the obvious benefit of not requiring the "this" pointer to be
explicitly passed into every function call, this will make it much simpler
to remove the entire C-API class and replace it with its "impl" next.

For that next step we need to expose code to the implementation
of the topology refiner, so instead of defining stubs locally in the
opensubdiv intern class, we spread some WITH_OPENSUBDIV checks
in the blenkernel. As far as I know this is the only way to remove the
intermediate C-API and call opensubdiv functions directly from there.
2024-04-19 09:03:48 -04:00
Hans Goudey
52c0f4078a Cleanup: Remove redundant part of SubdivForeachTaskContext name
The "subdiv" part is implied by the namespace.
2024-04-19 09:03:39 -04:00
Hans Goudey
11f0d88d13 Subdiv: Move most blenkernel subdiv code to C++ namespace
Move most code to `blender::bke::subdiv`. That helps organization
and makes using C++ in subdiv code easier, which will be useful for
removing the unnecessary opensubdiv C-API wrapper.
2024-04-19 09:03:31 -04:00
Jeroen Bakker
be75f1ac2b Vulkan: Render graph textures
This PR implements render graph for VKTexture. During the
implementation some tweaks to the render graph was done
to support depth and stencil textures.

The render graph will record the image aspect being used
for each node. This will then be used to generate barriers
for the correct aspect.

Also fixes an issue that uploading of array textures didn't
allocate a large enough staging buffer.

Pull Request: https://projects.blender.org/blender/blender/pulls/120821
2024-04-19 14:55:39 +02:00
Germano Cavalcante
f5f05c99c9 Fix: Snap with 'Backface Culling' skipping edges and vertices of faces in edit mode
After 1c77779160, the snap logic in Edit Mode became the same as in
Object Mode, so Backface Culling started to ignore edges and vertices
of faces seen from behind.
2024-04-19 09:47:49 -03:00
Pratik Borhade
7c89efd787 Fix #120809: Skip saving use_selected_objects
Issue came with the new feature of adding modifiers to selected objects
by holding alt: 9a7f4a3b58. `use_selected_objects` state should not be
remembered. Otherwise, it's possible to add/edit modifier of multiple
object without holding alt

Pull Request: https://projects.blender.org/blender/blender/pulls/120810
2024-04-19 14:00:49 +02:00
Clément Foucault
7b38873732 EEVEE-Next: Volume: Add custom integration range
This is just adding a switch for enabling custom range.

Custom range is now optional as we compute a tight bound
to integrate around volume objects by default.

The custom range is only needed for scene with really
thick world volumes.

Pull Request: https://projects.blender.org/blender/blender/pulls/120823
2024-04-19 13:51:27 +02:00
Omar Emara
dd321a47a6 Fix #120715: File Output node writes empty outputs
The File Output node writes single elements as full images in 4.1, while
such values were skipped in 4.0. This included invalid outputs, for
instance, when the Render Layers node does not have a result for the
selected view layer. Which would then just write an image with an
arbitrary color.

To fix this, we detect single element values and skip writing file
outputs for them.

Pull Request: https://projects.blender.org/blender/blender/pulls/120749
2024-04-19 12:38:31 +02:00
Omar Emara
5e3932595f Compositor: Allow constant folding of set operations
This patch replaces the is_set_operation flag with the
is_constant_operation flag to allow input constants to propagate
through the node tree using the constant folder.
2024-04-19 12:34:43 +02:00
Clément Foucault
2c19be2682 EEVEE-Next: UI: Render Panel
- Reorder panels to match Cycles (and rendering pipeline order)
  `Sampling > Objects > Motion Blur / Dof > Film > Performance`
- General reordering of properties to avoid too many panels.
- Make sure panels a disabled if their checkbox is.
- Enabled Freestyle panel for EEVEE-Next.
- Merge some panels into sub-panels.
- Add `Clamping` panel.
- Split Lighprobe panel into `Performance` and `Scene`.
- Move shadow panel to Sampling.
- Generally improve consistency with Cycles.

Pull Request: https://projects.blender.org/blender/blender/pulls/120691
2024-04-19 12:12:28 +02:00
Jeroen Bakker
ed9dea08b2 Vulkan: Render graph storage buffers
A developer can switch `vk_common.hh#use_render_graph` to enable render graph.
When enabled the buffers and images are tracked by the device resource state
tracker. The storage buffer commands are recorded to the context render graph.

The next unit tests will pass:
- GPUVulkanTest.storage_buffer_create_update_read
- GPUVulkanTest.storage_buffer_clear_zero
- GPUVulkanTest.storage_buffer_clear
- GPUVulkanTest.storage_buffer_copy_from_vertex_buffer

The pattern to migrate to render graph is:
- always construct CreateInfo for class.
- based on `use_render_graph` call `context.command_buffers.something`
  or `context.render_graph.add_node`.
- Hide calls to `context.flush` when `use_render_graph` is true.

Pull Request: https://projects.blender.org/blender/blender/pulls/120812
2024-04-19 12:08:57 +02:00
Bastien Montagne
8b1154a854 Fix #119999: Regression: Copy to selected on addons properties crash Blender.
Changes introduced in 6adf5adb7f did not take into account that this
code is also used by regular RNA copy code, in which case there is no
override data available.

NOTE: This commit fixes the crash. The root of the issue (that two
propoerties that should have identical types are detected as of
different types) remains under investigation.
2024-04-19 12:04:03 +02:00
Jeroen Bakker
c6fc125e3d Vulkan: Missing binding tracking
f2ae04db10 introduces missing binding
tracking for SSBO and UBOs. Vulkan relies on validation layers to
report on missing bindings, but the binding information should still
be cleared in the context state manager.

Pull Request: https://projects.blender.org/blender/blender/pulls/120814
2024-04-19 11:13:06 +02:00
Jeroen Bakker
d9d4f90142 GPU: Add test case for GPU_storagebuf_copy_sub_from_vertbuf
This API function wasn't covered in any test.

Pull Request: https://projects.blender.org/blender/blender/pulls/120817
2024-04-19 11:12:16 +02:00
Jeroen Bakker
adab06bc67 Vulkan: Render graph core
**Design Task**: blender/blender#118330

This PR adds the core of the render graph. The render graph isn't used.
Current implementation of the Vulkan Backend is slow by design. We
focused on stability, before performance. With the new introduced render
graph the focus will shift to performance and keep the stability at where
it is.

Some highlights:
- Every context will get its own render graph. (`VKRenderGraph`).
- Resources (and resource state tracking) is device specific (`VKResourceStateTracker`).
- No node reordering / sub graph execution has been implemented. Currently
  All nodes in the graph is executed in the order they were added. (`VKScheduler`).
- The links inside the graph describe the resources the nodes read from (input links)
  or writes to (output links)
- When resources are written to a resource stamp is incremented allowing keeping
  track of which nodes needs which stamp of a resource.
- At each link the access information (how does the node accesses the resource)
  and image layout (for image resources) are stored. This allows the render graph
  to find out how a resource was used in the past and will be used in the future.
  That is important to construct pipeline barriers that don't stall the whole GPU.

# Defined nodes

This implementation has nodes for:
- Blit image
- Clear color image
- Copy buffers to buffers
- Copy buffers to images
- Copy images to images
- Copy images to buffers
- Dispatch compute shader
- Fill buffers
- Synchronization

Each node has a node info, create info and data struct. The create info
contains all data to construct the node, including the links of the graph.
The data struct only contains the data stored inside the node. The node info
contains the node specific implementation.

> NOTE: Other nodes will be added after this PR lands to main.

# Resources

Before a render graph can be used, the resources should be registered
to `VKResourceStateTracker`. In the final implementation this will be owned by
the `VKDevice`. Registration of resources can be done by calling
`VKResources.add_buffer` or `VKResources.add_image`.

# Render graph

Nodes can be added to the render graph. When adding a node its read/
write dependencies are extracted and converted into links (`VKNodeInfo.
build_links`).
When the caller wants to have a resource up to date the functions
`VKRenderGraph.submit_for_read` or `VKRenderGraph.submit_for_present`
can be called.

These functions will select and order the nodes that are needed
and convert them to `vkCmd*` commands. These commands include pipeline
barrier and image layout transitions.

The `vkCmd` are recorded into a command buffer which is sent to the
device queue.

## Walking the graph

Walking the render graph isn't implemented yet. The idea is to have a
`Map<ResourceWithStamp, Vector<NodeHandle>> consumers` and
`Map<ResourceWithStamp, NodeHandle> producers`. These attributes can
be stored in the render graph and created when building the links, or
can be created inside the VKScheduler as a variable. The exact detail
which one would be better is unclear as there aren't any users yet. At
the moment the scheduler would need them we need to figure out the best
way to store and retrieve the consumers/producers.

# Unit tests

The render graph can be tested by enabling `WITH_GTEST` and use
`vk_render_graph` as a filter.

```
bin/tests/blender_test --gtest_filter="vk_render_graph*"
```

Pull Request: https://projects.blender.org/blender/blender/pulls/120427
2024-04-19 10:46:50 +02:00
Bastien Montagne
9c8dab6b18 Fix a couple of RNA/UI issues with EEVEE next raytrace options.
- DNA defaults were not properly registered, preventing the 'reset to
  default' to work correctly.
- The RNA sub-struct path was not properly generated.
- The RNA struct had no UI/API info.
2024-04-19 10:15:39 +02:00
Christoph Lendenfeld
6af54b4b1e Refactor: use IndexRange for loops in graph_draw.cc
No functional changes.

This modifies the function `get_bounding_bezt_indices` to return an `IndexRange` instead of an `int2`.
With that it is possible to use the C++ for loop syntax.
The function is renamed to `get_bounding_bezt_index_range` to represent its return type.

Pull Request: https://projects.blender.org/blender/blender/pulls/120786
2024-04-19 10:10:23 +02:00
Campbell Barton
4e8b24f1d1 Cleanup: spelling in comments & punctuation 2024-04-19 15:57:06 +10:00
Campbell Barton
0ceefd6358 Cleanup: cmake syntax 2024-04-19 15:50:26 +10:00
Campbell Barton
2d7dd9770a Cleanup: remove unnecessary ".svn" exclude for CMake 2024-04-19 15:50:25 +10:00
Clément Foucault
0791d7c349 EEVEE-Next: Light: Add ray visbility support
This is very straightforward.

We don't do any versionning as we assume that
if a scene was using these, it was not using eevee
as default renderer.
2024-04-18 22:10:54 +02:00
Clément Foucault
125fcc948e EEVEE-Next: Light: Add transmission factor
Now that lights are supported for refraction BSDFs,
there is no reason to not add support for it.

Versionning sets it to zero for compatibility with
legacy EEVEE.

This is also needed in order to support per object
ray visibility.

Pull Request: https://projects.blender.org/blender/blender/pulls/120796
2024-04-18 22:08:50 +02:00
Boltzmachine
740c9f220d VSE: Add RGB Parade Display Mode for sequencer
This PR implements #120479 by adding a new Waveform Display Mode
"RGB Parade" that will essentially be the Luma Waveform but with
"Separate Colors" turned on.

Pull Request: https://projects.blender.org/blender/blender/pulls/120615
2024-04-18 21:25:44 +02:00
Hans Goudey
40b7bf30c8 Cleanup: Remove unused variable 2024-04-18 15:17:28 -04:00
Jesse Yurkovich
3f8ec963e3 Fix: Use correct datatype in MSC modify_geometry_set for the frame time
The recently added `modify_geometry_set` code path [1] inside the Mesh
Sequence Cache was meant to follow what was done inside `modify_mesh`
but failed to use the correct data type for the time offset. Double is
used throughout Blender when dealing with the frame time and this was
simply missed.

This results in rounding errors and downstream consumers like USD would
re-read the wrong frames. e.g. it would read frame 4 twice because the
values provided when switching from frame 4 to frame 5 were
`4.000000119209290` and `4.999999880790710` instead of
`4.000000000000000` and `5.000000000000000` with this patch.

[1] ea256346a8

Pull Request: https://projects.blender.org/blender/blender/pulls/120790
2024-04-18 20:55:13 +02:00
Bastien Montagne
f3c677887d GPv3: Conversion: Significant refactor of animation hanlding.
While keeping the general process the same, this commit heavily
refactors the animation handling as part of the GPv2 to GPv3 conversion
process.

The whole animation handling is now embeded in new class, which covers
all current use cases (conversion of all fcurves matching a given root
RNA path, or a specific set of given full RNA paths, and transfer to
another ID's animation data if required).

The new system is also now able to perform custom additional conversion
on FCurves if necessary, through a new function callback.

This is used in this commit to fix two issues with the animation of the
'Stroke Thickness' GPv2 layers adjustment factor (the need to divide the
values by 2000, and to switch from an 'integer' FCurve to a regular
one).

Finally, this commit also adds suport for animation of the old GPv2
'Thickness Scale' parameter.

--------

NOTE: While this already improves a lot the animation handling code of
GPv3 conversion, this could still use more clean-up. Don't think it's
worth it within current usage scope though.

But if more use cases need to be covered, and/or we need such conversion
behavior in other places, it could be good to do another improvement
pass and move this as generic 'animation conversion' helper in a
dedicated BKE module.
2024-04-18 19:32:19 +02:00
Leon Schittek
9b21dffe45 Fix #94413: Hide added input sockets on group inputs with hidden sockets
Improve working with multiple group input nodes by automatically
hiding new node group input sockets on any group input node with
hidden extension socket.

Whenever the extension socket is hidden,  the user can now expect
the socket visibility of the group input node to stay fixed.
When the extension socket is shown on the other hand, the group input
node will update when sockets are added to the group interface.

Pull Request: https://projects.blender.org/blender/blender/pulls/120067
2024-04-18 19:20:05 +02:00
Hans Goudey
9a7f4a3b58 Modifiers: Affect all selected objects when holding alt
Support holding alt while invoking modifier operations for add, apply,
remove, and move to index in the property editor. This affects all selected
editable objects instead of just the active object.

Though the alt key is not that visible, it's consistent with the
existing multi-object property editing shortcut. If/when multi-
object editing is every made the default, the alt key could
be reversed here too.

Changes as part of #120230.

Pull Request: https://projects.blender.org/blender/blender/pulls/120695
2024-04-18 17:40:50 +02:00
Clément Foucault
aea31a530d EEVEE-Next: UI: More tweak to lightprobes 2024-04-18 17:32:49 +02:00