mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 942499 - Part 2: Move CanUploadNonPowerOfTwo out of GLContext; remove the gfx.textures.poweroftwo.force-enabled preference - r=gal,BenWa
This commit is contained in:
parent
1dea809c09
commit
b253073c22
@ -5,6 +5,7 @@
|
|||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
#include "GLBlitTextureImageHelper.h"
|
#include "GLBlitTextureImageHelper.h"
|
||||||
|
#include "GLUploadHelpers.h"
|
||||||
#include "DecomposeIntoNoRepeatTriangles.h"
|
#include "DecomposeIntoNoRepeatTriangles.h"
|
||||||
#include "GLContext.h"
|
#include "GLContext.h"
|
||||||
#include "nsRect.h"
|
#include "nsRect.h"
|
||||||
@ -116,7 +117,7 @@ GLBlitTextureImageHelper::BlitTextureImage(TextureImage *aSrc, const nsIntRect&
|
|||||||
RectTriangles rects;
|
RectTriangles rects;
|
||||||
|
|
||||||
nsIntSize realTexSize = srcSize;
|
nsIntSize realTexSize = srcSize;
|
||||||
if (!mGL->CanUploadNonPowerOfTwo()) {
|
if (!CanUploadNonPowerOfTwo(mGL)) {
|
||||||
realTexSize = nsIntSize(gfx::NextPowerOfTwo(srcSize.width),
|
realTexSize = nsIntSize(gfx::NextPowerOfTwo(srcSize.width),
|
||||||
gfx::NextPowerOfTwo(srcSize.height));
|
gfx::NextPowerOfTwo(srcSize.height));
|
||||||
}
|
}
|
||||||
|
@ -1167,40 +1167,12 @@ GLContext::CanReadSRGBFromFBOTexture()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool GLContext::sPowerOfTwoForced = false;
|
|
||||||
bool GLContext::sPowerOfTwoPrefCached = false;
|
|
||||||
|
|
||||||
void
|
void
|
||||||
GLContext::PlatformStartup()
|
GLContext::PlatformStartup()
|
||||||
{
|
{
|
||||||
CacheCanUploadNPOT();
|
|
||||||
RegisterStrongMemoryReporter(new GfxTexturesReporter());
|
RegisterStrongMemoryReporter(new GfxTexturesReporter());
|
||||||
}
|
}
|
||||||
|
|
||||||
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;
|
|
||||||
|
|
||||||
// Some GPUs driver crash when uploading non power of two 565 textures.
|
|
||||||
return sPowerOfTwoForced ? false : (Renderer() != RendererAdreno200 &&
|
|
||||||
Renderer() != RendererAdreno205);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Common code for checking for both GL extensions and GLX extensions.
|
// Common code for checking for both GL extensions and GLX extensions.
|
||||||
bool
|
bool
|
||||||
GLContext::ListHasExtension(const GLubyte *extensions, const char *extension)
|
GLContext::ListHasExtension(const GLubyte *extensions, const char *extension)
|
||||||
|
@ -2477,14 +2477,7 @@ public:
|
|||||||
|
|
||||||
static void PlatformStartup();
|
static void PlatformStartup();
|
||||||
|
|
||||||
protected:
|
|
||||||
static bool sPowerOfTwoForced;
|
|
||||||
static bool sPowerOfTwoPrefCached;
|
|
||||||
static void CacheCanUploadNPOT();
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
bool CanUploadNonPowerOfTwo();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If this context wraps a double-buffered target, swap the back
|
* If this context wraps a double-buffered target, swap the back
|
||||||
* and front buffers. It should be assumed that after a swap, the
|
* and front buffers. It should be assumed that after a swap, the
|
||||||
|
@ -269,7 +269,7 @@ TexImage2DHelper(GLContext *gl,
|
|||||||
NS_ASSERTION(format == (GLenum)internalformat,
|
NS_ASSERTION(format == (GLenum)internalformat,
|
||||||
"format and internalformat not the same for glTexImage2D on GLES2");
|
"format and internalformat not the same for glTexImage2D on GLES2");
|
||||||
|
|
||||||
if (!gl->CanUploadNonPowerOfTwo()
|
if (!CanUploadNonPowerOfTwo(gl)
|
||||||
&& (stride != width * pixelsize
|
&& (stride != width * pixelsize
|
||||||
|| !gfx::IsPowerOfTwo(width)
|
|| !gfx::IsPowerOfTwo(width)
|
||||||
|| !gfx::IsPowerOfTwo(height))) {
|
|| !gfx::IsPowerOfTwo(height))) {
|
||||||
@ -587,5 +587,16 @@ UploadSurfaceToTexture(GLContext* gl,
|
|||||||
aTextureTarget);
|
aTextureTarget);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
CanUploadNonPowerOfTwo(GLContext* gl)
|
||||||
|
{
|
||||||
|
if (!gl->WorkAroundDriverBugs())
|
||||||
|
return true;
|
||||||
|
|
||||||
|
// Some GPUs driver crash when uploading non power of two 565 textures.
|
||||||
|
return gl->Renderer() != GLContext::RendererAdreno200 &&
|
||||||
|
gl->Renderer() != GLContext::RendererAdreno205;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -96,6 +96,7 @@ UploadSurfaceToTexture(GLContext* gl,
|
|||||||
GLenum aTextureTarget);
|
GLenum aTextureTarget);
|
||||||
|
|
||||||
bool CanUploadSubTextures(GLContext* gl);
|
bool CanUploadSubTextures(GLContext* gl);
|
||||||
|
bool CanUploadNonPowerOfTwo(GLContext* gl);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -582,7 +582,7 @@ CompositorOGL::BindAndDrawQuadWithTextureRect(ShaderProgramOGL *aProg,
|
|||||||
GLenum wrapMode = aTexture->AsSourceOGL()->GetWrapMode();
|
GLenum wrapMode = aTexture->AsSourceOGL()->GetWrapMode();
|
||||||
|
|
||||||
IntSize realTexSize = aTexture->GetSize();
|
IntSize realTexSize = aTexture->GetSize();
|
||||||
if (!mGLContext->CanUploadNonPowerOfTwo()) {
|
if (!CanUploadNonPowerOfTwo(mGLContext)) {
|
||||||
realTexSize = IntSize(NextPowerOfTwo(realTexSize.width),
|
realTexSize = IntSize(NextPowerOfTwo(realTexSize.width),
|
||||||
NextPowerOfTwo(realTexSize.height));
|
NextPowerOfTwo(realTexSize.height));
|
||||||
}
|
}
|
||||||
@ -757,7 +757,7 @@ bool CompositorOGL::sDrawFPS = false;
|
|||||||
static IntSize
|
static IntSize
|
||||||
CalculatePOTSize(const IntSize& aSize, GLContext* gl)
|
CalculatePOTSize(const IntSize& aSize, GLContext* gl)
|
||||||
{
|
{
|
||||||
if (gl->CanUploadNonPowerOfTwo())
|
if (CanUploadNonPowerOfTwo(gl))
|
||||||
return aSize;
|
return aSize;
|
||||||
|
|
||||||
return IntSize(NextPowerOfTwo(aSize.width), NextPowerOfTwo(aSize.height));
|
return IntSize(NextPowerOfTwo(aSize.width), NextPowerOfTwo(aSize.height));
|
||||||
|
@ -404,7 +404,6 @@ pref("gfx.content.azure.backends", "cairo");
|
|||||||
pref("gfx.content.azure.backends", "cairo");
|
pref("gfx.content.azure.backends", "cairo");
|
||||||
#endif
|
#endif
|
||||||
#ifdef ANDROID
|
#ifdef ANDROID
|
||||||
pref("gfx.textures.poweroftwo.force-enabled", false);
|
|
||||||
pref("gfx.content.azure.backends", "cairo");
|
pref("gfx.content.azure.backends", "cairo");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user