PDA

View Full Version : Creating an Installable Client Driver for OpenGL



sean.settle
03-28-2012, 08:34 AM
Hi, I'm was wondering what would it take to create, or if it's even possible to write, an custom Installable Client Driver (ICD) for OpenGL? Is it possible to create a custom ICD that also wraps parts of other vendor's ICD? I've seen this done in OpenCL, but I'm not sure about OpenGL. Are all the specifications and information needed to do this freely available, just needing to be found, understood, and a lot of work to implement it? Thanks for the help!

ZbuffeR
03-29-2012, 07:36 AM
Do you mean something like http://code.google.com/p/glintercept/ ?

sean.settle
03-29-2012, 12:35 PM
I can't quite tell if glintercept is an ICD itself, or some hook right above it. I'll have to look into it more carefully. In the meantime, maybe if I give an example of what I want to do it will be more helpful.

Say I have an AMD and an NVIDIA graphics card and I want to create some sort of Crossfire/SLI between them. I could create a custom ICD that when Crossfire/SLI is disabled just sends 100% of the OpenGL API commands to the primary graphics card. However, when enabled it would send x%--x between ranging between 0 and 100--to the primary card and (100-x)% to the secondary card, then combine the final result and display. So I would need to write my own custom ICD that then calls other vendors' ICDs.

Ilian Dinev
03-31-2012, 06:56 PM
You don't need an ICD, just a custom opengl32.dll (like the one glIntercept creates, but for a different purpose).

It's absolutely possible, but making the load-sharing part will be tricky. Maybe the easiest way would be to add/modify glScissor calls - have gpu1 draw the left half, gpu2 the right half of the screen; then some performance-killing glReadPixels to update. First, you'll have to tackle remapping the object handles/names (generated by glGenTextures, or gotten by glGetUniformLocation). See ApiTrace for hints.