Search code examples
openglglslopengl-extensions

GL_ARB_sparse_texture not supported


I have this code which check if GL_ARB_sparse_texture is supported:

GLint ExtensionCount = 0;
    glGetIntegerv(GL_NUM_EXTENSIONS, &ExtensionCount);
    for (GLint i = 0; i < ExtensionCount; ++i)
        if (std::string((char const*)glGetStringi(GL_EXTENSIONS, i)) == std::string("GL_ARB_sparse_texture")){
            std::cout << "supported" << std::endl;
        }

It prints out that it is supported. Problem is that my shader says it is not:

#version 450 core
#extension GL_ARB_sparse_texture : require

output: enter image description here

I have GTX 660Ti with 350.12 drivers on windows 8.1.

What am I doing wrong?


Solution

  • As genpfault said in the comment, only extensions that add features to the GLSL language need to be enabled manually in the shader with the #extension directive. Since GL_ARB_sparse_texture doesn't add GLSL functionality, you don't need to explicitly enable it in your shaders - checking support with glGetIntegerv is enough.

    If an extension modifies the GLSL specification (such as ARB_shader_subroutine), it is mentioned in the extension specification.