diff --git a/CHANGELOG.md b/CHANGELOG.md index 47855f4..a982e08 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - [#363] Reduce GC pressure caused by `ComputeContext.GetComponent` ### Changed +- [#364] Prevent creation of overlapping render groups in the same `IRenderFilter` ### Removed diff --git a/Editor/PreviewSystem/Rendering/TargetSet.cs b/Editor/PreviewSystem/Rendering/TargetSet.cs index 59d94dc..8cdef07 100644 --- a/Editor/PreviewSystem/Rendering/TargetSet.cs +++ b/Editor/PreviewSystem/Rendering/TargetSet.cs @@ -40,6 +40,17 @@ public TargetSet(ImmutableList filters) var groups = filter.GetTargetGroups(_targetSetContext); Profiler.EndSample(); if (groups.IsEmpty) continue; + + var duplicateRenderers = groups.SelectMany(g => g.Renderers) + .GroupBy(r => r) + .FirstOrDefault(agg => agg.Count() > 1); + if (duplicateRenderers != null) + { + Debug.LogError("[" + filter + "] Duplicate renderer " + duplicateRenderers.Key + + " in groups: " + string.Join(", ", groups)); + // Suppress this filter + continue; + } builder.Add(new Stage {