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