16
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-07-22 22:09:19 +02:00

Add EU7 PACK v11 UTEX, section unload, and LRU streaming caches

Bake deduplicated section texture lists (UTEX) and read them at runtime so
texture warm/prefetch no longer scans every instance. Evict PACK sections
outside a 16 km keep ring and cap mesh/nodedata/texture warm caches to stop
RAM and apply cost from growing without bound during long fast camera flight.

- Bake v11 (format=4): UMES + UTEX + CHNK; mesh/texture ordering by frequency
- Runtime: incremental UTEX warm, adaptive apply slices, preempt/catchup tuning
- Unload: track instances per section, Region erase, pack pool release
- LRU: mesh/nodedata (2000, ref-counted), warmed textures (2048)
- Bench/diagnostics: unload and cache eviction counters
- Fix pack instance erase in Region; resolve duplicate helper symbols
This commit is contained in:
maj00r
2026-06-14 21:22:50 +02:00
parent 56d72fb25e
commit 2ee5f93353
16 changed files with 1228 additions and 104 deletions

View File

@@ -9,12 +9,15 @@ http://mozilla.org/MPL/2.0/.
#pragma once
#include <limits>
#include <unordered_map>
#include <vector>
#include "utilities/parser.h"
#include "scene/eu7/eu7_types.h"
#include "scene/scene.h"
class TAnimModel;
class TModel3d;
namespace simulation {
@@ -22,6 +25,7 @@ namespace simulation {
struct eu7_pack_apply_session {
std::unordered_map<std::string, TModel3d *> *mesh_cache { nullptr };
std::unordered_map<std::string, scene::node_data> *nodedata_cache { nullptr };
std::size_t section_idx { std::numeric_limits<std::size_t>::max() };
};
struct deserializer_state {
@@ -108,8 +112,14 @@ public:
// Odlozone sklady AI — ladowane w tle po wejsciu w gre.
void
drain_deferred_eu7_trainsets( double MaxMs = 12.0 );
// PACK streaming: usun instancje sekcji z Region i zwolnij pool.
[[nodiscard]] std::size_t
unload_eu7_pack_section( int Row, int Column );
void
reset_eu7_pack_section_instances();
private:
std::unordered_map<std::size_t, std::vector<TAnimModel *>> m_pack_section_instances;
struct eu7_transform_state;
void
insert_eu7_models(