mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-10-26 22:10:18 +00:00
Pregen hydrology reach
- Pregen tile speculation limited to the generation reach around the area instead of a 512-block halo
This commit is contained in:
1 parent
dcfadc8d1d
commit
393ea10cdf
2 files changed
+24
-1
No files matched your search
@@ -43,7 +43,7 @@ public final class HydrologyTileCache implements AutoCloseable {
|
||||
private static final byte AROUND_EMPTY = 1;
|
||||
private static final byte AROUND_PUBLISHED = 2;
|
||||
private static final int MAXIMUM_PREGENERATION_TILES = 4096;
|
||||
private static final int PREGENERATION_HALO_BLOCKS = 512;
|
||||
private static final int PREGENERATION_HALO_BLOCKS = 256;
|
||||
private static final HydrologyColumnSample[] NO_COLUMNS = new HydrologyColumnSample[CHUNK_COLUMN_COUNT];
|
||||
private static final Cache<SharedTileKey, HydrologyTile> SHARED_TILES = Caffeine.newBuilder()
|
||||
.maximumWeight(HydrologyCacheBudget.sharedStudioBytes())
|
||||
|
||||
@@ -696,6 +696,29 @@ public class HydrologyTileCacheTest {
|
||||
cache.close();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void pregenSpeculationStaysWithinTheGenerationReachOfTheArea() {
|
||||
HydrologyPlanner planner = mock(HydrologyPlanner.class);
|
||||
HydrologyTile tile = mock(HydrologyTile.class);
|
||||
HydrologyPlannerSettings settings = stalePrefetchSettings();
|
||||
when(planner.settings()).thenReturn(settings);
|
||||
ArrayList<HydrologyTileKey> planned = new ArrayList<>();
|
||||
doAnswer(invocation -> {
|
||||
planned.add(invocation.getArgument(0));
|
||||
return tile;
|
||||
}).when(planner).plan(any(HydrologyTileKey.class));
|
||||
HydrologyTileCache cache = new HydrologyTileCache(planner, 128, Runnable::run);
|
||||
try (HydrologyTileCache.PregenerationScope ignored = cache.preparePregeneration(
|
||||
new HydrologyTileCache.PregenerationArea(1024, 1024, 736, 736, 1311, 1311))) {
|
||||
assertEquals(prefetchRectangle(0, 1, 0, 1), new HashSet<>(planned));
|
||||
cache.prepareChunkColumns(800, 800);
|
||||
cache.prepareChunkColumns(1300, 1300);
|
||||
assertEquals(prefetchRectangle(0, 1, 0, 1), new HashSet<>(planned));
|
||||
assertEquals(4, planned.size());
|
||||
}
|
||||
cache.close();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void pregenScopesRestoreStudioPrefetchAndIgnoreSupersededClose() {
|
||||
HydrologyPlanner planner = mock(HydrologyPlanner.class);
|
||||
|
||||
Reference in new issue
Block a user