Cleanup: Add in NLAStrip / NLATrack remove / clean methods #104437

Merged
Nate Rupsis merged 8 commits from nrupsis/blender:T82241-cleanup-NLAStrip_remove into main 2023-02-13 18:10:28 +01:00
Member

Cleanup: Refactor NLATrack / NLAStrip Remove

This PR adds 3 new methods:

  • BKE_nlatrack_remove_strip
  • BKE_nlastrip_remove
  • BKE_nlastrip_remove_and_free

These named BKE methods are really just replacements for BLI_remlink, but with some added checks, and enhanced readability.

## Cleanup: Refactor NLATrack / NLAStrip Remove This PR adds 3 new methods: * BKE_nlatrack_remove_strip * BKE_nlastrip_remove * BKE_nlastrip_remove_and_free These named BKE methods are really just replacements for BLI_remlink, but with some added checks, and enhanced readability.
Nate Rupsis requested review from Sybren A. Stüvel 2023-02-07 21:48:44 +01:00
Nate Rupsis added this to the Animation & Rigging project 2023-02-07 21:48:45 +01:00
Nate Rupsis reviewed 2023-02-07 22:18:17 +01:00
@ -1 +1 @@
Subproject commit e133fc08cd3254bb3d3bd1345028c8486700bca4
Subproject commit 979bfe2504eb2f446639ab5768aac9b80b1f4864
Author
Member

I don't understand why this has changed. I've (at the time of this writing) updated with upstream main, and run git submodule sync. Any clues on why this might be?

I don't understand why this has changed. I've (at the time of this writing) updated with upstream main, and run `git submodule sync`. Any clues on why this might be?

AFAIK we never commit submodule changes, so I always just ignore those & never commit submodule hashes.

AFAIK we never commit submodule changes, so I always just ignore those & never commit submodule hashes.
nrupsis marked this conversation as resolved
Sybren A. Stüvel added the
Module
Animation & Rigging
label 2023-02-09 16:47:02 +01:00
Sybren A. Stüvel removed this from the Animation & Rigging project 2023-02-09 16:47:06 +01:00
Nate Rupsis added 26 commits 2023-02-09 17:23:08 +01:00
Cleanup: format
All checks were successful
buildbot/vdev-code-daily-coordinator Build done.
6aa1b5d031
The ear clipping method used by polyfill_2d only excluded concave ears
which meant ears exactly co-linear edges created zero area triangles
even when convex ears are available.

While polyfill_2d prioritizes performance over *pretty* results,
there is no need to pick degenerate triangles with other candidates
are available. As noted in code-comments, callers that require higher
quality tessellation should use BLI_polyfill_beautify.
Cleanup: use enum literals, order likely case first in polyfill_2d
All checks were successful
buildbot/vdev-code-daily-coordinator Build done.
d781e52ee0
Subdivision Surface: fix a serious performance hit when mixing CPU & GPU.
All checks were successful
buildbot/vdev-code-daily-coordinator Build done.
4d3bfb3f41
Subdivision surface efficiency relies on caching pre-computed topology
data for evaluation between frames. However, while eed45d2a23
introduced a second GPU subdiv evaluator type, it still only kept
one slot for caching this runtime data per mesh.

The result is that if the mesh is also needed on CPU, for instance
due to a modifier on a different object (e.g. shrinkwrap), the two
evaluators are used at the same time and fight over the single slot.
This causes the topology data to be discarded and recomputed twice
per frame.

Since avoiding duplicate evaluation is a complex task, this fix
simply adds a second separate cache slot for the GPU data, so that
the cost is simply running subdivision twice, not recomputing topology
twice.

To help diagnostics, I also add a message to show when GPU evaluation
is actually used to the modifier panel. Two frame counters are used
to suppress flicker in the UI panel.

Differential Revision: https://developer.blender.org/D17117

Pull Request #104441
Fix references to the main branch in the .gitmodules
All checks were successful
buildbot/vdev-code-daily-coordinator Build done.
4ed8a360e9
Un-ignore modules in .gitmodules configuration
All checks were successful
buildbot/vdev-code-daily-coordinator Build done.
aab707ab70
The meaning of the ignore option for submodules did change since our
initial Git setup was done: back then it was affecting both diff and
stage families of Git command. Unfortunately, the actual behavior did
violate what documentation was stating (the documentation was stating
that the option only affects diff family of commands). This got fixed
in Git some time after our initial setup and it was the behavior of the
commands changed, not the documentation. This lead to a situation when
we can no longer see that submodules are modified and staged, and it is
very easy to stage the submodules.

For the clarity: diff and status are both "status" family, show and
diff are "diff" family.

Hence this change: since there is no built-in zero-configuration way
of forbidding Git from staging submodules lets make it visible and
clear what the state of submodules is.

We still need to inform people to not stage submodules, for which
we can offer some configuration tips and scripts but doing so is
outside of the scope of this change at it requires some additional
research. Current goal is simple: make it visible and clear what is
going to be committed to Git.

This is a response to an increased frequency of incidents when the
submodules are getting modified and committed without authors even
noticing this (which is also a bit annoying to recover from).

Differential Revision: https://developer.blender.org/D13001
Make update: Ignore submodules
All checks were successful
buildbot/vdev-code-daily-coordinator Build done.
43f308f216
The previous change in the .gitmodules made it so the `make update`
rejects to do its thing because it now sees changes in the submodules
and rejected to update, thinking there are unstaged changes.

Ignore the submodule changes, bringing the old behavior closer to
what it was.
Fix Cycles debug build error after host falback changes
Some checks failed
buildbot/vdev-code-daily-coordinator Build done.
a1282ab015
Introduced in dcfb6df9ce6.

Co-authored-by: Lucas Tadeu Teixeira <lucas@lucastadeu.com>

Pull Request #104454
BLI: Math: Fix vector operator * with MutableMatView
All checks were successful
buildbot/vdev-code-daily-coordinator Build done.
0ab3ac7a41
This was caused by operator priority trying to use
`friend VecBase operator*(const VecBase &a, FactorT b)`.

Adding tests as these were not covered.
EEVEE-Next: Virtual Shadow Map initial implementation
Some checks failed
buildbot/vdev-code-daily-coordinator Build done.
a0f5240089
Implements virtual shadow mapping for EEVEE-Next primary shadow solution.
This technique aims to deliver really high precision shadowing for many
lights while keeping a relatively low cost.

The technique works by splitting each shadows in tiles that are only
allocated & updated on demand by visible surfaces and volumes.
Local lights use cubemap projection with mipmap level of detail to adapt
the resolution to the receiver distance.
Sun lights use clipmap distribution or cascade distribution (depending on
which is better) for selecting the level of detail with the distance to
the camera.

Current maximum shadow precision for local light is about 1 pixel per 0.01
degrees.
For sun light, the maximum resolution is based on the camera far clip
distance which sets the most coarse clipmap.

## Limitation:
Alpha Blended surfaces might not get correct shadowing in some corner
casses. This is to be fixed in another commit.
While resolution is greatly increase, it is still finite. It is virtually
equivalent to one 8K shadow per shadow cube face and per clipmap level.
There is no filtering present for now.

## Parameters:
Shadow Pool Size: In bytes, amount of GPU memory to dedicate to the
shadow pool (is allocated per viewport).
Shadow Scaling: Scale the shadow resolution. Base resolution should
target subpixel accuracy (within the limitation of the technique).

Related to #93220
Related to #104472
Fix Cycles link error with debug/asan builds after recent bugfix
All checks were successful
buildbot/vdev-code-daily-coordinator Build done.
9c03a1c92f
Pull Request #104487
EEVEE-Next: Shadow: Fix issue with last merge
All checks were successful
buildbot/vdev-code-daily-coordinator Build done.
9103978952
The merge with master updated the code to use the new matrix API. This
introduce some regressions.

For sunlights make sure there is enough tilemaps in orthographic mode
to cover the depth range and fix the level offset in perspective.
EEVEE-Next: Shadows: Add global switch
Some checks failed
buildbot/vdev-code-daily-coordinator Build done.
94d280fc3f
This allow to bypass all cost associated with shadow mapping.

This can be useful in certain situation, such as opening a scene on a
lower end system or just to gain performance in some situation (lookdev).
- Use bpy.utils.execfile instead of importing then deleting from
  sys.modules.
- Add a note for why keeping this cached in memory isn't necessary.

This has the advantage of not interfering with any scripts that import
`rna_manual_reference` as a module.
Cleanup: update username in code-comments: campbellbarton -> ideasman42
All checks were successful
buildbot/vdev-code-daily-coordinator Build done.
0381fe7bfe
Gitea migration changed my username, update code-comments.
Cleanup: Remove unused/redundant includes from BKE_curves.hh
All checks were successful
buildbot/vdev-code-daily-coordinator Build done.
3c8f7b1a64
Avoid including headers that are obviously redundant, and don't
include BLI_task.hh in the header file, since it isn't really related.
Cycles: update Intel Graphics Compiler to 1.0.13064.7 on Linux
All checks were successful
buildbot/vdev-code-daily-coordinator Build done.
f3d7de709f
Linux side of 8afcecdf1f.

Reviewed by: LazyDodo, sergey, campbellbarton
Ref !104458, 16984
Cleanup: solve compiler warnings.
All checks were successful
buildbot/vdev-code-daily-coordinator Build done.
7effc6ffc4
Classes were predefined as structs.
GPU: Fix assert when using light gizmo.
All checks were successful
buildbot/vdev-code-daily-coordinator Build done.
8b35db914e
Blender was reporting that the GPU_TEXTURE_USAGE_HOST_READ wasn't set.
This is used to indicate that the textures needs to be read back to
CPU. Textures that don't need to be read back can be optimized by the
GPU backend.

Found during investigation of #104282.
Build: enable Python optimizations (PGO & LTO) on Linux
Some checks failed
buildbot/vdev-code-daily-coordinator Build done.
f222fe6a3a
This is used for most Python release builds and has been reported to
give a modest 5-10% speedup (depending on the workload).

This could be enabled on macOS too but needs to be tested.
Build: disable LTO for Python builds
All checks were successful
buildbot/vdev-code-daily-coordinator Build done.
0e196bab76
LTO compiled libpython3.10.a failed to link with GCC 12.0,
disable since these libraries are intended for developers to link
against.
Fix freeing uninitialized pointer in GHOST/Wayland + X11 fallback
All checks were successful
buildbot/vdev-code-daily-coordinator Build done.
ca183993a5
Freeing the timer manager didn't account for Wayland being partially
initialized.
Refactor: remove yscale from bAnimContext
Some checks failed
buildbot/vdev-code-daily-coordinator Build done.
666c2ea012
`bAnimContext` had a float property called `yscale_fac` that was used to define the height of the keyframe channels.

However the property was never set, only read so there really is no need to have it in the struct.

Moreover it complicated getting the channel height because `bAnimContext` had to be passed in.

Speaking of getting the channel height. This was done with macros. I ripped them all out and replaced them with function calls.

Originally it was introduced in this patch: https://developer.blender.org/rB095c8dbe6919857ea322b213a1e240161cd7c843

Co-authored-by: Christoph Lendenfeld <chris.lenden@gmail.com>
Pull Request #104500
Sybren A. Stüvel requested changes 2023-02-10 15:49:40 +01:00
Sybren A. Stüvel left a comment
Member

Nice work, just some cosmetc things.

Nice work, just some cosmetc things.
@ -40,3 +40,3 @@
* and the strip itself.
*/
void BKE_nlastrip_free(ListBase *strips, struct NlaStrip *strip, bool do_id_user);
void BKE_nlastrip_free(struct NlaStrip *strip, bool do_id_user);

💜 for the removal of ListBase *strips. The documentation now seems outdated, as this function no longer removes itself from its parent strips. The doc could also get a reference to the BKE_nlastrip_remove() and BKE_nlastrip_remove_free() functions.

💜 for the removal of `ListBase *strips`. The documentation now seems outdated, as this function no longer removes itself from its parent strips. The doc could also get a reference to the `BKE_nlastrip_remove()` and `BKE_nlastrip_remove_free()` functions.
nrupsis marked this conversation as resolved
@ -100,1 +101,4 @@
struct NlaStrip *BKE_nlastrip_new(struct bAction *act);
/*
* Removes the given NLA strip from the list of strips provided

Be sure to end sentences with a period.

Be sure to end sentences with a period.
nrupsis marked this conversation as resolved
@ -146,3 +154,1 @@
* \param strip:
* \return true
* \return false
* NULL checks incoming strip and verifies no overlap / invalid

Well, I think it also adds the NLA strip to the given list of strips, right? Might be worth putting in the docs as well ;-)

Well, I think it also adds the NLA strip to the given list of strips, right? Might be worth putting in the docs as well ;-)
nrupsis marked this conversation as resolved
@ -217,3 +224,2 @@
/**
* Add the given NLA-Strip to the given NLA-Track, assuming that it
* isn't currently attached to another one.
* Add the given NLA-Strip to the given NLA-Track.

You may want to add a bit about what kind of extra checks this does (if any; otherwise add a warning that it can cause overlapping strips). And document what the return value actually means; with a boolean it's always a guess.

You may want to add a bit about what kind of extra checks this does (if any; otherwise add a warning that it can cause overlapping strips). And document what the return value actually means; with a boolean it's always a guess.
nrupsis marked this conversation as resolved
@ -66,0 +87,4 @@
BKE_nlatrack_remove_strip(&track, &strip2);
EXPECT_EQ(1, BLI_listbase_count(&track.strips));
}

Add a BLI_findindex() call to check that it didn't remove the wrong strip. With the test as it is now, given that you have two strips in the track, it wouldn't catch an inversion bug, where it deletes all strips except the mentioned one.

Add a `BLI_findindex()` call to check that it didn't remove the wrong strip. With the test as it is now, given that you have two strips in the track, it wouldn't catch an inversion bug, where it deletes all strips *except* the mentioned one.
nrupsis marked this conversation as resolved
Nate Rupsis force-pushed T82241-cleanup-NLAStrip_remove from 880519e881 to b8e2611cab 2023-02-10 19:45:23 +01:00 Compare
Brecht Van Lommel added this to the Animation & Rigging project 2023-02-13 13:58:58 +01:00
Sybren A. Stüvel approved these changes 2023-02-13 17:44:47 +01:00
Sybren A. Stüvel left a comment
Member

\o/

Just one tiny thing that you can look at while landing the PR.

\o/ Just one tiny thing that you can look at while landing the PR.
@ -136,2 +148,4 @@
* isn't currently a member of another list, NULL, or conflicting with existing
* strips position.
* isn't currently a member of another list, NULL, or conflicting with existing
* strips position.

I guess this addition sneaked in accidentally? Remove it before committing.

I guess this addition sneaked in accidentally? Remove it before committing.
nrupsis marked this conversation as resolved
Nate Rupsis force-pushed T82241-cleanup-NLAStrip_remove from e522aa525d to 0bb05784dc 2023-02-13 18:08:51 +01:00 Compare
Nate Rupsis merged commit 0e1a6f6033 into main 2023-02-13 18:10:28 +01:00
Nate Rupsis deleted branch T82241-cleanup-NLAStrip_remove 2023-02-13 18:10:28 +01:00
Sybren A. Stüvel removed this from the Animation & Rigging project 2023-02-14 17:15:45 +01:00
Sign in to join this conversation.
No reviewers
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset System
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Code Documentation
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Viewport & EEVEE
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Asset Browser Project
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Module
Viewport & EEVEE
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Severity
High
Severity
Low
Severity
Normal
Severity
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#104437
No description provided.