Skip to content

Instantly share code, notes, and snippets.

View deluksic's full-sized avatar

deluksic deluksic

View GitHub Profile
@munrocket
munrocket / wgsl_2d_sdf.md
Last active June 4, 2024 09:46
WGSL 2D SDF Primitives

WGSL 2D SDF Primitives

Revision: 06.08.2023, https://compute.toys/view/398

Circle - exact

fn sdCircle(p: vec2f, r: f32) -> f32 {
  return length(p) - r;
}
/*
Post-processing to allow deoptigate to work with browser collected traces.
To collect a trace from a Chromium-based browser, run with flags such as the below:
%browser_exe% --no-sandbox --disable-extensions --js-flags="--trace-ic --nologfile-per-isolate --logfile=/temp/trace/v8.log" C:\temp\trace\default.html
Rename the generated `v8.log` to `v8.pre.log`, to preserve the orignal log
before processing with the below (that specific filename is expected).