This commit is contained in:
Akko
2025-08-04 18:57:35 +02:00
parent 8cf6e78a79
commit 9495868c2e
5030 changed files with 518594 additions and 17609 deletions

View File

@@ -0,0 +1,37 @@
import { DOMAdapter } from '../../environment/adapter.mjs';
import { AbstractRenderer } from '../../rendering/renderers/shared/system/AbstractRenderer.mjs';
"use strict";
let _isWebGLSupported;
function isWebGLSupported(failIfMajorPerformanceCaveat) {
if (_isWebGLSupported !== void 0)
return _isWebGLSupported;
_isWebGLSupported = (() => {
const contextOptions = {
stencil: true,
failIfMajorPerformanceCaveat: failIfMajorPerformanceCaveat ?? AbstractRenderer.defaultOptions.failIfMajorPerformanceCaveat
};
try {
if (!DOMAdapter.get().getWebGLRenderingContext()) {
return false;
}
const canvas = DOMAdapter.get().createCanvas();
let gl = canvas.getContext("webgl", contextOptions);
const success = !!gl?.getContextAttributes()?.stencil;
if (gl) {
const loseContext = gl.getExtension("WEBGL_lose_context");
if (loseContext) {
loseContext.loseContext();
}
}
gl = null;
return success;
} catch (e) {
return false;
}
})();
return _isWebGLSupported;
}
export { isWebGLSupported };
//# sourceMappingURL=isWebGLSupported.mjs.map