Running Linux in a Pixel Shader: Building a RISC-V Emulator for VRChat
By
rbanffy
Pulled from the oven just right. Trustworthy, fact-dense, deeply satisfying.
Summary
A developer documents their ambitious side project of creating a RISC-V emulator that runs Linux entirely within a pixel shader in VRChat. The article details the technical challenges of implementing a CPU emulator in HLSL shader code, including memory management, instruction execution, and system calls, all running on a GPU. The project successfully boots Linux in a virtual world, demonstrating extreme technical creativity and pushing the boundaries of what's possible with modern graphics hardware.
Key quotes
· 5 pulledSometimes you get hit with ideas for side-projects that sound absolutely plausible in your head. The idea grips you, your mind's eye can practically visualize it already. And then reality strikes, and you realize how utterly insane this would be, and just how much work would need to go into it.
But sometimes. Sometimes I decide to double down and get Linux running on my graphics card.
This is the story of how I got Linux running in a pixel shader in VRChat.
The core idea is simple: implement a RISC-V emulator in HLSL shader code, and use that to run Linux.
It's slow, it's impractical, but it works - and that's the beauty of it.
You might also wanna read
Rendering Realistic Skies and Planetary Atmospheres in Real-Time with Shaders
This article explores the technical and visual process of rendering realistic skies, sunsets, and planetary atmospheres in real-time using b
Exploring surfel-based global illumination with WebGPU on the open web
A technical blog post exploring the use of WebGPU to compute real-time global illumination using surfels (surface patches). The author inves
Implementing Colored Penumbra Shadow Effects in Unreal Engine 5
This article describes a technique for implementing "Colored Penumbra" or "Colored Shadow Terminator" effects in Unreal Engine 5. The author
rvcore: A RISC-V RV32IM Emulator That Runs DOOM
rvcore is a single-core RISC-V emulator implementing the RV32IM ISA, capable of running DOOM. The project is hosted on GitHub and requires C
Running Adobe's 1991 PostScript Interpreter from an HP LaserJet Cartridge in the Browser
A technical article about retro-ps, a project that emulates a 1991 HP PostScript Cartridge Plus (C2089A) in the browser. The cartridge conta
IRIS: An AI-assisted Rust-based SGI Indy Emulator that boots IRIX
An SGI Indy (MIPS R4400) emulator called IRIS (Irresponsible Rust IRIX Simulator) built using Rust and AI assistance. It boots IRIX 6.5 and
