mirror of
https://github.com/Rezmason/matrix.git
synced 2026-04-16 21:39:29 -07:00
A temporary fix for the WebGPU detector. Also, Firefox doesn't support GPUQueue::copyExternalImageToTexture yet, so they'll fall back to regl until I work out a temporary alternative for that, too.
This commit is contained in:
@@ -6,9 +6,13 @@ document.addEventListener("touchmove", (e) => e.preventDefault(), {
|
||||
passive: false,
|
||||
});
|
||||
|
||||
const supportsWebGPU = async () => {
|
||||
return window?.GPUQueue?.prototype?.copyExternalImageToTexture != null;
|
||||
}
|
||||
|
||||
document.body.onload = async () => {
|
||||
const urlParams = Object.fromEntries(new URLSearchParams(window.location.search).entries());
|
||||
const useREGL = navigator.gpu == null || ["webgl", "regl"].includes(urlParams.renderer?.toLowerCase());
|
||||
const useREGL = !(await supportsWebGPU()) || ["webgl", "regl"].includes(urlParams.renderer?.toLowerCase());
|
||||
const solution = import(`./${useREGL ? "regl" : "webgpu"}/main.js`);
|
||||
const config = makeConfig(urlParams);
|
||||
(await solution).default(canvas, config);
|
||||
|
||||
Reference in New Issue
Block a user