fix(rendering): normalize empty dispatcher evidence
This commit is contained in:
parent
e0f36caa70
commit
f9829d5f9e
2 changed files with 49 additions and 7 deletions
|
|
@ -2569,10 +2569,21 @@ public sealed unsafe partial class WbDrawDispatcher : IDisposable
|
||||||
Vector3 cameraWorldPosition,
|
Vector3 cameraWorldPosition,
|
||||||
List<AlphaFingerprint> alphaScratch)
|
List<AlphaFingerprint> alphaScratch)
|
||||||
{
|
{
|
||||||
int opaqueGroupCount =
|
// The no-VAO production early-out deliberately skips group
|
||||||
visibleInstanceCount == 0 ? 0 : opaque.Count;
|
// partitioning, so its reusable opaque/transparent lists may still
|
||||||
int transparentGroupCount =
|
// contain the preceding draw's entries. No instances were accepted;
|
||||||
visibleInstanceCount == 0 ? 0 : transparent.Count;
|
// those stale scratch entries are not part of this submission and
|
||||||
|
// must not leak into its diagnostic identity.
|
||||||
|
IReadOnlyList<InstanceGroup> acceptedOpaque =
|
||||||
|
visibleInstanceCount == 0
|
||||||
|
? Array.Empty<InstanceGroup>()
|
||||||
|
: opaque;
|
||||||
|
IReadOnlyList<InstanceGroup> acceptedTransparent =
|
||||||
|
visibleInstanceCount == 0
|
||||||
|
? Array.Empty<InstanceGroup>()
|
||||||
|
: transparent;
|
||||||
|
int opaqueGroupCount = acceptedOpaque.Count;
|
||||||
|
int transparentGroupCount = acceptedTransparent.Count;
|
||||||
StableRenderHash128 hash = StableRenderHash128.Create();
|
StableRenderHash128 hash = StableRenderHash128.Create();
|
||||||
hash.Add(visibleInstanceCount);
|
hash.Add(visibleInstanceCount);
|
||||||
hash.Add(immediateInstanceCount);
|
hash.Add(immediateInstanceCount);
|
||||||
|
|
@ -2580,14 +2591,14 @@ public sealed unsafe partial class WbDrawDispatcher : IDisposable
|
||||||
hash.Add(transparentGroupCount);
|
hash.Add(transparentGroupCount);
|
||||||
hash.Add(deferTransparent);
|
hash.Add(deferTransparent);
|
||||||
RenderSceneHash128 opaqueDigest =
|
RenderSceneHash128 opaqueDigest =
|
||||||
BuildOpaqueSubmissionDigest(opaque);
|
BuildOpaqueSubmissionDigest(acceptedOpaque);
|
||||||
RenderSceneHash128 transparentDigest =
|
RenderSceneHash128 transparentDigest =
|
||||||
BuildTransparentSubmissionDigest(
|
BuildTransparentSubmissionDigest(
|
||||||
transparent,
|
acceptedTransparent,
|
||||||
cameraWorldPosition,
|
cameraWorldPosition,
|
||||||
alphaScratch);
|
alphaScratch);
|
||||||
RenderSceneHash128 transparentSetDigest =
|
RenderSceneHash128 transparentSetDigest =
|
||||||
BuildOpaqueSubmissionDigest(transparent);
|
BuildOpaqueSubmissionDigest(acceptedTransparent);
|
||||||
hash.Add(opaqueDigest.Low);
|
hash.Add(opaqueDigest.Low);
|
||||||
hash.Add(opaqueDigest.High);
|
hash.Add(opaqueDigest.High);
|
||||||
hash.Add(transparentDigest.Low);
|
hash.Add(transparentDigest.Low);
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
|
using AcDream.App.Rendering.Scene;
|
||||||
using AcDream.App.Rendering.Wb;
|
using AcDream.App.Rendering.Wb;
|
||||||
using AcDream.Core.Meshing;
|
using AcDream.Core.Meshing;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
@ -138,6 +139,36 @@ public class InstanceGroupClearTests
|
||||||
reversedSubmission.TransparentSetDigest);
|
reversedSubmission.TransparentSetDigest);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void DispatcherFingerprint_ZeroVisibleInstancesIgnoresStaleGroupStorage()
|
||||||
|
{
|
||||||
|
WbDrawDispatcher.InstanceGroup stale = MakeCompleteGroup(
|
||||||
|
textureHandle: 0xAA,
|
||||||
|
submissionOrder: 0);
|
||||||
|
var scratch = new List<WbDrawDispatcher.AlphaFingerprint>();
|
||||||
|
|
||||||
|
CurrentRenderDispatcherSubmission expected =
|
||||||
|
WbDrawDispatcher.CreateDispatcherSubmission(
|
||||||
|
visibleInstanceCount: 0,
|
||||||
|
immediateInstanceCount: 0,
|
||||||
|
deferTransparent: false,
|
||||||
|
opaque: [],
|
||||||
|
transparent: [],
|
||||||
|
cameraWorldPosition: Vector3.Zero,
|
||||||
|
alphaScratch: scratch);
|
||||||
|
CurrentRenderDispatcherSubmission actual =
|
||||||
|
WbDrawDispatcher.CreateDispatcherSubmission(
|
||||||
|
visibleInstanceCount: 0,
|
||||||
|
immediateInstanceCount: 0,
|
||||||
|
deferTransparent: false,
|
||||||
|
opaque: [stale],
|
||||||
|
transparent: [stale],
|
||||||
|
cameraWorldPosition: Vector3.Zero,
|
||||||
|
alphaScratch: scratch);
|
||||||
|
|
||||||
|
Assert.Equal(expected, actual);
|
||||||
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public void CachedGroupHandle_RequiresLiveMatchingRegistration()
|
public void CachedGroupHandle_RequiresLiveMatchingRegistration()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue