Skip to content

Commit efddd79

Browse files
authored
revert(graph): roll back changes due to issues with Safari (#2067)
* chore: remove unused dependency * fix(graph): rolled back webgpu changes
1 parent 8d19bc3 commit efddd79

File tree

3 files changed

+1
-28
lines changed

3 files changed

+1
-28
lines changed

package-lock.json

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040
"@myriaddreamin/rehype-typst": "^0.6.0",
4141
"@napi-rs/simple-git": "0.1.21",
4242
"@tweenjs/tween.js": "^25.0.0",
43-
"@webgpu/types": "^0.1.64",
4443
"ansi-truncate": "^1.2.0",
4544
"async-mutex": "^0.5.0",
4645
"chokidar": "^4.0.3",

quartz/components/scripts/graph.inline.ts

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -68,30 +68,6 @@ type TweenNode = {
6868
stop: () => void
6969
}
7070

71-
// workaround for pixijs webgpu issue: https://github.com/pixijs/pixijs/issues/11389
72-
async function determineGraphicsAPI(): Promise<"webgpu" | "webgl"> {
73-
const adapter = await navigator.gpu?.requestAdapter().catch(() => null)
74-
const device = adapter && (await adapter.requestDevice().catch(() => null))
75-
if (!device) {
76-
return "webgl"
77-
}
78-
79-
const canvas = document.createElement("canvas")
80-
const gl =
81-
(canvas.getContext("webgl2") as WebGL2RenderingContext | null) ??
82-
(canvas.getContext("webgl") as WebGLRenderingContext | null)
83-
84-
// we have to return webgl so pixijs automatically falls back to canvas
85-
if (!gl) {
86-
return "webgl"
87-
}
88-
89-
const webglMaxTextures = gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS)
90-
const webgpuMaxTextures = device.limits.maxSampledTexturesPerShaderStage
91-
92-
return webglMaxTextures === webgpuMaxTextures ? "webgpu" : "webgl"
93-
}
94-
9571
async function renderGraph(graph: HTMLElement, fullSlug: FullSlug) {
9672
const slug = simplifySlug(fullSlug)
9773
const visited = getVisited()
@@ -373,7 +349,6 @@ async function renderGraph(graph: HTMLElement, fullSlug: FullSlug) {
373349
tweens.forEach((tween) => tween.stop())
374350
tweens.clear()
375351

376-
const pixiPreference = await determineGraphicsAPI()
377352
const app = new Application()
378353
await app.init({
379354
width,
@@ -382,7 +357,7 @@ async function renderGraph(graph: HTMLElement, fullSlug: FullSlug) {
382357
autoStart: false,
383358
autoDensity: true,
384359
backgroundAlpha: 0,
385-
preference: pixiPreference,
360+
preference: "webgpu",
386361
resolution: window.devicePixelRatio,
387362
eventMode: "static",
388363
})

0 commit comments

Comments
 (0)