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,20 +625,33 @@ GLContext::CanUploadSubTextures()
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool GLContext::sPowerOfTwoForced = false;
|
||||||
GLContext::CanUploadNonPowerOfTwo()
|
bool GLContext::sPowerOfTwoPrefCached = false;
|
||||||
|
|
||||||
|
void
|
||||||
|
GLContext::PlatformStartup()
|
||||||
{
|
{
|
||||||
if (!mWorkAroundDriverBugs)
|
CacheCanUploadNPOT();
|
||||||
return true;
|
}
|
||||||
|
|
||||||
static bool sPowerOfTwoForced;
|
void
|
||||||
static bool sPowerOfTwoPrefCached = false;
|
GLContext::CacheCanUploadNPOT()
|
||||||
|
{
|
||||||
|
MOZ_ASSERT(NS_IsMainThread(), "Can't cache prefs off the main thread.");
|
||||||
|
MOZ_ASSERT(!sPowerOfTwoPrefCached, "Must only call this function once!");
|
||||||
|
|
||||||
if (!sPowerOfTwoPrefCached) {
|
|
||||||
sPowerOfTwoPrefCached = true;
|
sPowerOfTwoPrefCached = true;
|
||||||
mozilla::Preferences::AddBoolVarCache(&sPowerOfTwoForced,
|
mozilla::Preferences::AddBoolVarCache(&sPowerOfTwoForced,
|
||||||
"gfx.textures.poweroftwo.force-enabled");
|
"gfx.textures.poweroftwo.force-enabled");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
GLContext::CanUploadNonPowerOfTwo()
|
||||||
|
{
|
||||||
|
MOZ_ASSERT(sPowerOfTwoPrefCached);
|
||||||
|
|
||||||
|
if (!mWorkAroundDriverBugs)
|
||||||
|
return true;
|
||||||
|
|
||||||
// Some GPUs driver crash when uploading non power of two 565 textures.
|
// Some GPUs driver crash when uploading non power of two 565 textures.
|
||||||
return sPowerOfTwoForced ? false : (Renderer() != RendererAdreno200 &&
|
return sPowerOfTwoForced ? false : (Renderer() != RendererAdreno200 &&
|
||||||
|
@ -744,7 +744,17 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool CanUploadSubTextures();
|
bool CanUploadSubTextures();
|
||||||
|
|
||||||
|
static void PlatformStartup();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
static bool sPowerOfTwoForced;
|
||||||
|
static bool sPowerOfTwoPrefCached;
|
||||||
|
static void CacheCanUploadNPOT();
|
||||||
|
|
||||||
|
public:
|
||||||
bool CanUploadNonPowerOfTwo();
|
bool CanUploadNonPowerOfTwo();
|
||||||
|
|
||||||
bool WantsSmallTiles();
|
bool WantsSmallTiles();
|
||||||
virtual bool HasLockSurface() { return false; }
|
virtual bool HasLockSurface() { return false; }
|
||||||
|
|
||||||
|
@ -340,6 +340,8 @@ gfxPlatform::Init()
|
|||||||
|
|
||||||
gPlatform->mWorkAroundDriverBugs = Preferences::GetBool("gfx.work-around-driver-bugs", true);
|
gPlatform->mWorkAroundDriverBugs = Preferences::GetBool("gfx.work-around-driver-bugs", true);
|
||||||
|
|
||||||
|
mozilla::gl::GLContext::PlatformStartup();
|
||||||
|
|
||||||
#ifdef MOZ_WIDGET_ANDROID
|
#ifdef MOZ_WIDGET_ANDROID
|
||||||
// Texture pool init
|
// Texture pool init
|
||||||
mozilla::gl::TexturePoolOGL::Init();
|
mozilla::gl::TexturePoolOGL::Init();
|
||||||
|
Loading…
Reference in New Issue
Block a user