Commit Graph

112385 Commits

Author SHA1 Message Date
Jeroen Bakker
242271237a Vulkan: Ensure rendering ends when deleting attached framebuffer
When a frame buffer that is attached is being deleted the rendering end
event will never happen which leads to inconsistent render graphs.
2024-08-20 14:50:18 +02:00
Jeroen Bakker
df910f2417 GPU: Fix draw test on NVIDIA/OpenGL
Some workarounds cannot work on NVIDIA but are tested leading to
segfaults. Fixed by skipping in these cases.
2024-08-20 13:37:00 +02:00
Bastien Montagne
d6fa48c022 Fix #126507: GP conversion code was not updating link/append data.
Code executed in `BLO_read_do_version_after_setup` would not update in
any ways the info in link/append context data.

NOTE: this could potentially be extended to other code in this 'complex
do version' area. However, other versionning did not cause issues
apparently so far, so would rather until such changes are proven needed.
2024-08-20 12:51:47 +02:00
Bastien Montagne
2853a4c4db Refactor: Blendfile Link/Append: make callback of foreach item a function ref. 2024-08-20 12:51:47 +02:00
Bastien Montagne
382122f172 Cleanup: GPv3: Remove unused public GP object conversion function.
This was used during development for the conversion operator. now that
all data is systematically converted on load, it was not needed anymore
(and already unused).
2024-08-20 12:51:47 +02:00
Lukas Tönne
5a1f264d49 Fix: GPv3: Disable debug setting of the fill tool that keeps images. 2024-08-20 12:17:52 +02:00
Lukas Tönne
ec82ccb4b4 Fix #126271: Prevent comparing a curve index mask to a point span
The `has_anything_selected` function has a variant that takes just an
index mask and compares that to all selection attributes it can find,
regardless of which domain they are on. In this case the bezier handle
selection attributes were stored on the Curve domain while the selection
domain has already been switched to Point.

Now the `has_anything_selected` function always expects a domain so it
can check for attributes on that same domain.

Bezier handle selection does not make sense on the point domain, but the
way curve selection is written makes it difficult to prevent the
creation of the attribute on Curve domain. It's also not generally
prohibited (user can still create that attribute) so selection code
should handle this case robustly.

Pull Request: https://projects.blender.org/blender/blender/pulls/126543
2024-08-20 12:00:37 +02:00
Casey Bianco-Davis
1fb849b98e GPv3: Sculpt mode overlay.
This adds lines and points overlay to sculpt mode.
Visibly of lines and points matches legacy grease pencil.

Pull Request: https://projects.blender.org/blender/blender/pulls/126453
2024-08-20 11:57:59 +02:00
Lukas Tönne
400c738db9 GPv3: Import and export for SVG and PDF
Implements the SVG import/export and PDF export operators for GPv3.

Pull Request: https://projects.blender.org/blender/blender/pulls/123996
2024-08-20 11:41:37 +02:00
Jeroen Bakker
7a7ae5defe Vulkan: Occlusion Queries
Implements occlusion queries using VkQueryPools.

Pull Request: https://projects.blender.org/blender/blender/pulls/123883
2024-08-20 11:27:33 +02:00
casey bianco-davis
29be8ff359 GPv3: Only select visible bezier handles for Circle, Lasso and Box selection tools.
This makes so that only visible bézier handles can be selected by the
following tools: `Circle`, `Lasso` and `Box` selection.

Pull Request: https://projects.blender.org/blender/blender/pulls/125549
2024-08-20 11:00:08 +02:00
Campbell Barton
a51f6b6923 Fix #123405: Edit-mesh bridge crashes with all faces selected
Bridge could delete all faces & then fail to perform the bridge
operation. In this case the mesh was still modified.

Resolve by tracking the changed state, run updates when any changes are
made.
2024-08-20 17:46:34 +10:00
Jeroen Bakker
994e14b000 OpenGL: Enable HQ normals workaround for more AMD drivers
Allows EEVEE to be used on Legacy platforms. Fixes rendering black geometry in some cases.

Pull Request: https://projects.blender.org/blender/blender/pulls/126540
2024-08-20 08:46:55 +02:00
Campbell Barton
4cea295fcb Fix #126392: Crash loading a file with "Load UI" disabled
Resolve regression in [0].

Loading a blend file from the command line with "Load UI" disabled
was crashing.

Resolve by including the window in the temporary context override.

[0]: 7fcd4e2429
2024-08-20 16:37:34 +10:00
John Kiril Swenson
9dd2d7bd75 Fix: VSE snapping with edge panning
Ever since it was added to the VSE in e49fef45ce, edge panning would
break snapping -- edge panning a strip and then bringing it back would
cause snap code to trigger at incorrect locations. This is because the
edge pan system would update the `View2D` in `t->region->v2d.cur`, but
not mouse values, and so `t->values` would end up unchanged even while
the strip was moving.

e6a557952e fixed the issue for the node editor by recalculating mouse
input values when the view changed with `transformViewUpdate()`, but
since the code was separate from VSE, that fix did not get also get
applied here.

Although the code in `view2d_edge_pan_loc_compensate()` is mostly
identical between the two and so one possibility is to move it to
`transform_generics.cc`, adapting it to allow it to be used by both
spaces, custom transform data in the node editor additionally stores and
updates a `viewrect_prev` as mentioned in e040aea7bf, which VSE custom
data does not have. Since the fix is small enough and I don't want to
risk messing with other module code, I've opted to just copy the fix
over to VSE. If further bugs crop up in the future, we can consider
combining the code.

Also fix typo in `tranformViewUpdate()`.

Pull Request: https://projects.blender.org/blender/blender/pulls/126471
2024-08-20 07:11:45 +02:00
Campbell Barton
908d004fcc Cleanup: spelling in comments 2024-08-20 14:25:52 +10:00
Harley Acheson
7045fb6593 Refactor: Create File Browser Special Images When Needed
During startup we render 7 large icons used by File Browser in
thumbnail view, even though we only ever use 3. This change only
renders any the first time it is requested.  Saves a tiny amount
of startup time and 1 MB of RAM.

Pull Request: https://projects.blender.org/blender/blender/pulls/126532
2024-08-20 03:33:53 +02:00
Sean Kim
316b5475b9 Cleanup: Fix missing-declaration error in previous commit
852b3dbff3

A few structs that were in the .cc file needed to be moved into the .hh
file so that they are visible for `restore_from_bmesh_enter_geometry`

Pull Request: https://projects.blender.org/blender/blender/pulls/126531
2024-08-20 03:23:36 +02:00
Sean Kim
baa20eb289 Cleanup: Move pose brush specific structs to sculpt_pose.hh
Pull Request: https://projects.blender.org/blender/blender/pulls/126528
2024-08-20 01:24:13 +02:00
Sean Kim
d1102ec040 Cleanup: Remove unused SculptOrigVertData struct
Pull Request: https://projects.blender.org/blender/blender/pulls/126527
2024-08-20 01:20:33 +02:00
Pratik Borhade
da57f2f3d5 Fix #124187: UI placeholder fails with None
With python API, `placeholder=None` throws an error and fails to
display the property in UI. Clear `PROP_NEVER_NULL` flag to resolve.

Pull Request: https://projects.blender.org/blender/blender/pulls/126497
2024-08-20 01:02:52 +02:00
Hans Goudey
4c37b3ea02 Cleanup: Resolved missing declaration warnings after recent cleanup
852b3dbff3
2024-08-19 17:00:29 -04:00
Hans Goudey
cc5d9387ce Fix: Build error after recent commit
c9a69f70d9
2024-08-19 16:54:36 -04:00
Hans Goudey
db265c9aac Sculpt: Specialize normal and topology mask expand operations
Use the flood fill utilities specialized per geometry type instead of
the existing abstraction which is now only used in the pose brush.
2024-08-19 16:52:41 -04:00
Hans Goudey
3afa9c8e4f Cleanup: Consistent C++ class layout 2024-08-19 16:52:41 -04:00
Sean Kim
c9a69f70d9 Refactor: Sculpt: Consolidate pbvh clearing actions
This commit introduces a number of changes to make PBVH and related
attribute lifecycle more predictable.

A common method, `BKE_sculptsession_free_pbvh` is introduced to manage
freeing related resources that are stored in `SculptSession`

Prior to this commit, the `active_vert_` attribute was only ever
changed when a raycast successfully hit the mesh. This commit changes
the behavior to not store a stale reference in the following cases:

* When dyntopo is enabled or disabled
* When a mesh with the subdivision modifier is subdivided further
* When the sculpt level of a subdiv modifier is changed
* When the subdivision modifier is removed from a mesh

Pull Request: https://projects.blender.org/blender/blender/pulls/126341
2024-08-19 22:15:19 +02:00
Jacques Lucke
625ba5dd82 Cleanup: remove unnecessary std::move 2024-08-19 21:56:34 +02:00
Jacques Lucke
7dbff95070 Fix #126450: crash in Sample UV Surface node 2024-08-19 21:01:15 +02:00
Jacques Lucke
354a097ce0 Volumes: improve file cache and unloading
This changes how the lazy-loading and unloading of volume grids works. With that
it should also fix #124164.

The cache is now moved to a deeper and more global level. This allows reloadable
volume grids to be unloaded automatically when a memory limit is reached. The
previous system for automatically unloading grids only worked in fairly specific
cases and also did not work all that well with caching (parts of) volume
sequences.

At its core, this patch adds a general cache system in `BLI_memory_cache.hh`. It
has a simple interface of the form `get(key, compute_if_not_cached_fn) ->
value`. To avoid growing the cache indefinitly, it uses the new
`BLI_memory_counter.hh` API to detect when the cache size limit is reached. In
this case it can automatically free some cached values. Currently, this uses an
LRU system, where the items that have not been used in a while are removed
first. Other heuristics can be implemented too, but especially for caches for
loading files from disk this works well already.

The new memory cache is internally used by `volume_grid_file_cache.cc` for
loading individual volume grids and their simplified variants. It could
potentially also be used to cache which grids are stored in a file.
Additionally, it can potentially also be used as caching layer in more places
like loading bakes or in import geometry nodes. It's not clear yet whether this
will need an extension to the API which currently is fairly minimal.

To allow different systems to use the same memory cache, it has to support
arbitrary identifiers for the cached data. Therefore, this patch also introduces
`GenericKey`, which is an abstract base class for any kind of key that is
comparable, hashable and copyable.

The implementation of the cache currently relies on a new `ConcurrentMap`
data-structure which is a thin wrapper around `tbb::concurrent_hash_map` with a
fallback implementation for when `tbb` is not available. This data structure
allows concurrent reads and writes to the cache. Note that adding data to the
cache is still serialized because of the memory counting.

The size of the cache depends on the `memory_cache_limit` property that's
already shown in the user preferences. While it has a generic name, it's
currently only used by the VSE which is currently using the `MEM_CacheLimiter`
API which has a similar purpose but seems to be less automatic, thread-safe and
also has no idea of implicit-sharing. It also seems to be designed in a way
where one is expected to create multiple "cache limiters" each of which has its
own limit. Longer term, we should probably strive towards unifying these
systems, which seems feasible but a bit out of scope right now. While it's not
ideal that these cache systems don't use a shared memory limit, it's essentially
what we already have for all cache systems in Blender, so it's nothing new.

Some tests for lazy-loading had to be removed because this behavior is more
implicit now and is not as easily observable from the outside.

Pull Request: https://projects.blender.org/blender/blender/pulls/126411
2024-08-19 20:39:32 +02:00
Iliya Katueshenock
1b67be14c6 Cleanup: BKE: Nodes: Functions renaming
Use snake style naming for all the kernel nodes functions.
Omit kernel prefix in the names since of the using namespace.
Use full forms of the terms
('iter' -> 'iterator', 'ntree' -> 'node_tree', 'rem' -> 'remove', ...).

Pull Request: https://projects.blender.org/blender/blender/pulls/126416
2024-08-19 20:27:37 +02:00
Aras Pranckevicius
0a4666dee2 Fix: IMB_scale Box filter for 2px images
Just-introduced in #126390, when source image size is just two pixels
it should not advance to the third pixel after reading the first two.
Was pointed out by randomly failing tests, yay tests.
2024-08-19 20:31:24 +03:00
Sean Kim
852b3dbff3 Refactor: Sculpt: Split sculpt_intern.hh into separate header files
This commit takes the namespaces used in `sculpt_intern.hh` and splits
them into their own header files to better logically separate data and
avoid pulling in so many transitive dependencies by needing to include
`sculpt_intern.hh`

Actual removal of `sculpt_intern.hh` from other files is pending
further cleanup of the methods contained within.

A quick summary of the other changes included in this commit:
* `enum` to `enum class` cleanup for enums to enable forward
  declarations
* `FilterCache` default destructor to allow forward declaration of
  other dependent `struct`s contained in `unique_ptr`s
* Cleanup of unused headers
* Move `SculptBoundary` into the `boundary` namespace
* Move misc brush method forward declarations into `types.hh`

For a given `.cc` file that corresponds to a specific `.hh` file, the
header has been placed at the very top to try and ensure that the
needed data is self contained.

Forward declaration is preferred in most of these files outside of the
templates, classes, and structs in BLI headers.

---

Manual testing done:
- Enter Sculpt mode and perform strokes
- Use automasking for some strokes
- Use mesh filter

Pull Request: https://projects.blender.org/blender/blender/pulls/126443
2024-08-19 19:01:27 +02:00
Omar Emara
5930e0404a Compositor: Support Image node in new CPU compositor
This patch supports the Image node in the new CPU compositor.
2024-08-19 18:38:50 +03:00
Philipp Oeser
0d4e2ea40d Fix #126434: Boid particle fight rule crash involving non-boid psys
For the boid Fight rule (and when determining friend/enemy health), we
need to check if other `ParticleTarget` psys is actually boids as well
(their health data is accessed -- which is only present on boid particle
systems), otherwise NULL data access crashes.

I know, EOL, but simple crash fixers should still get a chance to get in
I think.
Could also go into LTSes.

Pull Request: https://projects.blender.org/blender/blender/pulls/126494
2024-08-19 17:01:18 +02:00
Aras Pranckevicius
6d93bf6b44 IMB: Speedups, fixes and cleanups to various image scaling functions
API: merged IMB_scalefastImBuf, IMB_scaleImBuf, IMB_scaleImBuf_threaded
into one function IMB_scale with enum IMBScaleFilter {Nearest, Bilinear, Box}
and bool "threaded" param.

Performance:
- Box filtering (nee IMB_scaleImBuf) can be multi-threaded now.
- Nearest filtering (nee IMB_scalefastImBuf) can be multi-threaded now.
  Also fix performance regression on float images caused by fix in #126234
- Bilinear filtering (nee IMB_scaleImBuf_threaded) is several times faster now.

Correctness:
- Nearest and Box filtering: no longer loses half of edge pixels when scaling
  up.
- Box: fixed garbage results (and possible out of bounds reads) for non-4
  channel float images.
- Bilinear: no longer shifts image when scaling up.
- Bilinear: properly filters when scaling down by 2x2.

Test coverage:
- Add gtest coverage for various IMB_scale modes.
- Add a IMB_performance_test performance test, ran manually.

More details, images and performance numbers in PR.

Pull Request: https://projects.blender.org/blender/blender/pulls/126390
2024-08-19 16:50:05 +02:00
Clément Foucault
a6ce1cd9c7 Cleanup: Overlay: Silence warnings 2024-08-19 15:39:58 +02:00
Clément Foucault
e49bc9633b Overlay-Next: Particles
Straightforward port.

Duplicated some shaders for simplicity.

Includes wireframe for hair particle systems.

Functional change: Particle display now honnor line width.

Rel #102179

Pull Request: https://projects.blender.org/blender/blender/pulls/126456
2024-08-19 15:38:55 +02:00
Jeroen Bakker
ef3ceb3629 Vulkan: Resource Pools
This PR implements #126353; In short: keep discard list as part of swap chain images. This allows
better determination when resources are actually not in use anymore.

## Resource pool

Resource pools keep track of the resources for a swap chain image.

In Blender this is a bit more complicated due to the way GPUContext work. A single thread can have
multiple contexts. Some of them have a swap chain (GHOST Window) other don't (draw manager). The
resource pool should be shared between the contexts running on the same thread.

When opening multiple windows there are also multiple swap chains to consider.

### Discard pile

Resource handles that are deleted and stored in the discard pile. When we are sure that these
resources are not used on the GPU anymore these are destroyed.

### Reusable resources

There are other resources as well like:
- Descriptor sets
- Descriptor pools

## Open issues

There are some limitations that require future PRs to fix including:
- Background rendering
- Handling multiple windows
- Improve CPU/GPU synchronization
- Reuse staging buffers

Pull Request: https://projects.blender.org/blender/blender/pulls/126353
2024-08-19 15:37:48 +02:00
Pratik Borhade
60a467204c Fix: GPv3: F3 search crash due to weight paint poll function
Mistake in d1f0d71b54
Invoking search menu triggers crash for objects that do not support
vgroups. Adjust poll function to fix this.

Pull Request: https://projects.blender.org/blender/blender/pulls/126495
2024-08-19 13:53:04 +02:00
Lukas Tönne
78409a3996 Fix #122831: GPv3 keyframe transform crashes on cancel
The `drawing_index` in frame data can become invalid during transform if
a frame overwrites another. This is very difficult to keep track of
explicitly, so instead this fix just "freezes" drawing indices by adding
a user at the beginning of the transform to every existing drawing and
removing it at the end after all frame data has been updated.
No `drawing_index` needs to be updated during the transform.

Pull Request: https://projects.blender.org/blender/blender/pulls/126312
2024-08-19 12:39:15 +02:00
Clément Foucault
7d2672fb5d Fix: EEVEE: Broken overscan with pixel size greater than 1
Stupid sign error.

Fix #124961
2024-08-19 12:32:28 +02:00
Clément Foucault
86e9254a63 Overlay-Next: Wireframe
Straightforward port.

Left out particle hair to a separate patch for consistency
and simplicity.

Grease Pencil is also missing but that's also missing in
main.

Rel #102179

Pull Request: https://projects.blender.org/blender/blender/pulls/126242
2024-08-19 12:31:08 +02:00
Casey Bianco-Davis
1a07c08718 GPv3: Eyedropper tool
This adds the Eyedropper tool to GPv3.

A few changes have been made:

- Added `Brush` mode.
- Set active color in palette.
- Show the palette in the UI.
- Add UI for setting material mode.
- Drag for color accumulation.

Pull Request: https://projects.blender.org/blender/blender/pulls/126211
2024-08-19 11:27:49 +02:00
Omar Emara
ba61fc9326 Compositor: Allow delayed typing for results
This patch allows result to have their types set after construction but
before allocation.
2024-08-19 11:07:12 +03:00
Jeroen Bakker
975dcea23f OpenGL: Enable High Quality Normals for Legacy AMD Drivers
On Legacy AMD devices EEVEE doesn't render any geometry. During testing
we found that it was based on reading normal attribute. Further testing
it was detected that enabling the high quality normals would solve the
rendering.

This is a known issue on legacy AMD drivers. This PR updates the check
to enable the high quality normals workaround for the latest known AMD
legacy drivers (22.6.1/21.Q1.2). Both drivers still have this issue.

Pull Request: https://projects.blender.org/blender/blender/pulls/126483
2024-08-19 09:42:52 +02:00
Campbell Barton
976062c771 Cleanup: use prefix comments before struct members 2024-08-19 11:37:20 +10:00
Harley Acheson
7c68ac258f UI: File Browser Offline and Alias State Icon Position
#125625 moved the File Browser Thumbnail type icon location from the
bottom-left of the thumbnail extent to the bottom-left of the item
bounds. This does the same for the indication of offline and for
shortcut. This adds a new icon for shortcut instead of current use of
ICON_LOOP_FORWARDS, which doesn't look right. The new icon looks like
the Mac Alias arrow, but this also works fine for other platforms.

Pull Request: https://projects.blender.org/blender/blender/pulls/126469
2024-08-18 22:11:53 +02:00
Hans Goudey
b2368b7eb0 Revert "Refactor: Sculpt: Move original position restore to brush deform step"
This reverts commit 93054f9a0e.

I had forgotten the reason for this separate "restore" step before the brush
deform evaluation was because multiple symmetry steps can be processed in the
same BVH node, in which case we can't just overwrite the values from the last
symmetry step.
Fixes #126445.
2024-08-18 15:09:58 -04:00
Clément FOUCAULT
b919887682 DRW: Add assertions for unsupported values
The `draw::Pass` types have different capabilities.
Custom ID and primitive expansion count are now
checked before command recording.
2024-08-18 15:39:06 +02:00
Clément FOUCAULT
7de383ffc6 Fix: Overlay-Next: Volume outline crashing
Caused by using the wrong pass to create the drawcall.
2024-08-17 13:50:53 +02:00