Detecting Pixel Shader Version

Started by
5 comments, last by Cygon 16 years, 5 months ago
I'm trying to detect the Pixel Shader version of the installed graphics card. Can anyone give me some advice on how this can be achieved with OpenGL? Before you recommend that I just check for the GL extensions my game needs -- I am writing an installer for a Direct3D game of all things, and using DirectX to query for the shader version is not an option when DirectX might not even be installed on the target system yet :) Thanks, -Markus-
Professional C++ and .NET developer trying to break into indie game development.
Follow my progress: http://blog.nuclex-games.com/ or Twitter - Topics: Ogre3D, Blender, game architecture tips & code snippets.
Advertisement
Quote:Original post by Cygon
I'm trying to detect the Pixel Shader version of the installed graphics card. Can anyone give me some advice on how this can be achieved with OpenGL?

AFAIK the way to go is: When you've detected the OpenGL version via
glGetString(GL_VERSION)
and the version is at least 2.0, then you can use
glGetString(GL_SHADING_LANGUAGE_VERSION)
to get the GLSL version. For OpenGL below 2.0 you have to check for the extension
ARB_SHADING_LANGUAGE_100
what obviously means that GLSL 1.0.0 is available if the extension is resolved, else no GLSL is available at all.

You have to check some compatibility charts if you want to derive a Direct3D compliant version information.

Quote:Original post by Cygon
Before you recommend that I just check for the GL extensions my game needs -- I am writing an installer for a Direct3D game of all things, and using DirectX to query for the shader version is not an option when DirectX might not even be installed on the target system yet :)

Err, what? We shouldn't recommend to use GL extension checking because Direct3D may not be installed? I don't understand.

However, checking for hardware details w/o using a standardized API ... well, that probably becomes a mess. But perhaps your target OS provides some way besides the gfx API. But even if so, that would still no guarantee that the gfx API / driver used later will provide you a matching shader language just only because of the hardware is available.
Quote:Original post by haegarr
Err, what? We shouldn't recommend to use GL extension checking because Direct3D may not be installed? I don't understand.


I was thinking along the lines that you might want to persuade me to just check that the graphics card has the extensions / capabilities my game needs instead of trying to find out the shader version.

Ergo I added that I really need the actual pixel shader version because I'm writing this code to check for a compatible graphics card in the installer of a D3D game. I decided to do this check via OpenGL because the installer might be run on systems where DX is not yet installed.

Hope that clears it up ;)

-Markus-
Professional C++ and .NET developer trying to break into indie game development.
Follow my progress: http://blog.nuclex-games.com/ or Twitter - Topics: Ogre3D, Blender, game architecture tips & code snippets.
These shader models are a purely Direct3D thing, OpenGL has no concept of them. You can query support for the various hardware capabilities relating to specific shader models by querying the relevant extensions. A quick google came up with this page.

I still don't get it though... if your game is a D3D game then it obviously needs D3D installed before someone can play it, so why not check the shader model after you finish installing it?
Well, I want my setup to tell the user when his system is incapable of running the game before he spends an eternity installing tons of stuff including .NET 2.0, XNA, the VC2005 SP1 runtime, Ageia PhysX and of course DirectX 9.0c.

Maybe an image says more than a thousand words:


I finally found some code in the Wine D3D wrapper that tries to guess the shader version based on OpenGL extensions and limits:
http://source.winehq.org/source/dlls/wined3d/directx.c

Thanks for the link. I'm slowly getting all the pieces together :)

-Markus-
Professional C++ and .NET developer trying to break into indie game development.
Follow my progress: http://blog.nuclex-games.com/ or Twitter - Topics: Ogre3D, Blender, game architecture tips & code snippets.
Quote:Original post by Cygon
Well, I want my setup to tell the user when his system is incapable of running the game before he spends an eternity installing tons of stuff including .NET 2.0, XNA, the VC2005 SP1 runtime, Ageia PhysX and of course DirectX 9.0c.
Okay, I see what you mean. Perhaps you can run the install for DX first, if needed, and then check the hardware caps before installing everything else? Another thing to consider is that the user's video card drivers may not be up-to-date so their OpenGL implementation may not support something that their hardware actually does support.
Yes, I'm aware of that. All I want to do is fire a message box like "setup could not detect any shader 2.0 capable hardware in your system. This game requires a graphics card which supports shader model 2.0. Continue anyway?"

Perhaps add a recommendation to download the latest drivers and combine everything with a backup check via D3D (if available before the install, afaik Windows XP SP2 ships with D3D9) and I should be catching most of the compatibility issues before the installer has even modified the system.

-MArkus-
Professional C++ and .NET developer trying to break into indie game development.
Follow my progress: http://blog.nuclex-games.com/ or Twitter - Topics: Ogre3D, Blender, game architecture tips & code snippets.

This topic is closed to new replies.

Advertisement