Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions packages/dev/core/src/Engines/engineFactory.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import type { AbstractEngine } from "./abstractEngine";
import { Engine } from "./engine";
import { NullEngine } from "./nullEngine";
import { WebGPUEngine } from "./webgpuEngine";
import { NullEngine, type NullEngineOptions } from "./nullEngine";
import { WebGPUEngine, type WebGPUEngineOptions } from "./webgpuEngine";
import type { EngineOptions } from "./thinEngine";

/**
* Helper class to create the best engine depending on the current hardware
Expand All @@ -13,14 +14,14 @@ export class EngineFactory {
* @param options Defines the options passed to the engine to create the context dependencies
* @returns a promise that resolves with the created engine
*/
public static async CreateAsync(canvas: HTMLCanvasElement, options: any): Promise<AbstractEngine> {
public static async CreateAsync(canvas: HTMLCanvasElement, options?: WebGPUEngineOptions | EngineOptions | NullEngineOptions): Promise<AbstractEngine> {
const supported = await WebGPUEngine.IsSupportedAsync;
if (supported) {
return await WebGPUEngine.CreateAsync(canvas, options);
return await WebGPUEngine.CreateAsync(canvas, options as WebGPUEngineOptions);
}
if (Engine.IsSupported) {
return new Engine(canvas, undefined, options);
return new Engine(canvas, undefined, options as EngineOptions);
}
return new NullEngine(options);
return new NullEngine(options as NullEngineOptions);
}
}
Loading