back
▲ 4 points

Shader systems are ridiculously powerful if you're clever enough

by ColinWright·9mo ago·0 comments·view on hn ↗
LinkedIn posts are DoA here, and I can understand why.

But this is worth reading:

Quoting:

Laurie Kirk

Shader systems are ridiculously powerful if you’re clever enough.

Most people use them to create visual effects. You know what’s cooler?

Running Linux.

Inside an emulated RISC-V CPU. Inside a pixel shader. Inside of VRChat...

VRChat allows users to embed custom fragment shaders within worlds.

Of course, you don’t just get to run arbitrary C code wherever you want; that would be an insane security risk.

But, you do have textures. Textures that can hold state.

By abusing the heck out of shader logic, you can do some funny things.

To run linux in a shader, you first need a (simulated) CPU.

Of course, someone took it to the logical extreme; and emulated RISC-V logic in HLSL.

~64MiB of “Ram” stored as a texture.

Tick between frames fast enough, and you get a (somewhat useable) CPU.

About ~250 kilohertz on a 2080Ti.

Not much, but enough to run Linux!

What I love most is that you can visually “see” the system state at any point just by viewing the texture itself.

========

From:

https://www.linkedin.com/posts/laurie-kirk_shader-systems-are-ridiculously-powerful-ugcPost-7393761568427016192-08-x

// no comments yet