问题描述
我使用Ubuntu Linux,并且我明白Mesa GL驱动程序可以被强制使用在启动程序时通过指定环境变量来使用软件实现。我确认驱动程序在指定env var时发生了变化。
bash $ glxinfo | grep -iopengl
OpenGL供应商字符串:Intel开源技术中心
OpenGL渲染字符串:Mesa DRI Intel(R)945GM x86 / MMX / SSE2
OpenGL版本字符串:1.4 Mesa 10.1 .3
OpenGL扩展:
bash $ LIBGL_ALWAYS_SOFTWARE = 1 glxinfo | grep -iopengl
OpenGL供应商字符串:VMware,Inc.
OpenGL渲染字符串:llvmpipe上的Gallium 0.4(LLVM 3.4,128位)
OpenGL版本字符串:2.1 Mesa 10.1.3
OpenGL着色语言版本字符串:1.30
OpenGL扩展:
默认的GL驱动程序提供OpenGL 1.4支持,而软件驱动程序提供OpenGL 2.1支持。
我跟踪了桌面启动程序的存在位置(/ usr / share / applications /)并编辑它以指定env var,但chrome:// gpu仍显示GL版本1.4。 Chrome GPU信息包含一个有前景的价值:
命令行参数--flag-switches-begin --disable-accelerated-2d-canvas --ignore-gpu-blacklist --flag-switches-end
不知我是否可以自定义--flag-switches-begin。
我还发现'--use-gl' ,但我不确定如何利用它来强制驱动程序进入软件模式。
作为一个方面说明,我已经在chrome:// flags /中启用了'Override software rendering list',它从''使得使用WebGL成为可能,但OpenGL功能集仍然非常有限。
我有一台带有可怕'gpu'的旧笔记本电脑我想用于开发一些着色器并在WebGL中进行测试,无论性能如何。
是否可以告诉Chrome使用软件驱动程序?
我没有Linux盒子,所以我无法检查,但您可以指定chrome用于启动GPU进程的前缀
- gpu-launcher =< prefix>
通常用于调试
- gpu-launcher =xterm -e gdb --args
当chrome启动一个进程时,它会调用spawn。通常它只是启动
path / to / chrome<各种标志>
- gpu-launcher
让您添加一个前缀。例如
--gpu-launcher = / usr / local / yourname / launch.sh
可以让它产卵
/usr/local/yourname/launch.sh path / to / chrome<各种标志>
现在可以使/usr/local/yourname/launch.sh做任何你想做的事情,并最终启动铬。最简单的方法就是像
#!/ bin / sh
$ @
code>
在你的情况下,我猜你会想要
#!/ bin / sh
export LIBGL_ALWAYS_SOFTWARE = 1
$ @
请务必将 launch.sh
标记为可执行文件。
给出了这个脚本以上的脚本
/ opt / google / chrome / chrome - ignore-gpu-blacklist --gpu-launcher = / usr / local / gman / launch.sh
之后 about:gpu
给我
GL_VENDOR VMware,Inc. $
GL_RENDERER Gallium 0.4 on llvmpipe(LLVM 0x301)
GL_VERSION 2.1 Mesa 9.0.3
I want to force chrome to render WebGL using software drivers, not hardware.
I'm using Ubuntu Linux and I understand that the Mesa GL drivers can be forced to use a software implementation by specifying the environment variable, LIBGL_ALWAYS_SOFTWARE=1, when launching a program. I confirmed that the driver changes when specifying the env var.
bash$ glxinfo | grep -i "opengl"
OpenGL vendor string: Intel Open Source Technology Center
OpenGL renderer string: Mesa DRI Intel(R) 945GM x86/MMX/SSE2
OpenGL version string: 1.4 Mesa 10.1.3
OpenGL extensions:
bash$ LIBGL_ALWAYS_SOFTWARE=1 glxinfo | grep -i "opengl"
OpenGL vendor string: VMware, Inc.
OpenGL renderer string: Gallium 0.4 on llvmpipe (LLVM 3.4, 128 bits)
OpenGL version string: 2.1 Mesa 10.1.3
OpenGL shading language version string: 1.30
OpenGL extensions:
The default GL driver provides OpenGL 1.4 support, and the software driver provides OpenGL 2.1 support.
I tracked down where the desktop launcher exists (/usr/share/applications/) and edited it to specify the env var, but chrome://gpu still shows GL version 1.4. The Chrome GPU info contains a promising value:
Command Line Args --flag-switches-begin --disable-accelerated-2d-canvas --ignore-gpu-blacklist --flag-switches-end
I wonder if I can customize the --flag-switches-begin.
I also found the '--use-gl' command line switch, but I'm not sure how to leverage it to force the driver into software mode.
As a side note, I have already enabled 'Override software rendering list' in chrome://flags/, which did remove my model from the 'blacklist' making it possible to use WebGL, but the OpenGL feature set is still quite limited.
I have an old laptop with a terrible 'gpu' that I would like to use to develop some shaders and test in WebGL, no matter the performance.
Is it possible to tell Chrome to use the software drivers?
I don't have a linux box so I can't check but you can specify a prefix chrome will use for launching the GPU process with
--gpu-launcher=<prefix>
It's normally used for debugging for example
--gpu-launcher="xterm -e gdb --args"
When chrome launches a process it calls spawn. Normally it just launches
path/to/chrome <various flags>
--gpu-launcher
lets you add a prefix to that. So for example
--gpu-launcher=/usr/local/yourname/launch.sh
would make it spawn
/usr/local/yourname/launch.sh path/to/chrome <various flags>
You can now make /usr/local/yourname/launch.sh do whatever you want and finally launch chrome. The simplest would be something like
#!/bin/sh
"$@"
In your case I'd guess you'd want
#!/bin/sh
export LIBGL_ALWAYS_SOFTWARE=1
"$@"
Be sure to mark launch.sh
as executable.
given the script above this worked for me
/opt/google/chrome/chrome --ignore-gpu-blacklist --gpu-launcher=/usr/local/gman/launch.sh
after which about:gpu
gives me
GL_VENDOR VMware, Inc.
GL_RENDERER Gallium 0.4 on llvmpipe (LLVM 0x301)
GL_VERSION 2.1 Mesa 9.0.3
这篇关于如何强制chrome为webgl使用mesa软件驱动程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!