test(A.5 T21): lock in depth-write attribution per translucency kind
Per Phase A.5 spec §4.9.3 audit: opaque + ClipMap pass uses DepthMask(true); AlphaBlend / Additive / InvAlpha pass uses DepthMask(false), restored after. Audit confirmed correct in WbDrawDispatcher.Draw. IsOpaquePublic shim already present. Add WbDispatcherDepthMaskTests: 5-case Theory that pins the partition so future regressions surface immediately. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
26b2871b10
commit
1488ec62b7
1 changed files with 39 additions and 0 deletions
|
|
@ -0,0 +1,39 @@
|
||||||
|
using AcDream.App.Rendering.Wb;
|
||||||
|
using AcDream.Core.Meshing;
|
||||||
|
using Xunit;
|
||||||
|
|
||||||
|
namespace AcDream.Core.Tests.Rendering.Wb;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A.5 T21: lock in the depth-write attribution per translucency kind.
|
||||||
|
/// <para>
|
||||||
|
/// <c>WbDrawDispatcher.Draw</c> uses a two-pass structure:
|
||||||
|
/// <list type="bullet">
|
||||||
|
/// <item>Opaque pass — <c>DepthMask(true)</c>: writes depth so that
|
||||||
|
/// later transparent geometry sorts correctly against solid surfaces.</item>
|
||||||
|
/// <item>Transparent pass — <c>DepthMask(false)</c>: reads depth but
|
||||||
|
/// does NOT write it, so alpha-blended surfaces don't occlude each
|
||||||
|
/// other by Z-fighting.</item>
|
||||||
|
/// </list>
|
||||||
|
/// The partition that decides which pass a batch enters is
|
||||||
|
/// <see cref="WbDrawDispatcher.IsOpaquePublic"/>:
|
||||||
|
/// <c>Opaque</c> and <c>ClipMap</c> go to the opaque pass (depth write);
|
||||||
|
/// <c>AlphaBlend</c>, <c>Additive</c>, <c>InvAlpha</c> go to the
|
||||||
|
/// transparent pass (no depth write).
|
||||||
|
/// </para>
|
||||||
|
/// </summary>
|
||||||
|
public sealed class WbDispatcherDepthMaskTests
|
||||||
|
{
|
||||||
|
[Theory]
|
||||||
|
[InlineData(TranslucencyKind.Opaque, true)] // opaque pass — depth write
|
||||||
|
[InlineData(TranslucencyKind.ClipMap, true)] // foliage — depth write (binary alpha / A2C)
|
||||||
|
[InlineData(TranslucencyKind.AlphaBlend, false)] // transparent — no depth write
|
||||||
|
[InlineData(TranslucencyKind.Additive, false)]
|
||||||
|
[InlineData(TranslucencyKind.InvAlpha, false)]
|
||||||
|
public void IsOpaquePartition_ImpliesDepthWriteAttribution(
|
||||||
|
TranslucencyKind kind, bool expectsDepthWrite)
|
||||||
|
{
|
||||||
|
bool isOpaque = WbDrawDispatcher.IsOpaquePublic(kind);
|
||||||
|
Assert.Equal(expectsDepthWrite, isOpaque);
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue