Checking GfxCard Caps

Started by
2 comments, last by harry_x 18 years, 8 months ago
I need to use different vertex/fragment programs depending on what graphics card the user has. Is there some way to check the max number of instructions, max texture units, etc for a driver? EDIT: I am using Cg to do my programs. Is there some way to check if my program runs on a certain card?
Advertisement
for max texture units use glGetIntegerv(GL_MAX_TEXTURE_UNITS_ARB,&tex_units); or (on newer cards) glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS_ARB,&tex_image_units); and glGetIntegerv(GL_MAX_TEXTURE_COORDS_ARB,&tex_coord_units);

Newer cards have separate number of texcoord/image units so you should always check for it.

Max number of instructions depends not only on card itself but on extensions you choose to use for shaders (which Cg selects for you). Simplest way would be just to try to compile Cg shader in current profile and if it fails then select lower shader :-) Or you can check what codepath Cg has selected and load shaders for it...
When I compile a program under arbfp1 for example, I can use normalize and other stuff which I am quite sure some cards using that profile doesn't support... So is really arbfp1 a good messurement of what the framgment program can handle?
you can normalize vectors on any ARB_fragment_program capable card. There is no instruction for normalization, but it can be easily computed via DP4,RSQ and MUL instructions...

But you should always let Cg select the best (e.g. highest) codepath available for shaders...

This topic is closed to new replies.

Advertisement