PDA

View Full Version : Detecting gpu capabilities.



MrKaktus
08-29-2009, 11:24 AM
Hi,

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 :)

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

Geometry shaders:
http://www.opengl.org/wiki/Geometry_Shaders

getting shader model:
http://www.opengl.org/wiki/Detecting_the_Shader_Model

getting current binded shader:


GLuint cur_prog
glGetIntegerv(GL_CURRENT_PROGRAM,&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)

MrKaktus
08-31-2009, 06: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 ;/ ?

Pswin
08-31-2009, 08:17 AM
see this:
http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/get.html

k_szczech
08-31-2009, 08: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.