feat(rendering): port retail one-pass detail material
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.
This commit is contained in:
parent
13dbb79eeb
commit
75664805f8
61 changed files with 1003 additions and 1016 deletions
|
|
@ -20,9 +20,9 @@ public sealed class WbDrawDispatcherIndirectBuilderTests
|
|||
// Arrange — three groups: 2 opaque (12+1 instances) + 1 transparent (12 instances)
|
||||
var groups = new List<WbDrawDispatcher.IndirectGroupInput>
|
||||
{
|
||||
new(IndexCount: 100, FirstIndex: 0, BaseVertex: 0, InstanceCount: 12, FirstInstance: 0, TextureIndex: 0xAA, TextureLayer: 0, Translucency: TranslucencyKind.Opaque),
|
||||
new(IndexCount: 200, FirstIndex: 100, BaseVertex: 0, InstanceCount: 12, FirstInstance: 12, TextureIndex: 0xBB, TextureLayer: 0, Translucency: TranslucencyKind.AlphaBlend),
|
||||
new(IndexCount: 50, FirstIndex: 300, BaseVertex: 100, InstanceCount: 1, FirstInstance: 24, TextureIndex: 0xCC, TextureLayer: 0, Translucency: TranslucencyKind.Opaque),
|
||||
new(IndexCount: 100, FirstIndex: 0, BaseVertex: 0, InstanceCount: 12, FirstInstance: 0, TextureIndex: 0xAA, TextureLayer: 0, Translucency: TranslucencyKind.Opaque, SurfaceOpacity: 0.75f),
|
||||
new(IndexCount: 200, FirstIndex: 100, BaseVertex: 0, InstanceCount: 12, FirstInstance: 12, TextureIndex: 0xBB, TextureLayer: 0, Translucency: TranslucencyKind.AlphaBlend, SurfaceOpacity: 0.25f),
|
||||
new(IndexCount: 50, FirstIndex: 300, BaseVertex: 100, InstanceCount: 1, FirstInstance: 24, TextureIndex: 0xCC, TextureLayer: 0, Translucency: TranslucencyKind.Opaque, SurfaceOpacity: 0.5f),
|
||||
};
|
||||
|
||||
var indirect = new DrawElementsIndirectCommand[16];
|
||||
|
|
@ -60,6 +60,9 @@ public sealed class WbDrawDispatcherIndirectBuilderTests
|
|||
Assert.Equal(0xAAu, batch[0].TextureIndex);
|
||||
Assert.Equal(0xCCu, batch[1].TextureIndex);
|
||||
Assert.Equal(0xBBu, batch[2].TextureIndex);
|
||||
Assert.Equal(0.75f, batch[0].SurfaceOpacity);
|
||||
Assert.Equal(0.5f, batch[1].SurfaceOpacity);
|
||||
Assert.Equal(0.25f, batch[2].SurfaceOpacity);
|
||||
Assert.Equal(CullMode.CounterClockwise, cull[0]);
|
||||
Assert.Equal(CullMode.CounterClockwise, cull[1]);
|
||||
Assert.Equal(CullMode.CounterClockwise, cull[2]);
|
||||
|
|
@ -184,8 +187,8 @@ public sealed class WbDrawDispatcherIndirectBuilderTests
|
|||
];
|
||||
|
||||
// Command 1 is mixed: instance 2 is ordinary and instance 3 is a
|
||||
// building. It must be submitted once, then mesh_detail filters the
|
||||
// ordinary instance. Commands 0 and 2 must never reach the detail pipe.
|
||||
// building. It must form a solo one-pass detail run. Commands 0 and 2
|
||||
// remain neutral ordinary runs.
|
||||
uint[] mixedCategories = [0u, 0u, 0u, 1u, 0u];
|
||||
Assert.True(WbDrawDispatcher.TryGetNextDetailCommandRun(
|
||||
commands,
|
||||
|
|
@ -238,17 +241,13 @@ public sealed class WbDrawDispatcherIndirectBuilderTests
|
|||
// without copying. The cast is only safe if the structs have identical
|
||||
// layout (size, field offsets).
|
||||
//
|
||||
// Campaign V slice V2 (2026-07-27): TextureHandle (ulong, an
|
||||
// ARB_bindless_texture handle) became TextureIndex (uint) plus an
|
||||
// explicit Reserved pad word — a slot into the GL-only binding=9 handle
|
||||
// table instead of the raw handle (that binding, GpuBindingModel's
|
||||
// former StorageTextureTable, was deleted at Campaign V slice V11).
|
||||
// The struct stays 16 bytes and TextureLayer/Flags keep their offsets
|
||||
// (8/12), matching GpuBindingModel.GpuBatchDataStrideBytes and every
|
||||
// existing CPU writer, so both structs only need 4-byte packing now.
|
||||
// S5-c4 consumes the former pad word as authored SurfaceOpacity. The
|
||||
// struct stays 16 bytes and TextureLayer/Flags keep their offsets
|
||||
// (8/12), matching GpuBindingModel.GpuBatchDataStrideBytes and both
|
||||
// world shader families.
|
||||
Assert.Equal(16, System.Runtime.CompilerServices.Unsafe.SizeOf<WbDrawDispatcher.BatchDataPublic>());
|
||||
Assert.Equal(0, (int)System.Runtime.InteropServices.Marshal.OffsetOf<WbDrawDispatcher.BatchDataPublic>(nameof(WbDrawDispatcher.BatchDataPublic.TextureIndex)));
|
||||
Assert.Equal(4, (int)System.Runtime.InteropServices.Marshal.OffsetOf<WbDrawDispatcher.BatchDataPublic>(nameof(WbDrawDispatcher.BatchDataPublic.Reserved)));
|
||||
Assert.Equal(4, (int)System.Runtime.InteropServices.Marshal.OffsetOf<WbDrawDispatcher.BatchDataPublic>(nameof(WbDrawDispatcher.BatchDataPublic.SurfaceOpacity)));
|
||||
Assert.Equal(8, (int)System.Runtime.InteropServices.Marshal.OffsetOf<WbDrawDispatcher.BatchDataPublic>(nameof(WbDrawDispatcher.BatchDataPublic.TextureLayer)));
|
||||
Assert.Equal(12, (int)System.Runtime.InteropServices.Marshal.OffsetOf<WbDrawDispatcher.BatchDataPublic>(nameof(WbDrawDispatcher.BatchDataPublic.Flags)));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue