Jump to content
  • Advertisement
Cyndanera

OpenGL Access opengl from gpu? asm?

Recommended Posts

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?

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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?

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!