Skip to content

Commit

Permalink
fix: more problems with TargetSet invalidation (#346)
Browse files Browse the repository at this point in the history
  • Loading branch information
bdunderscore authored Aug 22, 2024
1 parent 39a7dee commit 898b5b4
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added

### Fixed
- [#343] TargetSet is not invalidated when GetTargetGroups context is invalidated

- [#343] [#346] TargetSet is not invalidated when GetTargetGroups context is invalidated

### Changed

Expand Down
9 changes: 8 additions & 1 deletion Editor/PreviewSystem/ComputeContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System;
using System.Threading.Tasks;
using JetBrains.Annotations;
using UnityEngine;

#endregion

Expand Down Expand Up @@ -39,7 +40,13 @@ static ComputeContext()

internal ComputeContext(string description)
{
Invalidate = () => _invalidater.TrySetResult(null);
Invalidate = () =>
{
#if NDMF_TRACE
Debug.Log("Invalidating " + Description);
#endif
_invalidater.TrySetResult(null);
};
OnInvalidate = _invalidater.Task;
Description = description;
}
Expand Down
7 changes: 2 additions & 5 deletions Editor/PreviewSystem/Rendering/TargetSet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,9 @@ public TargetSet(ImmutableList<IRenderFilter> filters)
foreach (var filter in _filters)
{
if (!filter.IsEnabled(_targetSetContext)) continue;

var ctx = new ComputeContext("StageDescriptor for " + filter);
ctx.Invalidates(_targetSetContext);


Profiler.BeginSample("TargetSet.GetTargetGroups[" + filter + "]");
var groups = filter.GetTargetGroups(ctx);
var groups = filter.GetTargetGroups(_targetSetContext);
if (groups.IsEmpty) continue;

builder.Add(new Stage
Expand Down

0 comments on commit 898b5b4

Please sign in to comment.