Hasty Briefsbeta

Linux in a Pixel Shader – A RISC-V Emulator for VRChat

12 days ago
  • #Shader Programming
  • #VRChat
  • #RISC-V
  • The author created a RISC-V emulator in a pixel shader for VRChat, capable of running Linux.
  • The emulator uses a 2048x2048 pixel texture for RAM and CPU state, with Unity Custom Render Texture for state management.
  • Performance optimizations include a two-pass shader design (CPUTick and Commit) and an L1 write cache to improve clock speed.
  • The project leverages HLSL for shader programming, with significant challenges in debugging and shader compilation.
  • Main memory is stored in a texture, allowing visual representation of memory usage and fragmentation.
  • The emulator includes a full SV32 MMU, UART for I/O, and a timer device, with Linux booting from an initramfs.
  • Payloads like Micropython and Rust-Test demonstrate the emulator's versatility beyond Linux.
  • The project showcases the creative potential of VRChat's shader capabilities, inspired by the demoscene ethos.