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
|
|
@ -207,7 +207,7 @@ public sealed class MeshExtractorSolidFaceExtractionTests
|
|||
var dats = new FakeMeshExtractorDats();
|
||||
RegisterTexturedQuad(
|
||||
dats,
|
||||
SurfaceType.Base1Image,
|
||||
SurfaceType.Base1Image | SurfaceType.Translucent,
|
||||
PixelFormat.PFID_DXT1,
|
||||
new byte[8],
|
||||
translucency: 0.25f);
|
||||
|
|
@ -219,7 +219,40 @@ public sealed class MeshExtractorSolidFaceExtractionTests
|
|||
KeyValuePair<(int Width, int Height, TextureFormat Format), List<TextureBatchData>> group =
|
||||
Assert.Single(mesh.TextureBatches);
|
||||
Assert.Equal(TextureFormat.RGBA8, group.Key.Format);
|
||||
Assert.Equal(4 * 4 * 4, Assert.Single(group.Value).TextureData.Length);
|
||||
TextureBatchData batch = Assert.Single(group.Value);
|
||||
Assert.Equal(4 * 4 * 4, batch.TextureData.Length);
|
||||
Assert.Equal(0.75f, batch.SurfaceOpacity);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(0f, 1f)]
|
||||
[InlineData(0.25f, 0.75f)]
|
||||
[InlineData(0.5f, 0.5f)]
|
||||
[InlineData(0.75f, 0.25f)]
|
||||
[InlineData(1f, 0f)]
|
||||
public void PrepareCellStructMeshData_CarriesAuthoredSurfaceOpacity(
|
||||
float translucency,
|
||||
float expectedOpacity)
|
||||
{
|
||||
var dats = new FakeMeshExtractorDats();
|
||||
RegisterCellTexturedSurface(
|
||||
dats,
|
||||
SurfaceType.Base1Image | SurfaceType.Translucent,
|
||||
translucency);
|
||||
var extractor = new MeshExtractor(dats, NullLogger.Instance, sideStagedSink: null);
|
||||
|
||||
ObjectMeshData mesh = Assert.IsType<ObjectMeshData>(
|
||||
extractor.PrepareCellStructMeshData(
|
||||
id: 1,
|
||||
BuildQuadCellStruct(RetailCullMode.Landblock),
|
||||
surfaceOverrides: [2],
|
||||
Matrix4x4.Identity,
|
||||
CancellationToken.None));
|
||||
|
||||
TextureBatchData batch = Assert.Single(Assert.Single(mesh.TextureBatches).Value);
|
||||
Assert.Equal(
|
||||
BitConverter.SingleToInt32Bits(expectedOpacity),
|
||||
BitConverter.SingleToInt32Bits(batch.SurfaceOpacity));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -232,12 +265,16 @@ public sealed class MeshExtractorSolidFaceExtractionTests
|
|||
/// not change what these tests actually pin (verified by hand against
|
||||
/// CellStructSideCandidates.TriangleFanIndices before this change).
|
||||
/// </summary>
|
||||
private static void RegisterCellTexturedSurface(FakeMeshExtractorDats dats)
|
||||
private static void RegisterCellTexturedSurface(
|
||||
FakeMeshExtractorDats dats,
|
||||
SurfaceType type = SurfaceType.Base1Image,
|
||||
float translucency = 0f)
|
||||
{
|
||||
dats.Register(TexturedSurfaceId, new Surface
|
||||
{
|
||||
Type = SurfaceType.Base1Image,
|
||||
Type = type,
|
||||
OrigTextureId = SurfaceTextureId,
|
||||
Translucency = translucency,
|
||||
});
|
||||
dats.Register(SurfaceTextureId, new SurfaceTexture
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue