UNPKG

@itwin/frontend-devtools

Version:

Debug menu and supporting UI widgets

30 lines 1.3 kB
/*--------------------------------------------------------------------------------------------- * Copyright (c) Bentley Systems, Incorporated. All rights reserved. * See LICENSE.md in the project root for license terms and full copyright notice. *--------------------------------------------------------------------------------------------*/ /** @packageDocumentation * @module Tools */ import { IModelApp, Tool } from "@itwin/core-frontend"; /** Adjust the value of [TileAdmin.gpuMemoryLimit]($frontend). This controls how much GPU memory is allowed to be consumed * by tile graphics before the system starts discarding the graphics for the least recently drawn tiles. * @beta */ export class SetGpuMemoryLimitTool extends Tool { static toolId = "SetGpuMemoryLimit"; static get minArgs() { return 1; } static get maxArgs() { return 1; } async run(limit) { if (undefined !== limit) { IModelApp.tileAdmin.gpuMemoryLimit = limit; IModelApp.requestNextAnimation(); } return true; } async parseAndRun(...args) { const maxBytes = Number.parseInt(args[0], 10); const limit = Number.isNaN(maxBytes) ? args[0] : maxBytes; return this.run(limit); } } //# sourceMappingURL=SetGpuMemoryLimitTool.js.map