mirror of
https://github.com/tobspr/shapez.io.git
synced 2026-03-02 03:39:21 +00:00
Improve buffer backlog performance, should speed up whole game
This commit is contained in:
@@ -2,7 +2,12 @@
|
||||
import { Application } from "../application";
|
||||
/* typehints:end */
|
||||
import { BufferMaintainer } from "../core/buffer_maintainer";
|
||||
import { disableImageSmoothing, enableImageSmoothing, registerCanvas } from "../core/buffer_utils";
|
||||
import {
|
||||
disableImageSmoothing,
|
||||
enableImageSmoothing,
|
||||
getBufferStats,
|
||||
registerCanvas,
|
||||
} from "../core/buffer_utils";
|
||||
import { globalConfig } from "../core/config";
|
||||
import { getDeviceDPI, resizeHighDPICanvas } from "../core/dpi_manager";
|
||||
import { DrawParameters } from "../core/draw_parameters";
|
||||
@@ -219,9 +224,6 @@ export class GameCore {
|
||||
lastContext.clearRect(0, 0, lastCanvas.width, lastCanvas.height);
|
||||
}
|
||||
|
||||
// globalConfig.smoothing.smoothMainCanvas = getDeviceDPI() < 1.5;
|
||||
// globalConfig.smoothing.smoothMainCanvas = true;
|
||||
|
||||
canvas.classList.toggle("smoothed", globalConfig.smoothing.smoothMainCanvas);
|
||||
|
||||
// Oof, use :not() instead
|
||||
@@ -374,9 +376,9 @@ export class GameCore {
|
||||
(zoomLevel / globalConfig.assetsDpi) * getDeviceDPI() * globalConfig.assetsSharpness;
|
||||
|
||||
let desiredAtlasScale = "0.25";
|
||||
if (effectiveZoomLevel > 0.8 && !lowQuality) {
|
||||
if (effectiveZoomLevel > 0.5 && !lowQuality) {
|
||||
desiredAtlasScale = ORIGINAL_SPRITE_SCALE;
|
||||
} else if (effectiveZoomLevel > 0.4 && !lowQuality) {
|
||||
} else if (effectiveZoomLevel > 0.35 && !lowQuality) {
|
||||
desiredAtlasScale = "0.5";
|
||||
}
|
||||
|
||||
@@ -500,18 +502,37 @@ export class GameCore {
|
||||
);
|
||||
|
||||
const stats = this.root.buffers.getStats();
|
||||
|
||||
context.fillText(
|
||||
"Buffers: " +
|
||||
"Maintained Buffers: " +
|
||||
stats.rootKeys +
|
||||
" root keys, " +
|
||||
" root keys / " +
|
||||
stats.subKeys +
|
||||
" sub keys / buffers / VRAM: " +
|
||||
" buffers / VRAM: " +
|
||||
round2Digits(stats.vramBytes / (1024 * 1024)) +
|
||||
" MB",
|
||||
|
||||
20,
|
||||
620
|
||||
);
|
||||
const internalStats = getBufferStats();
|
||||
context.fillText(
|
||||
"Total Buffers: " +
|
||||
internalStats.bufferCount +
|
||||
" buffers / " +
|
||||
internalStats.backlogSize +
|
||||
" backlog / " +
|
||||
internalStats.backlogKeys +
|
||||
" keys in backlog / VRAM " +
|
||||
round2Digits(internalStats.vramUsage / (1024 * 1024)) +
|
||||
" MB / Backlog " +
|
||||
round2Digits(internalStats.backlogVramUsage / (1024 * 1024)) +
|
||||
" MB / Created " +
|
||||
internalStats.numCreated +
|
||||
" / Reused " +
|
||||
internalStats.numReused,
|
||||
20,
|
||||
640
|
||||
);
|
||||
}
|
||||
|
||||
if (G_IS_DEV && globalConfig.debug.testClipping) {
|
||||
|
||||
Reference in New Issue
Block a user