зеркало из https://github.com/mozilla/pjs.git
Bug 695912: implemented antialiasing blocklisting r=jgilbert
Antialiasing can be blocked through the downloaded blocklist now, as well as static analysis compiled into the OS-specific handlers for graphics features.
This commit is contained in:
Родитель
9338fb61c6
Коммит
cfc950a541
|
@ -608,9 +608,14 @@ WebGLContext::SetDimensions(PRInt32 width, PRInt32 height)
|
|||
format.minAlpha = 0;
|
||||
}
|
||||
|
||||
if (mOptions.antialias) {
|
||||
PRUint32 msaaLevel = Preferences::GetUint("webgl.msaa-level", 2);
|
||||
format.samples = msaaLevel*msaaLevel;
|
||||
PRInt32 status;
|
||||
nsCOMPtr<nsIGfxInfo> gfxInfo = do_GetService("@mozilla.org/gfx/info;1");
|
||||
if (mOptions.antialias &&
|
||||
NS_SUCCEEDED(gfxInfo->GetFeatureStatus(nsIGfxInfo::FEATURE_WEBGL_MSAA, &status))) {
|
||||
if (status == nsIGfxInfo::FEATURE_NO_INFO) {
|
||||
PRUint32 msaaLevel = Preferences::GetUint("webgl.msaa-level", 2);
|
||||
format.samples = msaaLevel*msaaLevel;
|
||||
}
|
||||
}
|
||||
|
||||
if (PR_GetEnv("MOZ_WEBGL_PREFER_EGL")) {
|
||||
|
@ -621,9 +626,7 @@ WebGLContext::SetDimensions(PRInt32 width, PRInt32 height)
|
|||
bool useOpenGL = true;
|
||||
bool useANGLE = true;
|
||||
|
||||
nsCOMPtr<nsIGfxInfo> gfxInfo = do_GetService("@mozilla.org/gfx/info;1");
|
||||
if (gfxInfo && !forceEnabled) {
|
||||
PRInt32 status;
|
||||
if (NS_SUCCEEDED(gfxInfo->GetFeatureStatus(nsIGfxInfo::FEATURE_WEBGL_OPENGL, &status))) {
|
||||
if (status != nsIGfxInfo::FEATURE_NO_INFO) {
|
||||
useOpenGL = false;
|
||||
|
|
|
@ -579,7 +579,6 @@ GLContextProviderCGL::CreateOffscreen(const gfxIntSize& aSize,
|
|||
const ContextFormat& aFormat)
|
||||
{
|
||||
ContextFormat actualFormat(aFormat);
|
||||
actualFormat.samples = 0;
|
||||
|
||||
nsRefPtr<GLContextCGL> glContext;
|
||||
|
||||
|
|
|
@ -108,6 +108,8 @@ interface nsIGfxInfo : nsISupports
|
|||
const long FEATURE_WEBGL_OPENGL = 6;
|
||||
/* Whether WebGL is supported via ANGLE (D3D9 -- does not check for the presence of ANGLE libs). */
|
||||
const long FEATURE_WEBGL_ANGLE = 7;
|
||||
/* Whether WebGL antialiasing is supported. */
|
||||
const long FEATURE_WEBGL_MSAA = 8;
|
||||
|
||||
/*
|
||||
* A set of return values from GetFeatureStatus
|
||||
|
|
|
@ -358,6 +358,12 @@ static GfxDriverInfo gDriverInfo[] = {
|
|||
// GfxDriverInfo::vendorATI, GfxDriverInfo::allDevices,
|
||||
// GfxDriverInfo::allFeatures, nsIGfxInfo::FEATURE_BLOCKED_OS_VERSION)
|
||||
|
||||
// Block all ATI cards from using MSAA, except for two devices that have
|
||||
// special exceptions in the GetFeatureStatusImpl() function.
|
||||
IMPLEMENT_MAC_DRIVER_BLOCKLIST(DRIVER_OS_ALL,
|
||||
GfxDriverInfo::vendorATI, GfxDriverInfo::allDevices,
|
||||
nsIGfxInfo::FEATURE_WEBGL_MSAA, nsIGfxInfo::FEATURE_BLOCKED_OS_VERSION)
|
||||
|
||||
GfxDriverInfo()
|
||||
};
|
||||
|
||||
|
@ -466,6 +472,16 @@ GfxInfo::GetFeatureStatusImpl(PRInt32 aFeature,
|
|||
status = nsIGfxInfo::FEATURE_BLOCKED_DEVICE;
|
||||
}
|
||||
|
||||
if (aFeature == nsIGfxInfo::FEATURE_WEBGL_MSAA) {
|
||||
// Blacklist all ATI cards on OSX, except for
|
||||
// 0x6760 and 0x9488
|
||||
if (mAdapterVendorID == GfxDriverInfo::vendorATI &&
|
||||
(mAdapterDeviceID == 0x6760 || mAdapterDeviceID == 0x9488)) {
|
||||
*aStatus = nsIGfxInfo::FEATURE_NO_INFO;
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
if (aOS)
|
||||
*aOS = os;
|
||||
*aStatus = status;
|
||||
|
|
|
@ -157,6 +157,9 @@ GetPrefNameForFeature(PRInt32 aFeature)
|
|||
case nsIGfxInfo::FEATURE_WEBGL_ANGLE:
|
||||
name = BLACKLIST_PREF_BRANCH "webgl.angle";
|
||||
break;
|
||||
case nsIGfxInfo::FEATURE_WEBGL_MSAA:
|
||||
name = BLACKLIST_PREF_BRANCH "webgl.msaa";
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
};
|
||||
|
@ -315,6 +318,8 @@ BlacklistFeatureToGfxFeature(const nsAString& aFeature)
|
|||
return nsIGfxInfo::FEATURE_WEBGL_OPENGL;
|
||||
else if (aFeature == NS_LITERAL_STRING("WEBGL_ANGLE"))
|
||||
return nsIGfxInfo::FEATURE_WEBGL_ANGLE;
|
||||
else if (aFeature == NS_LITERAL_STRING("WEBGL_MSAA"))
|
||||
return nsIGfxInfo::FEATURE_WEBGL_MSAA;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -771,6 +776,7 @@ GfxInfoBase::EvaluateDownloadedBlacklist(nsTArray<GfxDriverInfo>& aDriverInfo)
|
|||
nsIGfxInfo::FEATURE_OPENGL_LAYERS,
|
||||
nsIGfxInfo::FEATURE_WEBGL_OPENGL,
|
||||
nsIGfxInfo::FEATURE_WEBGL_ANGLE,
|
||||
nsIGfxInfo::FEATURE_WEBGL_MSAA,
|
||||
0
|
||||
};
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче