Skip to content

Latest commit

 

History

33 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

wgfractals

A 2D complex-plane escape time fractal explorer rendered entirely on the GPU with WebGPU compute shaders. Pick a fractal, pan and zoom with the mouse; every frame is computed by dispatching one thread per pixel.

Live demo: manit2004.github.io/wgfractals

Running it

npm install
npm run build   # writes dist/app.browser.js

Then just open index.html in a WebGPU-capable browser — no server needed, it's a plain <script src="dist/app.browser.js">.

For active development, npm run dev starts a local server that rebuilds dist/app.browser.js on every save (refresh the page manually — there's no live-reload).

Browser Support

wgfractals runs in any browser with WebGPU enabled. Check if it's working in your browser at webgpureport.org.

Chrome (recommended)

For full WebGPU control, enable all three flags at chrome://flags and relaunch:

Flag What it does
#enable-unsafe-webgpu Enables WebGPU
#force-enable-webgpu-interop Uses the real GPU via Vulkan (Linux) — without this Chrome may fall back to SwiftShader, a CPU-based software renderer
#enable-webgpu-developer-features Unlocks additional GPU features, including the adapter name shown in the sidebar's "GPU:" readout

Flag changes only take effect after a full restart — closing one window isn't enough while other Chrome windows keep the old browser process (and its GPU process) alive. Use the Relaunch button chrome://flags shows after a change, or quit Chrome completely.

You can verify which GPU is being used at webgpureport.org — if the adapter name shows SwiftShader, the real GPU is not being used. wgfractals' own sidebar ("GPU: …") shows the same thing once a frame renders.

Firefox

WebGPU must be enabled manually via about:config. Search for each preference and set it:

Preference Value What it does
dom.webgpu.enabled true Enables WebGPU
dom.webgpu.wgpu-backend vulkan Forces the real GPU via Vulkan — without this Firefox may use a software renderer
gfx.webgpu.ignore-blocklist true Bypasses the GPU blocklist

Note: dom.webgpu.wgpu-backend is a string preference — click the pencil icon to edit it and type vulkan.

Restart Firefox after making changes.

Note: Firefox's WebGPU implementation is incomplete and some fractals may not render correctly. Chrome is recommended.

Multi-GPU: Firefox only exposes one WebGPU adapter (the display GPU, typically integrated) even on dual-GPU systems — verified via about:support → Graphics → WebGPU Default Adapter. Chrome picks the discrete GPU via powerPreference: "high-performance" (see src/init.mjs); Firefox does not.