Skip to content

Commit

Permalink
opengl/gpu: fix GLSL version detection on GLES
Browse files Browse the repository at this point in the history
  • Loading branch information
sfan5 committed Apr 18, 2024
1 parent 691ab15 commit d0eb997
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/opengl/gpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,13 @@ pl_gpu pl_gpu_create_gl(pl_log log, pl_opengl pl_gl, const struct pl_opengl_para
p->gles_ver = glsl->gles ? ver : 0;

// If possible, query the GLSL version from the implementation
const char *glslver = (char *) gl->GetString(GL_SHADING_LANGUAGE_VERSION);
if (glslver) {
PL_INFO(gpu, " GL_SHADING_LANGUAGE_VERSION: %s", glslver);
const char *glslver_p = (char *) gl->GetString(GL_SHADING_LANGUAGE_VERSION);
pl_str glslver = pl_str0(glslver_p);
if (glslver.len) {
PL_INFO(gpu, " GL_SHADING_LANGUAGE_VERSION: %.*s", PL_STR_FMT(glslver));
pl_str_eatstart0(&glslver, "OpenGL ES GLSL ES ");
int major = 0, minor = 0;
if (sscanf(glslver, "%d.%d", &major, &minor) == 2)
if (pl_str_sscanf(glslver, "%d.%d", &major, &minor) == 2)
glsl->version = major * 100 + minor;
}

Expand Down

0 comments on commit d0eb997

Please sign in to comment.