Casey Primozic’s Notes

Misc. notes, code, and other content I want to post publicly that don’t warrant a full blog post

By Casey Primozic

Subscribe to RSS

Fixing WHEA_UNCORRECTABLE_ERROR Bluescreen with Windows + Linux Dual Boot

The Problem I dual-boot multiple Linux installs along with Windows. At some point, possibly coinciding with an update to one of my Linux installs, my Windows partition failed to boot with a bluescreen error showing a WHEA_UNCORRECTABLE_ERROR error message. I tried booting multiple times with no success. Most info I found online about this error seemed to indicate that it was related to hardware issues, but I hadn’t made any hardware changes recently and my Linux installs continued to boot and work fine.
Read more →

Getting Kinematic Object Movement Interpolation Working in Bullet Physics/ammo.js

Background I’m working on a browser-based game engine that uses Three.JS for rendering and a WebAssembly port of the Bullet physics engine called ammo.js for its physics engine and character controller. Bullet is a very old physics engine and Ammo.JS is more or less a direct copy of it with a few changes to support usage in the browser. There are a lot of rough edges and things you have to figure out yourself in order to use it.
Read more →

Creating Constrained Bezier Curves for an Envelope Generator

I recently finished some work involving constrained bezier curves for use in my browser-based digital audio workstation. Specifically, I used them in its envelope generator, which looks like this: The circles are draggable handles that allow the user to create whatever shape they desire for the envelope. The green handles define the start and end point of each curve segment and the blue circles control its shape/steepness. Motivation Originally, I used the function x^n to build the curves that made up the envelope.
Read more →

Fixing Rust+WebAssembly Memory Access Out of Bounds Errors in Debug Mode

The Problem In my project built with Rust compiled to WebAssembly, I started seeing errors like this that caused a crash - but only when it was compiled in debug mode: wavetable.wasm-011dbbd6:0x17b89 Uncaught RuntimeError: memory access out of bounds at wavetable.wasm._ZN9wavetable2fm7effects14EffectInstance10from_parts17h321e4433e1216e56E (wavetable.wasm-011dbbd6:0x17b89) at wavetable.wasm._ZN9wavetable2fm7effects11EffectChain10set_effect17h969349e414104e9eE (wavetable.wasm-011dbbd6:0x1ba60) at wavetable.wasm.fm_synth_set_effect (wavetable.wasm-011dbbd6:0x314d3) at FMSynthAWP.port.onmessage (FMSynthAWP.js:171:37) When compiling in release mode, the code ran just fine. The decompiled debug-mode Wasm at the point of the crash looked like this:
Read more →

Fixing Cypress Tests Failing with 404 Errors in Github Actions CI but Working Locally

I have some very basic Cypress tests set up for one of my personal projects - a single-page application created with React. I have some simple Github Actions configured to automatically run those tests every time I push to the repository. At some point somewhat randomly, those tests started failing in CI. It was probably due to some dependency getting upgraded or a change in the environment in which Github Actions runs.
Read more →

Notes on Self Hosting a Bluesky PDS Alongside Other Services

I’ve recently set up a Bluesky Personal Data Server (PDS) to store the data for my Bluesky account. I wanted to host it on my server alongside the many other web apps, databases, and many other services. I additionally wanted to use my top-level domain as my handle. I started out following the install guide on the official PDS repo and it initially started out pretty well. However, I pretty quickly ran into some issues where the default config didn’t work for me.
Read more →

Fixing Artifacts Caused by Negative Color Sampling in WebGL

The Problem I was working on a screen-space reflection shader. This involves reading pixels out of the main scene’s framebuffer/texture to be reflected. I was seeing strange grainy-looking artifacts showing up in my reflections that I couldn’t trace to anything in my shader code. Here’s what they looked like: One thing I noticed was that the artifacts seemed tied to specific positions in the texture being read, meaning that the artifacts were tied to individual texels in the texture being read from.
Read more →

A Small Change to Significantly Improve Triplanar Mapping

Triplanar Mapping is a method I make use of all the time in my 3D projects. Over time, I’ve experimented with tweaks and alterations to it with the goal of making it look better, run more performantly, and be useful in more situations. The main change I present here is switching from using a linear mix of texture weights from each axis to a non-linear mix. To explain what I mean by this, I’ll just show some code.
Read more →

A Basic Graphviz Dark Theme Config

I regularly use Graphviz to generate… graph visualizations. Since my website and blog are all dark-themed, I usually want to set it up so that the generated SVG is dark-themed as well. Here’s the basic config I use to make graphviz produce outputs with dark backgrounds and light content: digraph G { bgcolor="#181818"; node [ fontcolor = "#e6e6e6", style = filled, color = "#e6e6e6", fillcolor = "#333333" ] edge [ color = "#e6e6e6", fontcolor = "#e6e6e6" ] # The rest of your code goes here.
Read more →

Fixing regl Error Invalid Dynamic Attribute

Recently when working with the regl WebGL wrapper library, I encountered a weird error that I didn’t understand the cause of: (regl) invalid dynamic attribute "position" in command I checked my code, and I was indeed passing a position attribute and the data array I was using to construct the buffer looked correct. The error also happened intermittently, happening after my application hot-reloaded. The Cause It turns out that I had accidentally created two regl instances and was trying to use buffers allocated on one with commands created on a different one.
Read more →