mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 19:35:51 +00:00
Bug 797120 - GLContext::CanUploadNonPowerOfTwo() should not call AddBoolVarCache() when off the main thread. r=bjacob
This commit is contained in:
parent
f0004b2afd
commit
d9a04350b5
@ -625,21 +625,34 @@ GLContext::CanUploadSubTextures()
|
||||
return true;
|
||||
}
|
||||
|
||||
bool GLContext::sPowerOfTwoForced = false;
|
||||
bool GLContext::sPowerOfTwoPrefCached = false;
|
||||
|
||||
void
|
||||
GLContext::PlatformStartup()
|
||||
{
|
||||
CacheCanUploadNPOT();
|
||||
}
|
||||
|
||||
void
|
||||
GLContext::CacheCanUploadNPOT()
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread(), "Can't cache prefs off the main thread.");
|
||||
MOZ_ASSERT(!sPowerOfTwoPrefCached, "Must only call this function once!");
|
||||
|
||||
sPowerOfTwoPrefCached = true;
|
||||
mozilla::Preferences::AddBoolVarCache(&sPowerOfTwoForced,
|
||||
"gfx.textures.poweroftwo.force-enabled");
|
||||
}
|
||||
|
||||
bool
|
||||
GLContext::CanUploadNonPowerOfTwo()
|
||||
{
|
||||
MOZ_ASSERT(sPowerOfTwoPrefCached);
|
||||
|
||||
if (!mWorkAroundDriverBugs)
|
||||
return true;
|
||||
|
||||
static bool sPowerOfTwoForced;
|
||||
static bool sPowerOfTwoPrefCached = false;
|
||||
|
||||
if (!sPowerOfTwoPrefCached) {
|
||||
sPowerOfTwoPrefCached = true;
|
||||
mozilla::Preferences::AddBoolVarCache(&sPowerOfTwoForced,
|
||||
"gfx.textures.poweroftwo.force-enabled");
|
||||
}
|
||||
|
||||
// Some GPUs driver crash when uploading non power of two 565 textures.
|
||||
return sPowerOfTwoForced ? false : (Renderer() != RendererAdreno200 &&
|
||||
Renderer() != RendererAdreno205);
|
||||
|
@ -744,7 +744,17 @@ public:
|
||||
}
|
||||
|
||||
bool CanUploadSubTextures();
|
||||
|
||||
static void PlatformStartup();
|
||||
|
||||
protected:
|
||||
static bool sPowerOfTwoForced;
|
||||
static bool sPowerOfTwoPrefCached;
|
||||
static void CacheCanUploadNPOT();
|
||||
|
||||
public:
|
||||
bool CanUploadNonPowerOfTwo();
|
||||
|
||||
bool WantsSmallTiles();
|
||||
virtual bool HasLockSurface() { return false; }
|
||||
|
||||
|
@ -340,6 +340,8 @@ gfxPlatform::Init()
|
||||
|
||||
gPlatform->mWorkAroundDriverBugs = Preferences::GetBool("gfx.work-around-driver-bugs", true);
|
||||
|
||||
mozilla::gl::GLContext::PlatformStartup();
|
||||
|
||||
#ifdef MOZ_WIDGET_ANDROID
|
||||
// Texture pool init
|
||||
mozilla::gl::TexturePoolOGL::Init();
|
||||
|
Loading…
Reference in New Issue
Block a user