mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Backed out 2 changesets (bug 911346)
Backed out changeset 6255c31609be (bug 911346) Backed out changeset cae77be484b9 (bug 911346)
This commit is contained in:
parent
4ece4c94d3
commit
47008ee7d0
@ -4,10 +4,6 @@
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
MOCHITEST_FILES = \
|
||||
driver-info.js \
|
||||
webgl-util.js \
|
||||
\
|
||||
test_webgl_available.html \
|
||||
test_webgl_conformance.html \
|
||||
test_webgl_request_mismatch.html \
|
||||
$(NULL)
|
||||
|
@ -1,125 +0,0 @@
|
||||
DriverInfo = (function() {
|
||||
// ---------------------------------------------------------------------------
|
||||
// Debug info handling
|
||||
|
||||
function defaultInfoFunc(str) {
|
||||
console.log('Info: ' + str);
|
||||
}
|
||||
|
||||
var gInfoFunc = defaultInfoFunc;
|
||||
function setInfoFunc(func) {
|
||||
gInfoFunc = func;
|
||||
}
|
||||
|
||||
function info(str) {
|
||||
gInfoFunc(str);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// OS and driver identification
|
||||
// Stolen from content/canvas/test/webgl/test_webgl_conformance_test_suite.html
|
||||
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");
|
||||
|
||||
var canvas = doc.createElement("canvas");
|
||||
canvas.width = 1;
|
||||
canvas.height = 1;
|
||||
|
||||
var type = "";
|
||||
var gl;
|
||||
try {
|
||||
gl = canvas.getContext("experimental-webgl");
|
||||
} catch(e) {
|
||||
ok(false, "Failed to create a WebGL context for getting driver info.");
|
||||
return ["", ""]
|
||||
}
|
||||
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];
|
||||
}
|
||||
|
||||
var OS = {
|
||||
WINDOWS: 'windows',
|
||||
MAC: 'mac',
|
||||
LINUX: 'linux',
|
||||
ANDROID: 'android',
|
||||
};
|
||||
|
||||
var DRIVER = {
|
||||
MESA: 'mesa',
|
||||
NVIDIA: 'nvidia',
|
||||
ANDROID_X86_EMULATOR: 'android x86 emulator',
|
||||
};
|
||||
|
||||
var kOS = null;
|
||||
var kOSVersion = null;
|
||||
var kDriver = null;
|
||||
|
||||
if (navigator.platform.indexOf('Win') == 0) {
|
||||
kOS = OS.WINDOWS;
|
||||
|
||||
// code borrowed from browser/modules/test/browser_taskbar_preview.js
|
||||
var version = SpecialPowers.Services.sysinfo.getProperty('version');
|
||||
kOSVersion = parseFloat(version);
|
||||
// Version 6.0 is Vista, 6.1 is 7.
|
||||
|
||||
} else if (navigator.platform.indexOf('Mac') == 0) {
|
||||
kOS = OS.MAC;
|
||||
|
||||
var versionMatch = /Mac OS X (\d+.\d+)/.exec(navigator.userAgent);
|
||||
kOSVersion = versionMatch ? parseFloat(versionMatch[1]) : null;
|
||||
|
||||
} else if (navigator.appVersion.indexOf('Android') != -1) {
|
||||
kOS = OS.ANDROID;
|
||||
// From layout/tools/reftest/reftest.js:
|
||||
kOSVersion = SpecialPowers.Services.sysinfo.getProperty('version');
|
||||
|
||||
} else if (navigator.platform.indexOf('Linux') == 0) {
|
||||
// Must be checked after android, as android also has a 'Linux' platform string.
|
||||
kOS = OS.LINUX;
|
||||
}
|
||||
|
||||
var glVendor, glRenderer;
|
||||
[glVendor, glRenderer] = detectDriverInfo();
|
||||
info('GL vendor: ' + glVendor);
|
||||
info('GL renderer: ' + glRenderer);
|
||||
|
||||
if (glRenderer.contains('llvmpipe')) {
|
||||
kDriver = DRIVER.MESA;
|
||||
} else if (glRenderer.contains('Android Emulator')) {
|
||||
kGLDriver = DRIVER.ANDROID_X86_EMULATOR;
|
||||
} else if (glVendor.contains('NVIDIA')) {
|
||||
kDriver = DRIVER.NVIDIA;
|
||||
}
|
||||
|
||||
if (kOS) {
|
||||
info('OS detected as: ' + kOS);
|
||||
info(' Version: ' + kOSVersion);
|
||||
} else {
|
||||
info('OS not detected.');
|
||||
info(' `platform`: ' + navigator.platform);
|
||||
info(' `appVersion`: ' + navigator.appVersion);
|
||||
info(' `userAgent`: ' + navigator.userAgent);
|
||||
}
|
||||
if (kDriver) {
|
||||
info('GL driver detected as: ' + kDriver);
|
||||
} else {
|
||||
info('GL driver not detected.');
|
||||
}
|
||||
|
||||
return {
|
||||
setInfoFunc: setInfoFunc,
|
||||
|
||||
OS: OS,
|
||||
DRIVER: DRIVER,
|
||||
getOS: function() { return kOS; },
|
||||
getDriver: function() { return kDriver; },
|
||||
getOSVersion: function() { return kOSVersion; },
|
||||
};
|
||||
})();
|
||||
|
@ -1,37 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>WebGL test: Check that WebGL works (or not) if it should (or should not).</title>
|
||||
<script src="/MochiKit/MochiKit.js"></script>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
|
||||
<script src="webgl-util.js"></script>
|
||||
<script src="driver-info.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<canvas id="c"></canvas>
|
||||
<script>
|
||||
|
||||
var shouldSucceed = true;
|
||||
var shouldFail = false;
|
||||
|
||||
if (DriverInfo.getOS() == DriverInfo.OS.ANDROID &&
|
||||
DriverInfo.getOSVersion() < 15)
|
||||
{
|
||||
// Consider 'random'. Actually, ARMv6 fails, and ARMv7 succeeds, but we have
|
||||
// not been successful at determining this from JS. (see bug 917478)
|
||||
shouldSucceed = false;
|
||||
shouldFail = false;
|
||||
}
|
||||
|
||||
var gl = WebGLUtil.getWebGL('c');
|
||||
if (shouldSucceed) {
|
||||
ok(gl, 'Expected WebGL creation to succeed.');
|
||||
}
|
||||
if (shouldFail) {
|
||||
ok(!gl, 'Expected WebGL creation to fail.');
|
||||
}
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -1,17 +1,14 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>WebGL test: 'webgl' context request</title>
|
||||
<script src="/MochiKit/MochiKit.js"></script>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
|
||||
<script src="webgl-util.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<canvas id="c"></canvas>
|
||||
<script>
|
||||
|
||||
var gl = WebGLUtil.getWebGL('c', true);
|
||||
var canvas = document.getElementById('c');
|
||||
var gl = canvas.getContext('webgl');
|
||||
|
||||
var isMobile = /Mobile/.test(navigator.userAgent);
|
||||
var isTablet = /Tablet/.test(navigator.userAgent);
|
||||
@ -26,5 +23,4 @@ if (shouldBeConformant) {
|
||||
}
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
@ -1,114 +0,0 @@
|
||||
WebGLUtil = (function() {
|
||||
// ---------------------------------------------------------------------------
|
||||
// Error handling
|
||||
|
||||
function defaultErrorFunc(str) {
|
||||
console.log('Error: ' + str);
|
||||
}
|
||||
|
||||
var gErrorFunc = defaultErrorFunc;
|
||||
function setErrorFunc(func) {
|
||||
gErrorFunc = func;
|
||||
}
|
||||
|
||||
function error(str) {
|
||||
gErrorFunc(str);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// WebGL helpers
|
||||
|
||||
function getWebGL(canvasId, requireConformant) {
|
||||
// `requireConformant` will default to falsey if it is not supplied.
|
||||
|
||||
var canvas = document.getElementById(canvasId);
|
||||
|
||||
var gl = null;
|
||||
try {
|
||||
gl = canvas.getContext('webgl');
|
||||
} catch(e) {}
|
||||
|
||||
if (!gl && !requireConformant) {
|
||||
try {
|
||||
gl = canvas.getContext('experimental-webgl');
|
||||
} catch(e) {}
|
||||
}
|
||||
|
||||
if (!gl) {
|
||||
error('WebGL context could not be retrieved from \'' + canvasId + '\'.');
|
||||
return null;
|
||||
}
|
||||
|
||||
return gl;
|
||||
}
|
||||
|
||||
function getContentFromElem(elem) {
|
||||
var str = "";
|
||||
var k = elem.firstChild;
|
||||
while (k) {
|
||||
if (k.nodeType == 3)
|
||||
str += k.textContent;
|
||||
|
||||
k = k.nextSibling;
|
||||
}
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
// Returns a valid shader, or null on errors.
|
||||
function createShaderById(gl, id) {
|
||||
var elem = document.getElementById(id);
|
||||
if (!elem) {
|
||||
error('Failed to create shader from non-existent id \'' + id + '\'.');
|
||||
return null;
|
||||
}
|
||||
|
||||
var src = getContentById(id);
|
||||
|
||||
var shader;
|
||||
if (elem.type == "x-shader/x-fragment") {
|
||||
shader = gl.createShader(gl.FRAGMENT_SHADER);
|
||||
} else if (shaderScript.type == "x-shader/x-vertex") {
|
||||
shader = gl.createShader(gl.VERTEX_SHADER);
|
||||
} else {
|
||||
error('Bad MIME type for shader \'' + id + '\': ' + elem.type + '.');
|
||||
return null;
|
||||
}
|
||||
|
||||
gl.shaderSource(shader, str);
|
||||
gl.compileShader(shader);
|
||||
|
||||
return shader;
|
||||
}
|
||||
|
||||
function createProgramByIds(gl, vsId, fsId) {
|
||||
var vs = createShaderById(gl, vsId);
|
||||
var fs = createShaderById(gl, fsId);
|
||||
if (!vs || !fs)
|
||||
return null;
|
||||
|
||||
var prog = gl.createProgram();
|
||||
gl.attachShader(prog, vs);
|
||||
gl.attachShader(prog, fs);
|
||||
gl.linkProgram(prog);
|
||||
|
||||
if (!gl.getProgramParameter(prog, gl.LINK_STATUS)) {
|
||||
var str = "Shader program linking failed:\n";
|
||||
str += "Shader program info log:\n" + gl.getProgramInfoLog(prog) + "\n\n";
|
||||
str += "Vert shader log:\n" + gl.getShaderInfoLog(vs) + "\n\n";
|
||||
str += "Frag shader log:\n" + gl.getShaderInfoLog(fs);
|
||||
error(str);
|
||||
return null;
|
||||
}
|
||||
|
||||
return prog;
|
||||
}
|
||||
|
||||
return {
|
||||
setErrorFunc: setErrorFunc,
|
||||
|
||||
getWebGL: getWebGL,
|
||||
createShaderById: createShaderById,
|
||||
createProgramByIds: createProgramByIds,
|
||||
};
|
||||
})();
|
Loading…
Reference in New Issue
Block a user