To ICD Authors (ATI, NVIDIA, etc)

What is the mechanism through which OpenGL32.dll finds the vendor-supplied ICD? How do you write your own ICD? How do you find this stuff out from Microsoft?

-Won

It would be my guess that this information would be part of the Windows DDK.

You may find this article interesting:- http://www.gamasutra.com/features/19971121/passmore_01.htm

You may have to sign up for a username with gamasutra, but it’s free and will be useful for you in the future.

ICD development is not covered in the DDK – only MCD (which is no longer really supported).

Unfortunately, not only is that article basically out of date, it doesn’t really give any insight on how to actually implement an ICD.

Is the SGI open-source ICD designed to work with the current Windows OpenGL mechanism? Are all the answers lurking in the SGI opensource implementation?

-Won

I said you may find it interesting, not useful.

There’s a registry spy program which can show you who looks up what in the registry. I think you can find it on www.sysinternals.com if you look. I’m postulating that installing this tool and using it on a program that just opens the OpenGL driver might teach you something. Please report back to this thread when you’re done :slight_smile:

(I think it’s the “Regmon” utility)

Hmm I remember Brian Hook writing about this in detail a LONG time ago but I can’t find anything pre id on google.

Anyhoo, I think the OpenGL SI (for which you can get the source code) has the rudiments of an ICD implementation rolled into it. It used to be separate but AFAIK the code bases were merged, so the starting point is SGIs code base unless you want to roll your own from scratch (and even then you need to learn how). From memory this was just simple unoptimized stuff showing the basics for some antiquated S3 card or other, but that may have changed.
http://oss.sgi.com/projects/ogl-sample/

Dorbie – I think it was in one of the VoodooExtreme’s “Ask Grandmaster B” columns. Basically, he was talking about why you shouldn’t overwrite system32/Opengl32.dll, otherwise its a “Dummies” version of the Gamasutra article.

I’ve noticed that there are several OpenGL-relevant keys in the registry, but they also seem to vary by vendor. The most interesting thing in there is a path to the vendor-supplied library (e.g. nvoglnt.dll), but even figuring that part out is probably less than half the problem. These vendor supplied ICDs don’t look very much like OpenGL32.DLL; they don’t directly export the API calls.

So the question rephrased less ambiguously would be: How does System32/OpenGL32.DLL remap the API entry points to the vendor supplied implementation? I would imagine “solving” this problem might require (at least) a combination of registry spying and code spelunking, but SOMEONE here has to know what’s up, and directly. Ah well. I’ll try it when I get back to work Monday.

-Won

Wouldn’t Brian Paul and other mesa guys know about this?
Maybe they even have an own forum (or at least they regularly hang out in one place)?

At least you could have a peek at the mesa code, I’m ready to bet it has a build option for win32 …

Won, he may have written there too, but the Hook stuff I’m thinking of goes way back when he had his own web page detailing the work involved in writing an ICD vs MCD and a bunch of D3D programming stuff also. This is not some simple, “don’t mess with opengl32” article but quite detailed programming stuff. Anyway it’s probably gone forever. I expect the SI is the best starting point now.

Dorbie – I guess it’s concievable that the man has written about it more than once. Unfortunately, it is probably buried in obscurity by now.

Brian Paul has been busy. Mesa release 5.0 fully supports OpenGL 1.4, but I suspect most of his development is directed towards Linux support (last I heard, that was his primary development platform). I think that the Windows incarnation of Mesa is basically a standalone implementation. Anyways, we’ll see what happens when I crack through that shload 'o code.

-Won

The SI is specific to *nix systems. It does not contain the source for the ICD mechanism. For one thing, the MS ICD is not open source. You can license it and find out how it works.

But how complicated could it be. It’s just a question of resolving addresses and calling functions. If opengl32.dll notices an entry in the registry it will load the driver file and get the addresses. Whenever you make a GL call, you jump into opengl32.dll which in turn calls a function inside the driver. Otherwise, opengl32.dll will be executing the code it contains (software mode)

Why mention MESA? It doesn’t have a ICD mechanism either.

V-man

OK, I uncovered an old ARB note (crica 97)where Michael Gold was proposing to merge the ICD and SI development trees, sounds like it never happened. AFAIK SGI maintainins the OpenGL software ICD on windows.

Could Dave Shreiner shed some light on this?

[This message has been edited by dorbie (edited 11-30-2002).]