mirror of
https://github.com/jackyzha0/quartz.git
synced 2025-12-24 21:34:06 -06:00
fix(graph): gpu detection
This commit is contained in:
parent
771c05ff18
commit
c0cda94b74
@ -14,7 +14,15 @@ import {
|
||||
drag,
|
||||
zoom,
|
||||
} from "d3"
|
||||
import { Text, Graphics, Application, Container, Circle } from "pixi.js"
|
||||
import {
|
||||
Text,
|
||||
Graphics,
|
||||
Application,
|
||||
Container,
|
||||
Circle,
|
||||
isWebGPUSupported,
|
||||
isWebGLSupported,
|
||||
} from "pixi.js"
|
||||
import { Group as TweenGroup, Tween as Tweened } from "@tweenjs/tween.js"
|
||||
import { registerEscapeHandler, removeAllChildren } from "./util"
|
||||
import { FullSlug, SimpleSlug, getFullSlug, resolveRelative, simplifySlug } from "../../util/path"
|
||||
@ -350,6 +358,11 @@ async function renderGraph(graph: HTMLElement, fullSlug: FullSlug) {
|
||||
tweens.clear()
|
||||
|
||||
const app = new Application()
|
||||
const graphicsProvider = (await isWebGPUSupported())
|
||||
? "webgpu"
|
||||
: isWebGLSupported()
|
||||
? "webgl"
|
||||
: undefined
|
||||
await app.init({
|
||||
width,
|
||||
height,
|
||||
@ -357,7 +370,7 @@ async function renderGraph(graph: HTMLElement, fullSlug: FullSlug) {
|
||||
autoStart: false,
|
||||
autoDensity: true,
|
||||
backgroundAlpha: 0,
|
||||
preference: "webgpu",
|
||||
preference: graphicsProvider,
|
||||
resolution: window.devicePixelRatio,
|
||||
eventMode: "static",
|
||||
})
|
||||
|
||||
Loading…
Reference in New Issue
Block a user