Replace the building and EnvCell detail replay with retail's exact single-pass stage result, including authored surface opacity, squared detail alpha, final-alpha clipping, and the original subset pipeline/order. Arm the ordered walk command in place to close #471, delete the replay pipelines/shaders, and advance prepared content to recipe 9. Mutation witnesses (each restored before commit): - X=a*qA: RetailDetailTextureContractTests.BothShaderFamiliesUseTheSharedOnePassSourceAndDebugPrecedesDetailSample line 174, missing materialAlpha * detail.a * detail.a. - X*=base alpha: same test line 175, forbidden baseTexel.a found. - CLIP against base alpha: EnvCellAlphaDrawSourceTests.ClipShaders_UseGreaterEqualForThePerRangeReference line 260, final-X conditional missing. - second detail draw: EnvCellAlphaDrawSourceTests.DetailOn_EveryEnvCellFamilyDrawsOnceInPlaceWithAuthoredOpacity line 105, Assert.Single saw 2 MDI calls. - straight-alpha substitution: WalkStaticStreamPopulatorTests.ImmediateBuildingDetail_RetainsOriginalFramebufferFamily line 1244, Additive first failed (only wb-mesh-alpha-1x recorded; InvAlpha also failed). - omit ordered arm: OrderPreservingSubmitterTests.PrepareThenDraw_OrdinaryBuildingClipBuildingOrdinary_ArmsOnePassInPlace line 305, expected (77,3.5), got (0,0). - omit atmospheric combine: RetailDetailTextureContractTests.BothShaderFamiliesUseTheSharedOnePassSourceAndDebugPrecedesDetailSample line 173, atmospheric shared include missing. - drop serialized opacity: ObjectMeshDataSerializerTests.SurfaceOpacity_RoundTripsBitExactlyAndDeterministically line 288, first reported 0.5 bits 1056964608 vs 1065353216. - stale detail arm: ordered adjacency test line 307, expected following ordinary (0,0), got (77,3.5). - per-frame surface map: EnvCellAlphaDrawSourceTests.ProductionWholeLeaf_WarmedScanSubmitRhiAndFilteredReplayDoNotAllocate line 178, expected 0 B, got 147456 B. Verification before commit: shader compiler 23/23; focused App 213/213; Content 75/75; Core Wb 10/10; launcher migration 6/6; Release solution build 0 warnings / 0 errors; git diff --check clean.
59 lines
2.2 KiB
C#
59 lines
2.2 KiB
C#
using System.Runtime.CompilerServices;
|
|
using System.Runtime.InteropServices;
|
|
using AcDream.App.Rendering.Wb;
|
|
using Xunit;
|
|
|
|
namespace AcDream.App.Tests.Rendering.Wb;
|
|
|
|
/// <summary>
|
|
/// Campaign V slice V2 (2026-07-27): CPU-side proof that
|
|
/// <see cref="ModernBatchData"/> — EnvCellRenderer's per-batch GPU struct,
|
|
/// sharing mesh_modern.vert's BatchData shader-side layout with
|
|
/// WbDrawDispatcher — packs at the exact std430 offsets the shader expects
|
|
/// after TextureHandle (a raw 64-bit ARB_bindless_texture handle) became
|
|
/// TextureTableIndex (a slot into the binding=9 handle table). Mirrors
|
|
/// ClipFrameLayoutTests' role for ClipFrame and
|
|
/// WbDrawDispatcherIndirectBuilderTests.BatchDataPublic_LayoutMatchesPrivateBatchData
|
|
/// for WbDrawDispatcher's own BatchData — a silent layout drift here would
|
|
/// desync EnvCellRenderer's uploaded bytes from what mesh_modern.vert reads,
|
|
/// with no build error.
|
|
///
|
|
/// Layout under test (std430, 16 bytes total):
|
|
/// offset 0 : uint TextureTableIndex
|
|
/// offset 4 : float SurfaceOpacity
|
|
/// offset 8 : uint TextureIndex (layer within the texture array)
|
|
/// offset 12 : uint Flags
|
|
/// </summary>
|
|
public class ModernBatchDataLayoutTests
|
|
{
|
|
[Fact]
|
|
public void Size_Is16Bytes_MatchingGpuBatchDataStride()
|
|
{
|
|
Assert.Equal(16, Unsafe.SizeOf<ModernBatchData>());
|
|
}
|
|
|
|
[Fact]
|
|
public void FieldOffsets_MatchStd430Layout()
|
|
{
|
|
Assert.Equal(0, (int)Marshal.OffsetOf<ModernBatchData>(nameof(ModernBatchData.TextureTableIndex)));
|
|
Assert.Equal(4, (int)Marshal.OffsetOf<ModernBatchData>(nameof(ModernBatchData.SurfaceOpacity)));
|
|
Assert.Equal(8, (int)Marshal.OffsetOf<ModernBatchData>(nameof(ModernBatchData.TextureIndex)));
|
|
Assert.Equal(12, (int)Marshal.OffsetOf<ModernBatchData>(nameof(ModernBatchData.Flags)));
|
|
}
|
|
|
|
[Fact]
|
|
public void FieldValues_RoundTripThroughTheStruct()
|
|
{
|
|
var data = new ModernBatchData
|
|
{
|
|
TextureTableIndex = 7u,
|
|
SurfaceOpacity = 0.25f,
|
|
TextureIndex = 3u,
|
|
};
|
|
|
|
Assert.Equal(7u, data.TextureTableIndex);
|
|
Assert.Equal(0.25f, data.SurfaceOpacity);
|
|
Assert.Equal(3u, data.TextureIndex);
|
|
Assert.Equal(0u, data.Flags);
|
|
}
|
|
}
|