Difference between revisions of "Detecting the Shader Model"

From OpenGL Wiki
Jump to navigation Jump to search
m
m
Line 1: Line 1:
 
This question has come up a few times and the best thread can be found here :<br>
 
This question has come up a few times and the best thread can be found here :<br>
 
http://www.opengl.org/discussion_boards/ubb/ultimatebb.php?ubb=get_topic;f=11;t=001090<br>
 
http://www.opengl.org/discussion_boards/ubb/ultimatebb.php?ubb=get_topic;f=11;t=001090<br>
 +
note : The link does not work since the forum software has changed<br>
 
<br>
 
<br>
 
Short explanation below:<br>
 
Short explanation below:<br>

Revision as of 16:13, 18 December 2007

This question has come up a few times and the best thread can be found here :
http://www.opengl.org/discussion_boards/ubb/ultimatebb.php?ubb=get_topic;f=11;t=001090
note : The link does not work since the forum software has changed

Short explanation below:
If you can detect GL_NV_vertex_program3, then you have a SM 3.0 GPU
GL_NV_fragment_program2 would do as well.
This works for nVidia GPUs
ATI 3.0 GPUs advertize GL_ATI_shader_texture_lod
If those extensions are not present and if your GL version 2.0, then you have a SM 2.0 GPU.
In glhlib 1.55, I have added glhGetShaderModelAsString and glhGetShaderModel that does just that. http://www.geocities.com/vmelkon/glhlibrary.html
Another method is to write some specific shaders and see if they compile.
If they do compile, check the info log for the presence of the word "software"

Update

SM 4.0 GPUs came out so how to detect these ones?
The most surefire way is to look for the following extension : GL_NV_gpu_program4, GL_NV_geometry_program4, GL_NV_vertex_program4, GL_NV_fragment_program4
and soon after, GL_EXT_gpu_shader4, GL_EXT_geometry_shader4, and some others.