mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1233819 - Fix WebGL on WinXP. - r=jrmuizel
This commit is contained in:
parent
f8897884d2
commit
e9a675dbb6
@ -7,7 +7,7 @@
|
|||||||
TEST_DIRS += ['compiledtest']
|
TEST_DIRS += ['compiledtest']
|
||||||
|
|
||||||
# Number changes to this file to avoid bug 1081323 (clobber after changing a manifest):
|
# Number changes to this file to avoid bug 1081323 (clobber after changing a manifest):
|
||||||
# 2
|
# 3
|
||||||
|
|
||||||
MOCHITEST_MANIFESTS += [
|
MOCHITEST_MANIFESTS += [
|
||||||
'test/crossorigin/mochitest.ini',
|
'test/crossorigin/mochitest.ini',
|
||||||
|
@ -30,13 +30,13 @@ skip-if = android_version == '10' || android_version == '18' #Android 2.3 and 4.
|
|||||||
[webgl-mochitest/test_texsubimage_float.html]
|
[webgl-mochitest/test_texsubimage_float.html]
|
||||||
[webgl-mochitest/test_uninit_data.html]
|
[webgl-mochitest/test_uninit_data.html]
|
||||||
[webgl-mochitest/test_webgl_available.html]
|
[webgl-mochitest/test_webgl_available.html]
|
||||||
skip-if = toolkit == 'android' #bug 865443- seperate suite - the non_conf* tests pass except for one on armv6 tests
|
|
||||||
#[webgl-mochitest/test_webgl_color_buffer_float.html]
|
#[webgl-mochitest/test_webgl_color_buffer_float.html]
|
||||||
# We haven't cleaned up the Try results yet, but let's get this on the books first.
|
# We haven't cleaned up the Try results yet, but let's get this on the books first.
|
||||||
[webgl-mochitest/test_webgl_conformance.html]
|
[webgl-mochitest/test_webgl_conformance.html]
|
||||||
skip-if = toolkit == 'android' #bug 865443- seperate suite - the non_conf* tests pass except for one on armv6 tests
|
skip-if = toolkit == 'android' #bug 865443- seperate suite - the non_conf* tests pass except for one on armv6 tests
|
||||||
[webgl-mochitest/test_webgl_compressed_texture_es3.html]
|
[webgl-mochitest/test_webgl_compressed_texture_es3.html]
|
||||||
[webgl-mochitest/test_webgl_disjoint_timer_query.html]
|
[webgl-mochitest/test_webgl_disjoint_timer_query.html]
|
||||||
|
[webgl-mochitest/test_webgl_force_enable.html]
|
||||||
[webgl-mochitest/test_webgl_request_context.html]
|
[webgl-mochitest/test_webgl_request_context.html]
|
||||||
skip-if = toolkit == 'android' #bug 865443- seperate suite - the non_conf* tests pass except for one on armv6 tests
|
skip-if = toolkit == 'android' #bug 865443- seperate suite - the non_conf* tests pass except for one on armv6 tests
|
||||||
[webgl-mochitest/test_webgl_request_mismatch.html]
|
[webgl-mochitest/test_webgl_request_mismatch.html]
|
||||||
|
@ -1,50 +1,19 @@
|
|||||||
<!DOCTYPE HTML>
|
<!DOCTYPE HTML>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>WebGL test: Check that WebGL works (or not) if it should (or should not).</title>
|
<meta charset='utf-8'/>
|
||||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
<title>WebGL test: Check that WebGL works out-of-the-box.</title>
|
||||||
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
|
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||||
<script src="webgl-util.js"></script>
|
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
|
||||||
<script src="driver-info.js"></script>
|
</head>
|
||||||
</head>
|
<body>
|
||||||
<body>
|
<script>
|
||||||
<canvas id="c"></canvas>
|
|
||||||
<script>
|
|
||||||
|
|
||||||
function test() {
|
'use strict';
|
||||||
ok(SpecialPowers.getBoolPref('webgl.force-enabled'), 'WebGL should be force-enabled.');
|
var c = document.createElement('canvas');
|
||||||
|
var gl = c.getContext('experimental-webgl');
|
||||||
|
ok(gl, 'Expected WebGL creation to succeed.');
|
||||||
|
|
||||||
var shouldSucceed = true;
|
</script>
|
||||||
var shouldFail = false;
|
</body>
|
||||||
|
|
||||||
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.');
|
|
||||||
}
|
|
||||||
|
|
||||||
SimpleTest.finish();
|
|
||||||
}
|
|
||||||
|
|
||||||
SimpleTest.waitForExplicitFinish();
|
|
||||||
|
|
||||||
var prefArrArr = [
|
|
||||||
['webgl.force-enabled', true]
|
|
||||||
];
|
|
||||||
var prefEnv = {'set': prefArrArr};
|
|
||||||
SpecialPowers.pushPrefEnv(prefEnv, test);
|
|
||||||
|
|
||||||
</script>
|
|
||||||
</body>
|
|
||||||
</html>
|
</html>
|
||||||
|
50
dom/canvas/test/webgl-mochitest/test_webgl_force_enable.html
Normal file
50
dom/canvas/test/webgl-mochitest/test_webgl_force_enable.html
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
<!DOCTYPE HTML>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>WebGL test: Check that WebGL works (or not) if it should (or should not).</title>
|
||||||
|
<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>
|
||||||
|
|
||||||
|
function test() {
|
||||||
|
ok(SpecialPowers.getBoolPref('webgl.force-enabled'), 'WebGL should be force-enabled.');
|
||||||
|
|
||||||
|
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.');
|
||||||
|
}
|
||||||
|
|
||||||
|
SimpleTest.finish();
|
||||||
|
}
|
||||||
|
|
||||||
|
SimpleTest.waitForExplicitFinish();
|
||||||
|
|
||||||
|
var prefArrArr = [
|
||||||
|
['webgl.force-enabled', true]
|
||||||
|
];
|
||||||
|
var prefEnv = {'set': prefArrArr};
|
||||||
|
SpecialPowers.pushPrefEnv(prefEnv, test);
|
||||||
|
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -153,6 +153,34 @@ GetAndInitDisplay(GLLibraryEGL& egl, void* displayType)
|
|||||||
return display;
|
return display;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static EGLDisplay
|
||||||
|
GetAndInitDisplayForAccelANGLE(GLLibraryEGL& egl)
|
||||||
|
{
|
||||||
|
EGLDisplay ret = 0;
|
||||||
|
|
||||||
|
// D3D11 ANGLE only works with OMTC; there's a bug in the non-OMTC layer
|
||||||
|
// manager, and it's pointless to try to fix it. We also don't try
|
||||||
|
// D3D11 ANGLE if the layer manager is prefering D3D9 (hrm, do we care?)
|
||||||
|
if (gfxPrefs::LayersOffMainThreadCompositionEnabled() &&
|
||||||
|
!gfxPrefs::LayersPreferD3D9())
|
||||||
|
{
|
||||||
|
if (gfxPrefs::WebGLANGLEForceD3D11())
|
||||||
|
return GetAndInitDisplay(egl, LOCAL_EGL_D3D11_ONLY_DISPLAY_ANGLE);
|
||||||
|
|
||||||
|
if (gfxPrefs::WebGLANGLETryD3D11() &&
|
||||||
|
gfxPlatform::CanUseDirect3D11ANGLE())
|
||||||
|
{
|
||||||
|
ret = GetAndInitDisplay(egl, LOCAL_EGL_D3D11_ELSE_D3D9_DISPLAY_ANGLE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ret) {
|
||||||
|
ret = GetAndInitDisplay(egl, EGL_DEFAULT_DISPLAY);
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
GLLibraryEGL::ReadbackEGLImage(EGLImage image, gfx::DataSourceSurface* out_surface)
|
GLLibraryEGL::ReadbackEGLImage(EGLImage image, gfx::DataSourceSurface* out_surface)
|
||||||
{
|
{
|
||||||
@ -367,30 +395,14 @@ GLLibraryEGL::EnsureInitialized(bool forceAccel)
|
|||||||
|
|
||||||
if (!chosenDisplay) {
|
if (!chosenDisplay) {
|
||||||
// If falling back to WARP did not work and we don't want to try
|
// If falling back to WARP did not work and we don't want to try
|
||||||
// using HW accelerated ANGLE, then fail
|
// using HW accelerated ANGLE, then fail.
|
||||||
if (!shouldTryAccel) {
|
if (!shouldTryAccel) {
|
||||||
NS_ERROR("Fallback WARP ANGLE context failed to initialize.");
|
NS_ERROR("Fallback WARP ANGLE context failed to initialize.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Hardware accelerated ANGLE path
|
// Hardware accelerated ANGLE path
|
||||||
|
chosenDisplay = GetAndInitDisplayForAccelANGLE(*this);
|
||||||
// D3D11 ANGLE only works with OMTC; there's a bug in the non-OMTC layer
|
|
||||||
// manager, and it's pointless to try to fix it. We also don't try
|
|
||||||
// D3D11 ANGLE if the layer manager is prefering D3D9 (hrm, do we care?)
|
|
||||||
if (gfxPrefs::LayersOffMainThreadCompositionEnabled() &&
|
|
||||||
!gfxPrefs::LayersPreferD3D9())
|
|
||||||
{
|
|
||||||
if (gfxPrefs::WebGLANGLEForceD3D11()) {
|
|
||||||
chosenDisplay = GetAndInitDisplay(*this,
|
|
||||||
LOCAL_EGL_D3D11_ONLY_DISPLAY_ANGLE);
|
|
||||||
} else if (gfxPrefs::WebGLANGLETryD3D11() &&
|
|
||||||
gfxPlatform::CanUseDirect3D11ANGLE())
|
|
||||||
{
|
|
||||||
chosenDisplay = GetAndInitDisplay(*this,
|
|
||||||
LOCAL_EGL_D3D11_ELSE_D3D9_DISPLAY_ANGLE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
chosenDisplay = GetAndInitDisplay(*this, EGL_DEFAULT_DISPLAY);
|
chosenDisplay = GetAndInitDisplay(*this, EGL_DEFAULT_DISPLAY);
|
||||||
|
Loading…
Reference in New Issue
Block a user