PDA

View Full Version : GLSL Card Profile Program Validator



Codemonkey
01-25-2005, 08:24 AM
so, GLSL is pretty cool, but is there any way to determine what cards/chipsets any given program will run on? in a similar vein, if a given program will "mostly work" on a specific card, is there any way to determine which part won't or will need to be rewritten to get it to work?

that is, your driver might support GLSL, but that doesn't mean every valid program will run on your card (obviously). how to tell which ones won't without actually having access to every card out there?

also, what happens if your program will work on a card, except for like 1 line that isn't supported by the hardware. does the program compile but not work correctly, or does the compile itself fail?

the nice thing about Cg is since it compiles to profiles which correspond to actual extension strings, you can determine apriori whether a shader will work on a card by determining whether the necessary extension is supported. AND Cg will crap out if you try to compile something that won't work on a given profile.

to expand on my question, the following vertex shader *should* (in theory) technically work on any hardware ever made, since it is not doing anything weird (even if that means using the default pipeline):

void main()
{
gl_Position = glModelviewProjectionMatrix *gl_Vertex;
}

but as the program becomes more complicated, it is hard to know what features you can or can't use based on the capabilities of a given card or chipset.

obviously no card out there probably supports every single thing that the GLSL spec outlines, yet. but partial support is available. so how do you know what any card can/can't do when writing a shader?

what would be nice is to have a way to submit a program to a card profile validator or something that would check if the things you are trying to do with a program are supported by any given card. like a database of features since GLSL can't be broken down into a set of overlapping capabilities like the extensions can.

Humus
01-25-2005, 02:36 PM
Originally posted by Codemonkey:
the nice thing about Cg is since it compiles to profiles which correspond to actual extension strings, you can determine apriori whether a shader will work on a card by determining whether the necessary extension is supported. AND Cg will crap out if you try to compile something that won't work on a given profile.
Not true. That ARB_fp is in the extension string does not in no way guarantee that all valid shaders will be hardware accelerated.


Originally posted by Codemonkey:
so how do you know what any card can/can't do when writing a shader?The OpenGL philosophy is that you shouldn't care, OpenGL guarantees that it will work and if hardware is not capable then software kicks in. Now this is in practice not always satisfying of course, nor is the philosophy in DX always satisfying, but in practice this is usually not too big of a deal for real world applications since you'll be testing the app on all major cards anyway before you release the app, and future hardware will with very few exceptions have at least as good support as the current cards on the market.
There is though a non-portable way to extract that info in GLSL at least on ATI hardware. Just scan the link infolog for the words "software" and "hardware".