perf(core): migrate hot-path incandescence uniforms, rotated mesh caching, and simulation vector churn to core source architectures
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 20/100
- Tipo di issue
- Refactoring
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- csharp
- Ambito
- performance
Direzione di ricerca
Read the named renderer files, ColorUtil.cs, ShaderProgram, RotatedMeshCache.cs, the six listed block entity types, WeatherSimulationParticles.cs, and AuroraRenderer to map each phase to existing code. The issue gives no tests or entry point to run, so first identify the relevant allocation paths and available verification. Done means all three phases are migrated with the stated visual parity, ABI compatibility, cache invalidation, and allocation guarantees.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Summary
Recent performance PRs (#510, #511, and #536) successfully mitigated frame-rate drops and memory spikes by patching high-frequency hot paths directly at the call sites. However, addressing these bottlenecks strictly within individual callers leaves the underlying allocating source methods active and duplicates mathematical logic across the codebase.
This issue establishes a 3-phase refactoring to migrate these optimizations to the core source architectures:
- Phase 1: Source-Level Zero-Allocation Color & Uniform Pipeline (addressing the source of PR #510 across all 10 item/block renderers).
- Phase 2: Standardized Rotated Mesh Cache Architecture for BlockEntities (addressing the source of PR #511 across all 6 rotatable block entities).
- Phase 3: Thread-Confined Scratch Buffers and Vector In-Place Mutation (addressing the source of PR #536 across weather and particle simulations).
Technical Scope and Root Causes
Phase 1: Zero-Alloc Incandescence and Color Dispatch in ColorUtil & ShaderProgram
In PR #510, EntityShapeRenderer.RenderItem was patched by inlining temperature clamp math and manual ARGB bit shifts to bypass ColorUtil.GetIncandescenceColorAsColor4f (float[4]) and ColorUtil.ToRGBAVec4f (Vec4f).
However, the source methods in ColorUtil.cs were left allocating, leaving 9 other renderers allocating every single frame:
EntityItemRenderer.csGroundStorageRenderer.csIngotMoldRenderer.csToolMoldRenderer.csAnvilPartRenderer.csAnvilWorkItemRenderer.csForgeContentsRenderer.csFirepitContentsRenderer.csCrucibleInFirepitRenderer.cs
Source Fix:
- Add non-allocating scalar overloads in
ColorUtil:
public static void GetIncandescenceColor(int temp, out float r, out float g, out float b)
public static void ArgbToRgbaFloats(int argb, out float r, out float g, out float b, out float a) - Retain existing
GetIncandescenceColorAsColor4f(int)andToRGBAVec4f(int)intact for 100% binary mod compatibility. - Centralize all 10 renderers to use these zero-alloc methods.
Phase 2: Core RotatedMeshCache for BlockEntities
In PR #511, BEGenericTypedContainer cached rotatedOwnMesh. Other block entities (BESignPost, BELantern, BEAnvil, BEBucket, BEPlantContainer, BEWateringCan) still invoke mesh.Clone().Rotate(...) upon chunk retesselation.
Source Fix:
- Provide a lightweight
RotatedMeshCachestruct inVintagestoryApi/Common/Model/RotatedMeshCache.csthat tracks cachedMeshDataand rotation angles(rotX, rotY, rotZ). - Wire cache invalidation into
BlockEntity.FromTreeAttributes,OnTransformed, and orientation setters. - Migrate the 6 block entity types to consume the shared cache.
Phase 3: In-Place Particle Mutation and Conconfined Simulation Vectors
In PR #536, CloudRendererMap added private reusable vectors. However, WeatherSimulationParticles.cs still allocates new Vec3f(-1f, 3f, -1f) and new Vec3f(2f, 0f, 2f) on every splash tick, and AuroraRenderer allocates vectors inside ribbon generation.
Source Fix:
- Switch
splashParticlesto in-place.Set(...)calls matchingrainParticle. - Confine simulation vectors to thread-local / scratch contexts without breaking the public
classcontract ofVec3d/Vec3f.
Invariant Guarantees & Verification
- Mathematical & Visual Parity: 100% bit-exact temperature glow and color channels (0.0 divergence).
- Binary ABI Compatibility: No public methods or types deleted or altered.
- Multiplayer State Parity: Complete mesh cache invalidation on network sync.
- Zero Heap Allocations: 0 B per-frame allocations across all 10 renderers and particle ticks.
- Lingua principale
- C#
- Stelle
- 22
- Fork
- 4
- Merge medio
- 30m
- PR unite (30g)
- 188
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di StratumServer/Optimum
-
perf(rendering): batched Structure-of-Arrays chunk frustum culling with pool bounds rejectionApertaenhancement
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
StratumServer/Optimum#537 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di StratumServer/Optimum
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 64/100
criticalmanufacturing/cli#909 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
RadicalCSG/com.chisel#312 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
eyalgolan/statecraft-israel#3093 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 63/100
DeveloperAcademy-POSTECH/2026-C6-M10-MUSA#677 ·
I maintainer di solito rispondono entro 1 giorno
-
REQ-13 : une demande En cours perd son responsable par un simple enregistrement, et reste En coursApertaa-corriger bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
christian-raj/S-Aloha#301 ·