如何在 Ubuntu 上使用 Mesa 10.1 启用 OpenGL 3.3 [英] How to enable OpenGL 3.3 using Mesa 10.1 on Ubuntu

查看:51
本文介绍了如何在 Ubuntu 上使用 Mesa 10.1 启用 OpenGL 3.3的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用基于 OpenGL 3.3 和 GLSL 3.3 的基于 OpenGL 的渲染引擎在使用 AMD Radeon 6950 的 Ubuntu 13.10 上运行.我想使用开源驱动程序 (radeon),它们依赖于 Mesa 的 OpenGL 实现.Ubuntu 13.10 仅提供开箱即用"的 Mesa 9.2(实现 OpenGL 3.1).然而,可以从 这个 PPA 如本主题所述:

I am trying to get an OpenGL-based rendering engine that relies on OpenGL 3.3 and GLSL 3.3 to run on Ubuntu 13.10 using an AMD Radeon 6950. I want to use the open source drivers (radeon), which rely on Mesa for their OpenGL implementation. Ubuntu 13.10 only provides Mesa 9.2 (implementing OpenGL 3.1) "out of the box". It is however possible to install Mesa 10.1 (implementing OpenGL 3.3) from this PPA as explained in this thread:

StackOverflow:OpenGL&Ubuntu 12.04 下 HD Graphics 4000 上的 GLSL 3.3

StackOverflow: OpenGL & GLSL 3.3 on an HD Graphics 4000 under Ubuntu 12.04

我使用了与那里解释的完全相同的步骤:

I used the exact same steps as explained there:

1.) Add the PPA Repository
  $ sudo add-apt-repository ppa:oibaf/graphics-drivers
2.) Update sources
  $ sudo apt-get update
3.) Dist-upgrade (rebuilds many packages)
  $ sudo apt-get dist-upgrade
4.) Then I rebooted.

Mesa 10.1 安装成功.但是,glxinfo 虽然现在报告正在使用 Mesa 10.1,但仍然只报告 OpenGL 3.0(兼容配置文件)和 OpenGL 3.1(核心配置文件):

Mesa 10.1 was successfully installed. However, glxinfo, while it now reports that Mesa 10.1 is in use, still reports only OpenGL 3.0 (compat profile) and OpenGL 3.1 (core profile):

$ glxinfo | grep OpenGL
OpenGL vendor string: X.Org
OpenGL renderer string: Gallium 0.4 on AMD CAYMAN
OpenGL core profile version string: 3.1 (Core Profile) Mesa 10.1.0-devel (git-7f57408 saucy-oibaf-ppa+curaga)
OpenGL core profile shading language version string: 1.40
OpenGL core profile context flags: (none)
OpenGL core profile extensions:
OpenGL version string: 3.0 Mesa 10.1.0-devel (git-7f57408 saucy-oibaf-ppa+curaga)
OpenGL shading language version string: 1.30
OpenGL context flags: (none)
OpenGL extensions:

这是为什么?如何启用 OpenGL 3.3?通过比较可以看出 我提到的 StackOverflow 线程,有可能让 glxinfo 报告 OpenGL 3.3.我知道 glxinfo 可能会根据 Mesa 报告错误的版本号10.1 发行说明,但是我尝试运行的渲染引擎因此而失败.

Why is that? How can I enable OpenGL 3.3? As can be seen by comparison in the StackOverflow thread that I mentioned, it is possible to have glxinfo report OpenGL 3.3. I am aware that glxinfo may report the wrong version numbers as per the Mesa 10.1 Release Notes, however the rendering engine I'm trying to run fails because of this.

我使用以下代码生成一个窗口:

I use the following code to spawn a window:

glfwOpenWindowHint(GLFW_OPENGL_VERSION_MAJOR, 3);
glfwOpenWindowHint(GLFW_OPENGL_VERSION_MINOR, 3);
glfwOpenWindowHint(GLFW_OPENGL_PROFILE, 0);

if(GL_TRUE != glfwOpenWindow(
    _windowDimensions.x, _windowDimensions.y,
    0, 0, 0, 0, 32, 0, GLFW_WINDOW))
{
    THROW("GLFW error: failed to create window.");
}

当我尝试使用此设置运行渲染引擎时,由于不支持 OpenGL 3.3 会引发上述异常.我可以将 GLFW_OPENGL_VERSION_MINOR 设置为 0 然后窗口打开正常,但稍后会抛出异常,因为需要 GLSL 3.3 着色器.

When I try to run the rendering engine using this setup, the above exception gets thrown as OpenGL 3.3 is not supported. I can set GLFW_OPENGL_VERSION_MINOR to 0 and then the window opens fine, but an exception will be thrown later as GLSL 3.3 shaders are required.

另请注意,当我使用专有的 fglrx 驱动程序(然后 glxinfo 报告 OpenGL 版本 4.2)时,渲染引擎运行良好,因此应用程序本身确实不是问题,但支持的 OpenGL 是.

Also note that the rendering engine runs fine when I use the proprietary fglrx drivers (and then glxinfo reports OpenGL version 4.2), so the application itself really is not the problem, but the supported OpenGL is.

那我做错了什么?为什么 Mesa 10.1 不支持 OpenGL 3.3?我的显卡当然支持它.

So what am I doing wrong? Why doesn't Mesa 10.1 support OpenGL 3.3 for me? My graphics card certainly supports it.

这里有一些可能有用的附加信息.

Here's some additional information that may be useful.

$ apt-cache policy libgl1-mesa-glx
libgl1-mesa-glx:
  Installed: 10.1~git1402041945.7f5740+curaga~gd~s
  Candidate: 10.1~git1402041945.7f5740+curaga~gd~s
  Version table:
 *** 10.1~git1402041945.7f5740+curaga~gd~s 0
        500 http://ppa.launchpad.net/oibaf/graphics-drivers/ubuntu/ saucy/main amd64 Packages
        100 /var/lib/dpkg/status
     9.2.1-1ubuntu3 0
        500 http://archive.ubuntu.com/ubuntu/ saucy/main amd64 Packages


$ lspci -vv
...snip...
01:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Cayman PRO [Radeon HD 6950] (prog-if 00 [VGA controller])
    Subsystem: Hightech Information System Ltd. Device 2307
    Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx+
    Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
    Latency: 0, Cache Line Size: 64 bytes
    Interrupt: pin A routed to IRQ 53
    Region 0: Memory at c0000000 (64-bit, prefetchable) [size=256M]
    Region 2: Memory at fe620000 (64-bit, non-prefetchable) [size=128K]
    Region 4: I/O ports at e000 [size=256]
    Expansion ROM at fe600000 [disabled] [size=128K]
    Capabilities: <access denied>
    Kernel driver in use: radeon
...snip...


$ lsmod | egrep 'radeon|fglrx'
radeon               1402995  3
i2c_algo_bit           13413  1 radeon
ttm                    84169  1 radeon
drm_kms_helper         52710  1 radeon
drm                   297056  5 ttm,drm_kms_helper,radeon


$ modinfo radeon
filename:       /lib/modules/3.11.0-15-generic/kernel/drivers/gpu/drm/radeon/radeon.ko
license:        GPL and additional rights
description:    ATI Radeon
author:         Gareth Hughes, Keith Whitwell, others.
...snip...
firmware:       radeon/CAYMAN_smc.bin
firmware:       radeon/CAYMAN_rlc.bin
firmware:       radeon/CAYMAN_mc.bin
firmware:       radeon/CAYMAN_me.bin
firmware:       radeon/CAYMAN_pfp.bin
...snip...
srcversion:     D174B1E4686391B33437915
alias:          pci:v00001002d000099A4sv*sd*bc*sc*i*
alias:          pci:v00001002d000099A2sv*sd*bc*sc*i*
...snip...
depends:        drm,drm_kms_helper,ttm,i2c-algo-bit
intree:         Y
vermagic:       3.11.0-15-generic SMP mod_unload modversions 
parm:           no_wb:Disable AGP writeback for scratch registers (int)
parm:           modeset:Disable/Enable modesetting (int)
parm:           dynclks:Disable/Enable dynamic clocks (int)
parm:           r4xx_atom:Enable ATOMBIOS modesetting for R4xx (int)
parm:           vramlimit:Restrict VRAM for testing (int)
parm:           agpmode:AGP Mode (-1 == PCI) (int)
parm:           gartsize:Size of PCIE/IGP gart to setup in megabytes (32, 64, etc) (int)
parm:           benchmark:Run benchmark (int)
parm:           test:Run tests (int)
parm:           connector_table:Force connector table (int)
parm:           tv:TV enable (0 = disable) (int)
parm:           audio:Audio enable (1 = enable) (int)
parm:           disp_priority:Display Priority (0 = auto, 1 = normal, 2 = high) (int)
parm:           hw_i2c:hw i2c engine enable (0 = disable) (int)
parm:           pcie_gen2:PCIE Gen2 mode (-1 = auto, 0 = disable, 1 = enable) (int)
parm:           msi:MSI support (1 = enable, 0 = disable, -1 = auto) (int)
parm:           lockup_timeout:GPU lockup timeout in ms (defaul 10000 = 10 seconds, 0 = disable) (int)
parm:           fastfb:Direct FB access for IGP chips (0 = disable, 1 = enable) (int)
parm:           dpm:DPM support (1 = enable, 0 = disable, -1 = auto) (int)
parm:           aspm:ASPM support (1 = enable, 0 = disable, -1 = auto) (int)


$ dpkg -S /lib/modules/3.11.0-15-generic/kernel/drivers/gpu/drm/radeon/radeon.ko
linux-image-extra-3.11.0-15-generic: /lib/modules/3.11.0-15-generic/kernel/drivers/gpu/drm/radeon/radeon.ko


$ apt-cache policy linux-image-extra-3.11.0-15-generic
linux-image-extra-3.11.0-15-generic:
  Installed: 3.11.0-15.25
  Candidate: 3.11.0-15.25
  Version table:
 *** 3.11.0-15.25 0
        500 http://archive.ubuntu.com/ubuntu/ saucy-updates/main amd64 Packages
        500 http://archive.ubuntu.com/ubuntu/ saucy-security/main amd64 Packages
        100 /var/lib/dpkg/status

推荐答案

他们没有告诉你,而是间接暗示了什么(一些驱动程序不支持 OpenGL 3.3 中所需的所有功能."),是在 Mesa (10.0) 的最后一个官方发布中,GL 3.3 仅适用于 Intel 硬件.这是英特尔密切参与 Mesa 项目的乐趣之一.如果您想在 AMD 硬件上以任何形式获得可靠的 GL 3.3 支持,您应该暂时使用 fglrx(专有的 AMD 驱动程序).

What they do not tell you, but indirectly imply ("Some drivers don't support all the features required in OpenGL 3.3."), is that in the last official release of Mesa (10.0), GL 3.3 only works on Intel hardware. This is one of the joys of Intel's close involvement with the Mesa project. If you want reliable GL 3.3 support in any form on AMD hardware, you should use fglrx (the proprietary AMD driver) for the time being.

Mesa 10.1 的开发版本可能会在 radeon 驱动程序上实现 GL 3.3,但您需要申请 3.3 核心配置文件.您目前没有这样做.

The development release of Mesa 10.1 may implement GL 3.3 on radeon drivers, but you need to request a 3.3 core profile. You are not doing this currently.

glfwOpenWindowHint(GLFW_OPENGL_PROFILE, 0);

实际上需要是这样的:

glfwOpenWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);

<小时>

此外,没有 GL 3.0 兼容性配置文件或 3.1 核心配置文件之类的东西.配置文件直到 3.2 才被引入 OpenGL.在 GL 3.1 中有 GL_ARB_compatibility 的概念,但这与配置文件不同;glxinfo 提供误导性信息.


Also, there is no such thing as a GL 3.0 compatibility profile or 3.1 core profile. Profiles were not introduced into OpenGL until 3.2. There is a concept of GL_ARB_compatibility in GL 3.1, but that is not the same thing as a profile; glxinfo is giving misleading information.

这篇关于如何在 Ubuntu 上使用 Mesa 10.1 启用 OpenGL 3.3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆