Prompt file imported from akspa0/parp-tools (
.codex/prompts/bls-shader-parity-performance-plan.md). Copyright stays with the author.
Implement the BLS/effect parity performance slice in gillijimproject_refactor/src/MdxViewer with shader reuse, material-family stability, and reduced state churn as the runtime goal.
Read First
gillijimproject_refactor/memory-bank/activeContext.mdgillijimproject_refactor/memory-bank/progress.mdgillijimproject_refactor/src/MdxViewer/memory-bank/activeContext.mdgillijimproject_refactor/documentation/wow-400-engine-performance-recovery-guide.mdgillijimproject_refactor/reference_data/wowdev.wiki/BLS.mdgillijimproject_refactor/reference_data/wowdev.wiki/WFX.mdgillijimproject_refactor/src/MdxViewer/Rendering/ModelRenderer.csgillijimproject_refactor/src/MdxViewer/Rendering/WmoRenderer.csgillijimproject_refactor/src/MdxViewer/Rendering/ShaderProgram.cs
Goal
Move the viewer closer to the real client's effect-family model so material choice is less flattened, shader programs are reused more deliberately, and draw-state churn becomes easier to control.
Why This Slice Exists
- Ghidra evidence from
4.0.0.11927shows explicitShaderEffectManager,CGxShader,CShaderEffect,CSceneMaterial, shader directories, and.blsshader assets. - The active viewer still makes many shader/material decisions locally inside specific renderers.
- This is a performance slice as much as a visual one: stable effect-family identity makes batching and program reuse easier.
Scope
- In scope:
- material/effect-family descriptors used by the active viewer
- shader-program reuse and shared state setup
- stable separation of opaque, cutout, alpha, additive, modulated, env-map, and related families
- logging/instrumentation that proves which effect family a batch uses
- Out of scope unless direct evidence forces it:
- full
.blsruntime execution inside the viewer - terrain decode changes
- speculative deferred-rendering rewrites
- full
Non-Negotiable Constraints
- Do not claim that “using BLS” means literally replacing the viewer with Blizzard shader binaries.
- Do not flatten distinct material families back into one generic transparent path.
- Do not introduce a broad shader abstraction that changes everything without proving one concrete gain first.
- Keep the change aligned with the current renderer architecture and recent parity work.
- Update memory-bank notes when shader/effect behavior or remaining gaps materially change.
Required Implementation Order
- Inventory the current effect-family decisions in the active renderers.
- Compare them against the real client's visible effect families from
WFX/BLSreferences. - Identify one confirmed flattening seam with runtime significance.
- Land the smallest shared effect-family or program-reuse slice that improves that seam.
- Keep logging specific enough to show which batches use which effect family.
- Update memory-bank notes with the exact family behavior now supported versus still approximated.
Investigation Checklist
- Verify where
ModelRendererandWmoRendererduplicate or diverge in state setup. - Verify whether current
ShaderProgramusage already supports a shared effect layer or needs one tiny adapter first. - Cross-check
WFXpass types and known blend/effect families before renaming or regrouping local material families. - Prefer one visible, engine-backed family improvement over a giant shader-system rewrite.
Validation Rules
- Build the changed viewer solution.
- If runtime validation on real data is not run, say so explicitly.
- If automated tests are not added or run, say so explicitly.
- Do not claim BLS parity unless the delivered slice clearly states what was mirrored versus what remains local approximation.
Deliverables
Return all items:
- exact effect/material behavior implemented
- files changed and why
- what families now map more faithfully versus what is still approximate
- build status
- automated-test status
- runtime-validation status
- memory-bank updates made
First Output
Start with:
- the current material/effect flattening seam with the best performance value
- what
CGx/BLS/WFXevidence supports the chosen slice - what files will be changed first
- what you are explicitly not trying to do in this pass
