Access opengl from gpu? asm?

Started by
6 comments, last by Infinisearch 6 years, 6 months ago

I making my coding my own os\game console from scratch and I would like to access the gpu to draw gfx?

how would I do it using c\c++\asm?

Sign, Cyndanera

Advertisement

The hardware drivers are pretty much all proprietary, so unless you are a big enough player for Intel/AMD/NVidia to directly support your platform... you don't.

That said, "your own OS" in this day and age is almost certainly a Linux or Android fork, and those come with GPU drivers.

Tristam MacDonald. Ex-BigTech Software Engineer. Future farmer. [https://trist.am]

If you want to use OpenGL on an OS made from scratch, you will literally have to implement OpenGL from scratch too! OpenGL itself is just a text document describing how implementations of it (which you find in your graphics drivers) should behave.

AMD and Intel publish a lot of information on their hardware, e.g. http://developer.amd.com/resources/developer-guides-manuals/, which is everything you need to know to write a driver. See also: https://en.wikipedia.org/wiki/Free_and_open-source_graphics_device_driver

For a simpler entrance you might take a look at the Mesa 3D Library that has grown all along the evolution of OpenGL and was developed for system that dosent have had access to gl drivers. Mesa contains some driver logic to access AMD/Nvidia/Intel GPUs

You could always try to reverse engineer the driver too, but thats alot alot of work.  But you could always use the source of Linux's open source drivers for AMD/Nvida. (although the last time I checked they were pretty far behind there closed source counterparts - especially in the case of nvidia since they don't publish any documentation at all.

8 hours ago, Hodgman said:

AMD and Intel publish a lot of information on their hardware, e.g. http://developer.amd.com/resources/developer-guides-manuals/, which is everything you need to know to write a driver.

Does this documentation include how to communicate with the command processor?  I thought it was just an ISA reference?

-potential energy is easily made kinetic-

Yeah I think the ISA docs tell you how to program the CU's, and the register docs tell you how to program the rest of the HW. e.g. writing to the VGT_DRAW_INITIATOR register (which is mapped to GPU address 0x287f0) launches a draw. Interestingly when I searched the interwebs for that constant name, google came up with the source for a WiiU emulator!

https://github.com/decaf-emu/decaf-emu/blob/master/src/libdecaf/src/modules/gx2/gx2_draw.cpp

5 minutes ago, Hodgman said:

and the register docs tell you how to program the rest of the HW.

That doesn't seem to have been updated since 2012.  Well looking at the open-source drivers seems to be the way to go.

-potential energy is easily made kinetic-

This topic is closed to new replies.

Advertisement