GL_ARB_sparse_texture 不支持

GL_ARB_sparse_texture not supported

我有这段代码可以检查是否支持 GL_ARB_sparse_texture

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;
        }

打印出来是支持的。问题是我的着色器说它不是:

#version 450 core
#extension GL_ARB_sparse_texture : require

输出:

我在 windows 8.1 上有 GTX 660Ti 和 350.12 驱动程序。

我做错了什么?

正如 genpfault 在评论中所说,只有向 GLSL 语言添加功能的扩展才需要在着色器中使用 #extension 指令手动启用。由于 GL_ARB_sparse_texture 不添加 GLSL 功能,因此您无需在着色器中显式启用它 - 使用 glGetIntegerv 检查支持就足够了。

如果扩展修改了 GLSL 规范(例如 ARB_shader_subroutine),它会在扩展规范中提及。