Who runs OpenGL shaders if there is no video card

Viewed 1807

I am writing a very basic OpenGL C++ program (Linux 64 bits).

In fact, i have 3 programs:

  • a main C++ program
  • a vertex shader
  • a fragment shader

The 2 shaders are compiled at runtime. I suppose this programs are runs in parallel on video card by the GPU.

My question is what happens if my computer contains a very basic video cards with no GPU?

I have tried to run my program on VirtualBox with "3d acceleration" disabled and the program works!

Does that mean opengl detects the video card and run shaders on CPU automatically if there is no GPU?

2 Answers

OpenGL is just a standard, and that standard has different implementations. Normally, you'd rely on the implementation provided by your graphics driver, which is obviously going to be using the GPU.

However, most desktop Linux distros also include a software implementation of OpenGL, called Mesa, which is what get used if you don't have video drivers installed that support OpenGL. (It's very rare these days to find any video hardware, even integrated video on the CPU, that doesn't support OpenGL shaders, but on Linux drivers can be an issue and in you're case the VM is not making hardware acceleration available.)

So, the short answer is yes your shaders can run on the CPU, but that may or may not happen, and it may or may not be automatic, it depends on what video drivers (or other OpenGL implementation) you have installed.

On any modern personal computer there is a GPU. If you don't have a dedicated GPU card from vendors like NVidia or AMD,you will probably have a so called "on-board", or integrated video chip by Intel or another computer hardware manufacturer. The good thing is that even the on-board GPUs today are pretty good, (Intel started doing a good job finally) and the chance is high that such a hardware on your PC already supports modern programmable OpenGL version. Well, maybe not the latest one, but from my personal experience, Most of Intel's on-board GPUs from 2-3 years ago should support up to OpenGL 4.1/4.2 .So as long as you are not running on really old hardware, you should have a full access to gpu accelerated APIs. Otherwise you have Mesa library which comes with software (non GPU accelerated) implementation of OpenGL API.

Related