3

I'm now a bit experienced with using OpenGL, which I started using because it's said that it is the only way to invoke video card functions. (besides DirectX - which I like less than OpenGL)

For programming (e.g. in C/C++) the OS gives many APIs, like functions for printing. But these can also be bypassed, by coding in Assembly-language - and call much lower level APIs (which gain speed) or direct CPU calls.

So I started wondering why this wouldn't be possible on the video card. Why should an API like OpenGL or DirectX be needed? The process going on with those is:

API-call >
 OS calls video card (with complex opcodes, I think) >
  video card responses (in complex binary format) >
   OS decodes this format and responses to user (in expected API format)

I believe this should decrease the speed of the rendering process.

So my question is:
Is there any possibility to bypass any graphical API (under Windows) and make direct calls to the video card?

Thanks,
Dennis

Dennis
  • 323
  • 7
  • 17
  • The video card memory and registers will be hidden in system address space - there's no way to access them directly. The best you could hope for would be to call the driver but I'm not sure that's possible. – Mark Ransom Aug 07 '12 at 15:32
  • 2
    Why is it needed? Because otherwise you'd be mired in hardware specific issues all the time. Been there, done that, didn't like it. – Tony Hopkinson Aug 07 '12 at 15:35
  • 1
    The better question is why one would think they can write a better graphics driver than the one the vendor wrote. – Andrew T Finnell Aug 07 '12 at 19:01

1 Answers1

2

Using assembly or bypassing an api doesnt automatically make something faster, often slower as you dont know what the folks that wrote the library know.

it is absolutely possible yes, those libraries are just processor instructions that poke and peek at registers and ram, and you could just as easily poke and peek at registers and ram. The first problem is can you get that information, sure, you can look at the linux drivers or other open source resources. Second, much of the heavy lifting today is done in the graphics chip by logic or graphics processors, so the host is just a go between and not necessarily the bottleneck if there is a bottleneck. And yes you can program the gpus depending on your video card/chip, etc.

You need to determine where the bottleneck really is, if there really is one, maybe the bus is your problem, maybe the operating system is your problem, or the compiler, or the hard disk or the system memory, the processor and architecture itself, caches, etc. At the same time how will you ever learn how to find these things unless you try.

I recommend getting rid of windows completely, no operating system, go bare metal. Take the linux and other open source resources plus anything you can get from the vendor and get closer to the metal. You will also need a lot of info about the pci/pcie bus and bridges, dma controllers, everything in the path. If you dont want to go that low then use linux or bsd or some other command line environment where it is well known how to take over the video system, and take over the video system while retaining an operating system and a development environment (vi/emacs, gcc).

if that is all way too advanced, then I recommend, dabbling in simple gpu routines to get a feel for how the video card works at least at some level and tackle this learning exercise one step at a time.

old_timer
  • 69,149
  • 8
  • 89
  • 168
  • Can you provide us some recommended books to refer regarding Hot to access GPU or Graphic Card directly with out an API or external libarary ? – Buddhika Chaturanga Nov 05 '15 at 05:26
  • linux and bsd and mesa3d and others are open source. you can start there if you want, remove the operating system dependencies, or simply look at what they are doing and do it your own way. – old_timer Nov 05 '15 at 17:42
  • Do you know the basic structure that, both Directx or OpenGL,is used to access GPU and Processor functionalities ,Are they implemented using Assembly rather than pure C code? Could you provide simple guidelines how to deal with provided driver/SDK which is supplied by respective vendor. Simply if we want to draw a arbitrary geometry with arbitrary resolution without using any OS calls or external library,only using GPU vendor provided functionalities/SDK and Assembly/C/C++ - Can we achieved it? Please help.I am a still student who willing to be a core game-engine developer thank you. – Buddhika Chaturanga Dec 21 '15 at 04:44