了解glxinfo OpenGL版本

glxinfo命令输出中所有不同版本字符串之间的区别是什么?

我已经在这里问了这个问题 ,但没有得到很多回复,反正似乎在AskUbuntu上还有更多相关的问题。

glxinfo|grep OpenGL的输出如下,

  glxinfo |grep Open Vendor: Intel Open Source Technology Center (0x8086) OpenGL vendor string: Intel Open Source Technology Center OpenGL renderer string: Mesa DRI Intel(R) HD Graphics 520 (Skylake GT2) OpenGL core profile version string: 4.5 (Core Profile) Mesa 13.0.2 OpenGL core profile shading language version string: 4.50 OpenGL core profile context flags: (none) OpenGL core profile profile mask: core profile OpenGL core profile extensions: OpenGL version string: 3.0 Mesa 13.0.2 OpenGL shading language version string: 1.30 OpenGL context flags: (none) OpenGL extensions: OpenGL ES profile version string: OpenGL ES 3.2 Mesa 13.0.2 OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.20 OpenGL ES profile extensions: . 

为什么“核心配置文件”4.5,而OpenGL版本字符串是3.0?

OpenGL ES是原始OpenGL规范的一个子集,专为智能手机等嵌入式系统而设计。 我不是100%确定为什么版本号不对应,但他们没有。 OpenGL的最新版本为4.5,OpenGL ES的最新版本为3.2。 这解释了OpenGL ES部分输出的原因。 在您的情况下,您支持OpenGL和OpenGL ES的最新版本。

您将注意到OpenGL和OpenGL ES条目具有版本字符串和着色语言版本字符串。 在OpenGL 3.3之前,OpenGL版本号和着色语言版本号不匹配。 我相信这就是他们在输出中有单独条目的原因(因为它们对于旧硬件显然可能不同)。 如输出中所示,版本号(4.5)与着色语言版本(也是4.5)匹配。

最困难的部分(以及我不是100%确定的部分)是“OpenGL版本字符串”。

从我在几台完全不同的机器上看到的情况来看,这似乎是3.0版本的上限。 3.0的着色语言版本是1.3,因此着色语言版本字符串对于此OpenGL版本是有意义的。 但是,为什么版本上限为3.0? 我的想法如下:

3.0版引入了弃用(请参阅此链接 )。 这也是两个独立的配置文件来自“核心”和“兼容性”的地方。 OpenGL的任何实现只需要实现“核心”规范才有效。

如果您阅读特定版本的Mesa发行说明,您将看到与此核心/兼容性配置文件问题相关的声明。 以下内容摘自最新版本17.0.0的发行说明:

 Mesa 17.0.0 implements the OpenGL 4.5 API, but the version reported by glGetString(GL_VERSION) or glGetIntegerv(GL_MAJOR_VERSION) / glGetIntegerv(GL_MINOR_VERSION) depends on the particular driver being used. Some drivers don't support all the features required in OpenGL 4.5. OpenGL 4.5 is only available if requested at context creation because compatibility contexts are not supported. 

请注意最后一部分“只有在创建上下文时请求OpenGL 4.5才可用,因为不支持兼容性上下文” 。 因此,我认为“OpenGL版本字符串”是“兼容性”配置文件上下文的支持版本(换句话说,支持版本3.0之前的任何弃用function)。