r/GraphicsProgramming • u/TheNextJohnCarmack • Dec 20 '21
Question x64 instructions for GPU stuff?
I am thinking about creating an OS, just for myself, but I wanna do 3D games on it. Can I just write my own driver for one specific GPU (nevermind the logistics, this is a hobby project. I just want to know if it is POSSIBLE), and how would I do that?
3
Upvotes
1
u/the_Demongod Dec 20 '21
The problem is that, to my knowledge, the graphics driver doesn't expose any bare metal API that you can use directly. The driver implements OpenGL, Vulkan, DirectX, etc. and you use that. It looks like you can get closer to Nvidia GPUs with NVAPI but this is still fairly abstract and as it mentions on the page, half the interesting features require you to sign an NDA. Based on that I'm going to go ahead and say that it's effectively impossible to do any direct communication with a modern GPU. As the other guys said, you'd be better off mucking around in OS dev or some other thing that will scratch this itch. GPUs are way too complicated to reasonably reverse engineer yourself. If you want to do something fun, I would suggest building your own GPU in an FPGA or in a hardware simulator and writing your own graphics driver.