Add better insights and FPS autoscaling
This commit is contained in:
parent
30296409ac
commit
e5423212c3
3 changed files with 130 additions and 218 deletions
|
|
@ -5,6 +5,7 @@ import { RuntimeSettings } from '../settings/runtime-settings';
|
|||
import { StartupSettings } from '../settings/startup-settings';
|
||||
import { Renderer } from './renderer';
|
||||
import { RendererImplementation } from './renderer-implementation';
|
||||
import { RendererInfo } from './renderer-info';
|
||||
|
||||
/** @internal */
|
||||
export class ContextAwareRenderer implements Renderer {
|
||||
|
|
@ -109,8 +110,8 @@ export class ContextAwareRenderer implements Renderer {
|
|||
return this.handle(() => this.renderer.viewAreaSize, vec2.create());
|
||||
}
|
||||
|
||||
public get insights(): any {
|
||||
return this.handle(() => this.renderer.insights, {});
|
||||
public get insights(): RendererInfo | null {
|
||||
return this.handle(() => this.renderer.insights, null);
|
||||
}
|
||||
|
||||
public setViewArea(topLeft: vec2, size: vec2): void {
|
||||
|
|
@ -132,10 +133,6 @@ export class ContextAwareRenderer implements Renderer {
|
|||
return this.handle(() => this.renderer.addDrawable(drawable), undefined);
|
||||
}
|
||||
|
||||
public autoscaleQuality(deltaTime: number): void {
|
||||
return this.handle(() => this.renderer.autoscaleQuality(deltaTime), undefined);
|
||||
}
|
||||
|
||||
public displayToWorldCoordinates(displayCoordinates: vec2): vec2 {
|
||||
return this.handle(
|
||||
() => this.renderer.displayToWorldCoordinates(displayCoordinates),
|
||||
|
|
|
|||
22
src/graphics/rendering/renderer/renderer-info.ts
Normal file
22
src/graphics/rendering/renderer/renderer-info.ts
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
export interface RendererInfo {
|
||||
isWebGL2: boolean;
|
||||
vendor?: string;
|
||||
renderer?: string;
|
||||
extensions: { [name: string]: boolean };
|
||||
floatInterpolationEnabled?: boolean;
|
||||
programCount?: number;
|
||||
renderPasses: {
|
||||
distance: {
|
||||
renderScale?: number;
|
||||
drawableCount?: number;
|
||||
drawnDrawableCount?: number;
|
||||
tileCount?: number;
|
||||
};
|
||||
lights: {
|
||||
renderScale?: number;
|
||||
drawnDrawableCount?: number;
|
||||
};
|
||||
};
|
||||
startupTimeInMilliseconds?: number;
|
||||
[k: string]: any;
|
||||
}
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
import { vec2 } from 'gl-matrix';
|
||||
import { Drawable } from '../../../drawables/drawable';
|
||||
import { RuntimeSettings } from '../settings/runtime-settings';
|
||||
import { RendererInfo } from './renderer-info';
|
||||
|
||||
/**
|
||||
* The main interface through which rendering can be achieved.
|
||||
|
|
@ -84,21 +85,12 @@ export interface Renderer {
|
|||
destroy(): void;
|
||||
|
||||
/**
|
||||
* @experimental
|
||||
* Get useful information about the hardware and the SDF2D renderer.
|
||||
*
|
||||
* Its sheme is subject to change.
|
||||
*
|
||||
* During context lost it might be null.
|
||||
*
|
||||
* Debug information updated on each `renderDrawables` call.
|
||||
* Its scheme is not yet defined. The main purpose of this is
|
||||
* human debugging.
|
||||
*/
|
||||
readonly insights: any;
|
||||
|
||||
/**
|
||||
* @experimental
|
||||
*
|
||||
* Scale the render scale for both the canvas and the SDF memoization based
|
||||
* on the current and historical FPS values.
|
||||
*
|
||||
* @param deltaTime since the last frame, in milliseconds.
|
||||
*/
|
||||
autoscaleQuality(deltaTime: DOMHighResTimeStamp): void;
|
||||
readonly insights: RendererInfo | null;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue