Add WebGPU renderer (#648)

This commit is contained in:
redphx
2025-02-02 21:37:21 +07:00
parent 39ecef976c
commit fd665b6fcd
31 changed files with 1428 additions and 841 deletions

View File

@@ -12,6 +12,8 @@ import { GameSettingsStorage } from "./game-settings-storage";
import { BxLogger } from "../bx-logger";
import { ControllerCustomizationDefaultPresetId } from "../local-db/controller-customizations-table";
import { ControllerShortcutDefaultId } from "../local-db/controller-shortcuts-table";
import { BxEventBus } from "../bx-event-bus";
import { WebGPUPlayer } from "@/modules/player/webgpu/webgpu-player";
export class StreamSettingsStorage extends BaseSettingsStorage<StreamPref> {
@@ -150,11 +152,21 @@ export class StreamSettingsStorage extends BaseSettingsStorage<StreamPref> {
options: {
[StreamPlayerType.VIDEO]: t('default'),
[StreamPlayerType.WEBGL2]: t('webgl2'),
[StreamPlayerType.WEBGPU]: `${t('webgpu')} (${t('experimental')})`,
},
suggest: {
lowest: StreamPlayerType.VIDEO,
highest: StreamPlayerType.WEBGL2,
},
ready: (setting: any) => {
BxEventBus.Script.on('webgpu.ready', () => {
if (!navigator.gpu || !WebGPUPlayer.device) {
// Remove WebGPU option on unsupported browsers
delete setting.options[StreamPlayerType.WEBGPU];
}
}
);
},
},
[StreamPref.VIDEO_PROCESSING]: {
label: t('clarity-boost'),