View Full Version : Detecting gpu capabilities.

08-29-2009, 10:24 AM

I know that I can get a lot of information about what my GPU can do (for eg. max texture size) but I cannot find information about shader units in specification.

How to obtain information "is such shader unit present in gpu"?
By that I mean: is geometry shader unit present (and in future, are hull, domain shader units present)?

I assume that from OGL 3.0 all gpu's that support it need's to have vertex and fragment units.

Thanks for help :)

08-29-2009, 10:43 AM
u can do it with get extension list or getting OpenGL version for example OGL 3.2 supports geomtry shaders.

Geometry shaders:

getting shader model:

getting current binded shader:

GLuint cur_prog

getting OGL version:

float ver;
char* ver_str = (char*)glGetString(GL_VERSION);
sscanf(vers_str, "%f ",&ver);

or u can use GL_MAJOR_VERSION and GL_MINJOR_VERSION with glGet ( i think only OGL 3.x support it)

08-31-2009, 05:41 AM
Ok but this is not the answer I am looking for. This all are workarounds, and I'm interested in direct testing of presence of some programmable stages in gpu pipeline.

Are there some states that describes it like for e.g.:
glGetIntegerv(GL_MAX_TEXTURE_SIZE,(GLint*)&support .maxTextureSize);
Or do I really need to check it by extensions presence ;/ ?

08-31-2009, 07:17 AM
see this:

08-31-2009, 07:33 AM
GL_MAX_TEXTURE_SIZE exists from beginning, but what about GL_MAX_TEXTURE_UNIT?

This token comes from extension: GL_EXT_multitexture

So before you even ask for GL_MAX_TEXTURE_UNIT with glGetInteger, you need to check if that extension is present. Otherwise the river may not understand the question and pop an error.

Of course you can interpret an error as "unsupported", but wait! Isn't THAT a workaround? :)

So let me put this straight: asking for extensions is not a workaround.
You may write some helper function like:
bool IsExtensionSupportec(const char * name);

Or you may use libraries like GLEW or GLEE. GLEW provides such functions.