mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 877048 - Factor getting driver info out into a self-contained function for mochitest-gl. - r=bjacob
This commit is contained in:
parent
a77fe13461
commit
cdacc980ee
@ -44,7 +44,7 @@ var OPTIONS = {
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
function detectDriverType() {
|
||||
function detectDriverInfo() {
|
||||
const Cc = SpecialPowers.Cc;
|
||||
const Ci = SpecialPowers.Ci;
|
||||
var doc = Cc["@mozilla.org/xmlextras/domparser;1"].createInstance(Ci.nsIDOMParser).parseFromString("<html/>", "text/html");
|
||||
@ -57,24 +57,19 @@ function detectDriverType() {
|
||||
var gl;
|
||||
try {
|
||||
gl = canvas.getContext("experimental-webgl");
|
||||
} catch(e) {}
|
||||
|
||||
if (gl) {
|
||||
var ext = gl.getExtension("WEBGL_debug_renderer_info");
|
||||
// this extension is unconditionally available to chrome. No need to check.
|
||||
var webglRenderer = gl.getParameter(ext.UNMASKED_RENDERER_WEBGL);
|
||||
var webglVendor = gl.getParameter(ext.UNMASKED_VENDOR_WEBGL);
|
||||
if (webglRenderer.contains('llvmpipe')) {
|
||||
type = "mesa";
|
||||
} else if (webglVendor.contains('NVIDIA')) {
|
||||
type = "nvidia";
|
||||
}
|
||||
} catch(e) {
|
||||
ok(false, "Failed to create a WebGL context for getting driver info.");
|
||||
return ["", ""]
|
||||
}
|
||||
return type;
|
||||
var ext = gl.getExtension("WEBGL_debug_renderer_info");
|
||||
// this extension is unconditionally available to chrome. No need to check.
|
||||
|
||||
var webglRenderer = gl.getParameter(ext.UNMASKED_RENDERER_WEBGL);
|
||||
var webglVendor = gl.getParameter(ext.UNMASKED_VENDOR_WEBGL);
|
||||
return [webglVendor, webglRenderer];
|
||||
}
|
||||
|
||||
function start() {
|
||||
|
||||
var kIsWindows = false;
|
||||
var kIsAndroid = false;
|
||||
var kIsLinux = false;
|
||||
@ -87,10 +82,12 @@ function start() {
|
||||
kIsAndroid = true;
|
||||
else if (navigator.platform.indexOf("Linux") == 0) {
|
||||
// must be checked after android, as android also has a 'Linux' platform string
|
||||
var type = detectDriverType();
|
||||
if (type == "mesa") {
|
||||
var webglVendor, webglRenderer;
|
||||
[webglVendor, webglRenderer] = detectDriverInfo();
|
||||
|
||||
if (webglRenderer.contains('llvmpipe')) {
|
||||
kIsLinuxMesa = true;
|
||||
} else if (type == "nvidia") {
|
||||
} else if (webglVendor.contains('NVIDIA')) {
|
||||
kIsLinuxNVidia = true;
|
||||
} else {
|
||||
kIsLinux = true;
|
||||
|
Loading…
Reference in New Issue
Block a user