Issues

Issue #468 resolved

Incorrect(?) detection of shader support

criptych
created an issue

LOVE fails to properly detect ARB shader support on systems without OpenGL 2.0.

In PixelEffect::isSupported: {{{

!c++

    return GLEE_VERSION_2_0 && GLEE_ARB_shader_objects && GLEE_ARB_fragment_shader && getGLSLVersion() >= "1.2";@

}}} This should probably read: {{{

!c++

    return (GLEE_VERSION_2_0 || (GLEE_ARB_shader_objects && GLEE_ARB_fragment_shader)) && getGLSLVersion() >= "1.2";

}}}

Note that the presence of GL 2.0 already implies shader support; only older GL versions should need the check for ARB shader support. According to http://www.opengl.org/sdk/docs/man/xhtml/glGetString.xml GL_SHADER_LANGUAGE_VERSION also exists in GL 2.0 (the comment in PixelEffect::getGLSLVersion says 2.1), and presumably exists in any implementation that has ARB shader support, so it should be possible to check the shader language version once shaders are known to be supported.

</ultra-serious-problem-report>

Discovered this trying to test a project using shaders on a few systems with different capabilities. On the high-end (for 2 years ago) system, it worked fine, but not on the low-end system, a netbook. I'd used both vertex and fragment shaders in C++ before on the same system, so I //know// they're supported (though not terribly fast).

Comments (8)

  1. criptych reporter

    Apparently using shaders via ARB support would require rewriting the module to use the ARB functions... now I'm not sure anymore if it's worth the effort.

    (EDIT) It wasn't as bad as I thought, just a handful of function renames. The functions themselves use the same parameters.

  2. Boolsheet

    Hm, the shader code targets GLSL 1.2 even though isSupported checks for OpenGL 2.0 and the ARB extensions. Not sure how this fits together.

    I faintly remember reading somewhere that the ARB versions are very different from the core versions. Don't know if that just means different function names and arguments or if it's more complicated.

    vrld, the author of PixelEffect, is currently on vacation. He'll get back sometime in september.

  3. criptych reporter

    "Not sure how this fits together." Yeah, I've noticed a few oddities like that (e.g. the check for 2.0 in isSupported and for 2.1 in getGLSLVersion). I chalked them up to typos and/or all-night coding runs, but who knows? ^_^

    "I faintly remember reading somewhere that the ARB versions are very different from the core versions." Could you be thinking of the assembly-language shader extensions (ARB_xxx_program)? Those certainly are different. The documentation says the ARB_xxx_shader extensions were "adopted into core" in 2.0, which I would take to mean they are (at least functionally) equivalent to the core shaders.

    In any case, thanks for the update, I'll wait to see what vrld says.

  4. vrld

    Hm, the shader code targets GLSL 1.2 even though isSupported checks for OpenGL 2.0 and the ARB extensions. Not sure how this fits together.

    Yes, that is weird. What was past-me thinking? Unfortunately GLSL 1.2 is only supported from OpenGL 2.1 upwards. Are there major differences between the ARB-GLSL and GLSL 1.2?

  5. Log in to comment