OpenGL functions straight from GPU

This post may not make allot of sense, I am still a hardware newb.

I was watching some OpenGL tutorials on Buffer Objects, and I noticed it said that the OpenGL functions are called from the CPU and then the graphics card interpenetrates them. So I was wondering, what if we could call the methods straight from the GPU without having to worry about a CPU bottleneck?

(I may be wrong on how this works?)

Are you asking if it is possible? Or ‘what if’ we could?

Just to clarify, I would be interested to know as well but also it is pretty much impossible (really) to do anything without having the CPU deal with it, obviously.

OpenCL?

The idea of the programmable pipeline is more like setting everything up on the CPU side, send it over to the GPU and let the (GLSL) shaders do the heavy lifting. There would usually be little use for calling individual OpenGL functions from the GPU.

If you want to continously modify a dataset on the GPU, you could probably use OpenCL for that, but I heard that it might be difficult to bridge between OpenCL and GLSL when needed. I didn’t use OpenCL though, so this might be uninformed…

You can’t call fn’s directly from the GPU, Its not really designed for that.

You can however modify and create Buffer data in the GPU using OpenGL 4 functionality like Computational Shaders or OpenCL or even directly with vertex shaders using SSBOs*. You can use this to do a lot more on the GPU side without having to send data back and forth to the CPU. This is about as close as you can get to doing everything on the GPU. But you still have to do the initial set up, draw calls and kernel enqueues (assuming OCL).

*not sure about that last point never actually used SSBOs

Gpu’s are fast to do many things in parallel. But not fast at all to do single thing in sequantial order.

Just want to hop into here and say that it’s called “interprete”/“interprets”… penetration is another story ;D

Get your interpreter out of the gutter!

On topic: I’d say that functions “on the GPU” makes little sense if you are talking about functions as in the subroutines the OpenGL or CUDA etc. APIs are made of. Those functions are (and have to be) on the CPU, how else would you call them? However, the GPU does run programs, which are in turn made of functions; ever heard of shaders?

The OpenGL functions are there as an “access point” to the GPU: since all your code runs in the context of (and literally in) the CPU, they function as a “telephone line” out to the GPU to tell it what to start doing.

I’m turning up blank on a good analogy, but I think the concept posed by CrowdProcess is very similar to how a GPU works, and is interesting in itself, so give it a read. (Note that the abstract idea is nothing new, but CP is a cool example of it in action that I remembered)

Your GPU can’t issue OpenGL commands, no. You can however compute parameters for a draw call on the GPU, store them in a buffer object and issue an indirect draw call to use them.

http://www.opengl.org/registry/specs/ARB/draw_indirect.txt