Skip to content
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

Fix return value of shading language for GLES2. #223

Merged
merged 1 commit into from
Apr 21, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 5 additions & 10 deletions src/dispatch_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -392,10 +392,10 @@ epoxy_is_desktop_gl(void)
}

static int
epoxy_internal_gl_version(GLenum version_string, int error_version)
epoxy_internal_gl_version(GLenum version_string, int error_version, int factor)
{
const char *version = (const char *)glGetString(version_string);
GLint major, minor, factor;
GLint major, minor;
int scanf_count;

if (!version)
Expand All @@ -413,11 +413,6 @@ epoxy_internal_gl_version(GLenum version_string, int error_version)
abort();
}

if (minor >= 10)
factor = 100;
else
factor = 10;

return factor * major + minor;
}

Expand All @@ -439,7 +434,7 @@ epoxy_internal_gl_version(GLenum version_string, int error_version)
int
epoxy_gl_version(void)
{
return epoxy_internal_gl_version(GL_VERSION, 0);
return epoxy_internal_gl_version(GL_VERSION, 0, 10);
}

int
Expand All @@ -448,7 +443,7 @@ epoxy_conservative_gl_version(void)
if (api.begin_count)
return 100;

return epoxy_internal_gl_version(GL_VERSION, 100);
return epoxy_internal_gl_version(GL_VERSION, 100, 10);
}

/**
Expand All @@ -471,7 +466,7 @@ 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 epoxy_internal_gl_version(GL_SHADING_LANGUAGE_VERSION, 0, 100);

return 0;
}
Expand Down
2 changes: 2 additions & 0 deletions test/gl_version.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ main(int argc, char **argv)

pass = pass && test_version("3.0 Mesa 13.0.6", 30,
"1.30", 130);
pass = pass && test_version("OpenGL ES 2.0 Mesa 20.1.0-devel (git-4bb19a330e)", 20,
"OpenGL ES GLSL ES 1.0.16", 100);
pass = pass && test_version("OpenGL ES 3.2 Mesa 18.3.0-devel", 32,
"OpenGL ES GLSL ES 3.20", 320);
pass = pass && test_version("4.5.0 NVIDIA 384.130", 45,
Expand Down