acdream/tests/AcDream.App.Tests/Rendering/Wb
Erik ae6513126e fix(render): detail overlay is fogged after the combine like retail; VM1 review fixes
Opus dual-lens review of 05970306 + 388457a7 (APPROVE WITH FIXES). Four
items, all landed:

1. FOG (behavioural). Retail's D3D fixed-function fog stage runs AFTER the
   texture-stage pipeline, so the detail contribution must be fogged, not
   just the base. mesh_modern.frag already fogs the base colour
   (applyFog(rgb, vWorldPos)) before mesh_detail's replay draws over it;
   mesh_detail.frag previously emitted raw detail.rgb, understating fog by
   f*a*(fog-detail). Fix: mesh_detail.vert now outputs vWorldPos (mirroring
   mesh_modern.vert); mesh_detail.frag declares the identical SceneLighting
   UBO and applyFog function (copied verbatim, same binding/std140/math) and
   fogs detail.rgb before emitting it. This collapses algebraically to
   retail's fog-after-combine order:
     (1-a)*mix(base,fog,f) + a*mix(detail,fog,f) = mix(lerp(base,detail,a),fog,f)
   RetailDetailTextureContract gains ExpectedFogged(base,detail,opacity,fog,
   fogFactor); RetailDetailTextureContractTests pins the identity across 200
   random samples within 1e-6.

2. EnvCellRenderer.Rhi.cs's DrawEnvCell-category comment still said "apply
   the 10-50 m positive-view-depth fade" — a stale claim from before VM1
   removed the fade. Replaced with the mip-chain attenuation statement that
   mesh_detail.vert's header comment already carries.

3. Added the test the VM1 contract required but never had: TerrainAtlas
   .TryCreateDetailTexture uploads a full mip chain (MipLevelCount ==
   RhiWorldTextureArray.MipLevelsFor(w,h), GenerateMipChain called) and
   registers with the repeat/linear world sampler, not single-level or
   clamped. Drives the private method directly (reflection) against a
   synthetic PFID_A8R8G8B8 RenderSurface through a minimal in-memory
   IDatReaderWriter fake, so the lane stays hermetic (no installed DAT).

4. #226 pseudocode note: noted that retail's stage-1 OUTPUT alpha
   (MODULATE(TEXTURE, CURRENT), 0x0059c549) — the framebuffer blend weight a
   delayed-alpha subset composites with — is not modelled; acdream instead
   draws a second pass weighted by detail.a*diffuseAlpha. Identical for
   opaque subsets, a bounded difference on translucent building/EnvCell
   subsets already covered by the existing AP-34 shared-alpha-queue
   divergence row. Also qualified the tmpmaterial.Diffuse.a = 1f (0x0059cb99)
   citation to name its exact branch (burnedInStaticLights < 0 &&
   *(render_device+0x7e4) == 0); the other branch leaves diffuse FromVertex,
   but the opaque->1 / fading->opacity mapping still holds either way.

Nit also folded in: EnvCellRendererTests' new SubmitRhi instance-alpha test
is now a [Theory] over WbRenderPass.Opaque and .Transparent, pinning the
bind-before-first-draw invariant on both passes.

Regenerated mesh_detail's committed SPIR-V and the shader manifest
(tools/compile-shaders.ps1); no other shader pair changed.

Verified: dotnet build AcDream.slnx -c Release (0 warnings, 0 errors);
dotnet test on AcDream.App.Tests (Release, hermetic lanes) green, including
the shader manifest tests explicitly; AcDream.Core.Tests unaffected/green.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-22 22:39:58 +02:00
..
BuildingLoaderTests.cs perf(streaming): cursor publication across frame budgets 2026-07-24 19:10:18 +02:00
BuildingRegistryTests.cs feat(render): Phase A8 RR3 — Building + BuildingRegistry + BuildingLoader 2026-05-27 11:08:43 +02:00
BuildingTests.cs feat(render): Phase A8 RR3 — Building + BuildingRegistry + BuildingLoader 2026-05-27 11:08:43 +02:00
CompositeWarmupEntitySourceTests.cs perf(streaming): scope reveal warmup spatially 2026-07-25 04:39:48 +02:00
ContiguousRangeAllocatorTests.cs fix(rendering): bound portal resource lifetime 2026-07-18 21:35:16 +02:00
DirectionalShadowPreparedDrawTests.cs feat(render): implement Campaign AR and terrain fidelity 2026-08-22 13:13:29 +02:00
DirectionalShadowTerrainPreparedDrawTests.cs feat(render): implement Campaign AR and terrain fidelity 2026-08-22 13:13:29 +02:00
EntitySpawnAdapterLifetimeTests.cs refactor(app): key live projections by runtime identity 2026-07-25 21:50:58 +02:00
EnvCellLandblockBuildTests.cs fix(streaming): commit EnvCell landblocks atomically (#214) 2026-07-13 18:45:24 +02:00
EnvCellRendererTests.cs fix(render): detail overlay is fogged after the combine like retail; VM1 review fixes 2026-08-22 22:39:58 +02:00
EnvCellSceneryInstanceTests.cs fix(streaming): commit EnvCell landblocks atomically (#214) 2026-07-13 18:45:24 +02:00
GpuRetiredRangeAllocatorTests.cs fix(rendering): bound portal resource lifetime 2026-07-18 21:35:16 +02:00
InstanceGroupClearTests.cs feat(render): implement Campaign AR and terrain fidelity 2026-08-22 13:13:29 +02:00
LandblockSpawnAdapterReadinessTests.cs fix(rendering): bound portal resource lifetime 2026-07-18 21:35:16 +02:00
MeshPipelineDeviceSeamTests.cs feat(render): Vulkan campaign V11 step 3 — drop the GL packages and shaders 2026-07-29 02:58:15 +02:00
MeshUploadCachesTests.cs fix(streaming): prepare quiesced destination entities 2026-07-24 20:21:57 +02:00
ModernBatchDataLayoutTests.cs feat(render): Campaign V slice V2a - mesh path texture-index migration 2026-07-27 15:51:26 +02:00
ObjectMeshUploadBudgetTests.cs fix(rendering): bound portal resource lifetime 2026-07-18 21:35:16 +02:00
ObjectMeshWorkerLifecycleTests.cs fix #225: stabilize render pacing and frame CPU 2026-07-19 06:29:30 +02:00
PackedDispatcherOracleTests.cs feat(render): implement Campaign AR and terrain fidelity 2026-08-22 13:13:29 +02:00
PackedProjectionClassificationCacheTests.cs test(app): put every strict-zero site on the probe (#250) 2026-07-29 03:49:13 +02:00
RetryableResourceReleaseLedgerTests.cs fix(rendering): bound portal resource lifetime 2026-07-18 21:35:16 +02:00
RhiWorldTextureArrayTests.cs fix(render): Campaign V slice V7 commit 1 - world anisotropy, and the sky's second clock 2026-07-28 19:14:08 +02:00
TextureAtlasCapacityTests.cs feat(render): Vulkan campaign V11 step 3 — drop the GL packages and shaders 2026-07-29 02:58:15 +02:00
TextureAtlasSlotAllocatorTests.cs fix(rendering): bound portal resource lifetime 2026-07-18 21:35:16 +02:00
WbDrawDispatcherClipSlotTests.cs feat(render): indoor render WORKS — terminating portal flood + every-cell seal + look-in FPS 2026-06-07 10:14:43 +02:00
WbDrawDispatcherCompositeWarmupTests.cs fix(rendering): decouple portal warmup discovery 2026-07-25 04:27:17 +02:00
WbDrawDispatcherIndoorFlagTests.cs fix(lighting): #142 — per-instance sun gate for windowed-building interiors 2026-06-20 12:55:56 +02:00
WbDrawDispatcherTorchGateTests.cs fix(lighting): A7 Fix D round 2 — outdoor objects get NO torches (retail useSunlight gate) (#140) 2026-06-19 23:56:49 +02:00
WbFrustumTests.cs feat(render): Phase A8 Wave 1 — WB scaffolding extraction + stencil low-level method 2026-05-27 14:46:07 +02:00
WbTextureResolutionPolicyTests.cs perf(content): remove exception-driven setup probes 2026-07-24 15:12:21 +02:00
WorldTransformFrameArenaTests.cs feat(render): implement Campaign AR and terrain fidelity 2026-08-22 13:13:29 +02:00