-
Notifications
You must be signed in to change notification settings - Fork 161
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Helper function to determine the highest supported GLSL version #145
Comments
Yes, I agree it would be a good addition. Care to open a pull request? |
I can give it a try, but I'm not entirely sure what the correct logic is. (Part of the reason I made this issue) Obviously there's |
The GL/GLES specifications typically assign a version to the GLSL shading language that goes along with their own version; this means we can provide a fallback value depending on the GL/GLES version of the currently bound context — if the GL implementation is returning something we can't use. I surely expect any conformant GL and GLES driver to return a reasonable value, though, otherwise we may just as well pack up our bags, and go home. Alternatively, we could give up early, and return 0, and let client code decide what's best in their interests. |
Since GL2 and GLES2 will have the "same" version number, maybe something like: int
epoxy_glsl_version(void)
{
if (epoxy_gl_version() >= 20 ||
epoxy_has_gl_extension("GL_ARB_shading_language_100")) {
return epoxy_internal_gl_version(GL_SHADING_LANGUAGE_VERSION, 0);
return 0;
} Where |
It can be nontrivial to figure out which GLSL version is supported, based on the combination of GL context type (GL, GLES) and the supported
GL_SHADING_LANGUAGE_VERSION
(or lack thereof).It might be worthwhile to export
epoxy_glsl_version
, to mirrorepoxy_gl_version
andepoxy_has_gl_extension
. It seems to fit the theme of these helpers.The text was updated successfully, but these errors were encountered: