Disable the GPU timer by default
This commit is contained in:
parent
bd1eb1102e
commit
d241f36866
4 changed files with 19 additions and 5 deletions
|
|
@ -49,7 +49,6 @@ export class WebGlStopwatch {
|
||||||
this.gl.QUERY_RESULT_AVAILABLE
|
this.gl.QUERY_RESULT_AVAILABLE
|
||||||
);
|
);
|
||||||
const disjoint = this.gl.getParameter(this.timerExtension.GPU_DISJOINT_EXT);
|
const disjoint = this.gl.getParameter(this.timerExtension.GPU_DISJOINT_EXT);
|
||||||
|
|
||||||
if (available && !disjoint) {
|
if (available && !disjoint) {
|
||||||
this.resultsInNanoSeconds = this.gl.getQueryParameter(
|
this.resultsInNanoSeconds = this.gl.getQueryParameter(
|
||||||
this.timerQuery!,
|
this.timerQuery!,
|
||||||
|
|
@ -70,6 +69,10 @@ export class WebGlStopwatch {
|
||||||
return this.state == StopwatchState.running;
|
return this.state == StopwatchState.running;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public get isWaitingForResults(): boolean {
|
||||||
|
return this.state == StopwatchState.waitingForResults;
|
||||||
|
}
|
||||||
|
|
||||||
public get resultsInMilliSeconds(): number {
|
public get resultsInMilliSeconds(): number {
|
||||||
return this.resultsInNanoSeconds! / 1000 / 1000;
|
return this.resultsInNanoSeconds! / 1000 / 1000;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -139,10 +139,12 @@ export class RendererImplementation implements Renderer {
|
||||||
await compiler.compilePrograms();
|
await compiler.compilePrograms();
|
||||||
await Promise.all(promises);
|
await Promise.all(promises);
|
||||||
|
|
||||||
try {
|
if (settings.enableStopwatch) {
|
||||||
this.stopwatch = new WebGlStopwatch(this.gl);
|
try {
|
||||||
} catch {
|
this.stopwatch = new WebGlStopwatch(this.gl);
|
||||||
// no problem
|
} catch {
|
||||||
|
// no problem
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,4 +7,5 @@ export const defaultStartupSettings: StartupSettings = {
|
||||||
shadowTraceCount: 16,
|
shadowTraceCount: 16,
|
||||||
paletteSize: 256,
|
paletteSize: 256,
|
||||||
ignoreWebGL2: false,
|
ignoreWebGL2: false,
|
||||||
|
enableStopwatch: true,
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,14 @@
|
||||||
* The default values for StartupSettings can be found in [[defaultStartupSettings]].
|
* The default values for StartupSettings can be found in [[defaultStartupSettings]].
|
||||||
*/
|
*/
|
||||||
export interface StartupSettings {
|
export interface StartupSettings {
|
||||||
|
/**
|
||||||
|
* Creates a stopwatch used for measuring the GPU render time
|
||||||
|
* when its required extension is available.
|
||||||
|
*
|
||||||
|
* You should only have one renderer with enabled stopwatch.
|
||||||
|
*/
|
||||||
|
enableStopwatch: boolean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The raytracing algorithm used for shadows requires a step count.
|
* The raytracing algorithm used for shadows requires a step count.
|
||||||
* Sensible values for this are between 8 and 32.
|
* Sensible values for this are between 8 and 32.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue