зеркало из https://github.com/mozilla/pjs.git
Back out 9699edcbcedd (bug 721467) for causing bug 722167.
This commit is contained in:
Родитель
d1a816c4eb
Коммит
e8396257dd
|
@ -382,7 +382,6 @@ GLContext::InitWithPrefix(const char *prefix, bool trygl)
|
|||
}
|
||||
|
||||
const char *glVendorString;
|
||||
const char *glRendererString;
|
||||
|
||||
if (mInitialized) {
|
||||
glVendorString = (const char *)fGetString(LOCAL_GL_VENDOR);
|
||||
|
@ -394,23 +393,11 @@ GLContext::InitWithPrefix(const char *prefix, bool trygl)
|
|||
};
|
||||
mVendor = VendorOther;
|
||||
for (int i = 0; i < VendorOther; ++i) {
|
||||
if (DoesStringMatch(glVendorString, vendorMatchStrings[i])) {
|
||||
if (DoesVendorStringMatch(glVendorString, vendorMatchStrings[i])) {
|
||||
mVendor = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
glRendererString = (const char *)fGetString(LOCAL_GL_RENDERER);
|
||||
const char *rendererMatchStrings[RendererOther] = {
|
||||
"Adreno 200"
|
||||
};
|
||||
mRenderer = RendererOther;
|
||||
for (int i = 0; i < RendererOther; ++i) {
|
||||
if (DoesStringMatch(glRendererString, rendererMatchStrings[i])) {
|
||||
mRenderer = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (mInitialized) {
|
||||
|
@ -603,15 +590,6 @@ GLContext::IsExtensionSupported(const char *extension)
|
|||
return ListHasExtension(fGetString(LOCAL_GL_EXTENSIONS), extension);
|
||||
}
|
||||
|
||||
bool
|
||||
GLContext::CanUploadSubTextures()
|
||||
{
|
||||
// There are certain GPUs that we don't want to use glTexSubImage2D on
|
||||
// because that function can be very slow and/or buggy
|
||||
|
||||
return !(Renderer() == RendererAdreno200);
|
||||
}
|
||||
|
||||
// Common code for checking for both GL extensions and GLX extensions.
|
||||
bool
|
||||
GLContext::ListHasExtension(const GLubyte *extensions, const char *extension)
|
||||
|
@ -710,12 +688,7 @@ BasicTextureImage::BeginUpdate(nsIntRegion& aRegion)
|
|||
NS_ASSERTION(!mUpdateSurface, "BeginUpdate() without EndUpdate()?");
|
||||
|
||||
// determine the region the client will need to repaint
|
||||
if (!mGLContext->CanUploadSubTextures()) {
|
||||
aRegion = nsIntRect(nsIntPoint(0, 0), mSize);
|
||||
} else {
|
||||
GetUpdateRegion(aRegion);
|
||||
}
|
||||
|
||||
GetUpdateRegion(aRegion);
|
||||
mUpdateRegion = aRegion;
|
||||
|
||||
nsIntRect rgnSize = mUpdateRegion.GetBounds();
|
||||
|
@ -767,7 +740,6 @@ BasicTextureImage::EndUpdate()
|
|||
mGLContext->UploadSurfaceToTexture(mUpdateSurface,
|
||||
mUpdateRegion,
|
||||
mTexture,
|
||||
mSize,
|
||||
mTextureState == Created,
|
||||
mUpdateOffset,
|
||||
relative);
|
||||
|
@ -826,7 +798,6 @@ BasicTextureImage::DirectUpdate(gfxASurface* aSurf, const nsIntRegion& aRegion,
|
|||
mGLContext->UploadSurfaceToTexture(aSurf,
|
||||
region,
|
||||
mTexture,
|
||||
mSize,
|
||||
mTextureState == Created,
|
||||
bounds.TopLeft() + aFrom,
|
||||
false);
|
||||
|
@ -880,8 +851,7 @@ bool
|
|||
TiledTextureImage::DirectUpdate(gfxASurface* aSurf, const nsIntRegion& aRegion, const nsIntPoint& aFrom /* = nsIntPoint(0, 0) */)
|
||||
{
|
||||
nsIntRegion region;
|
||||
|
||||
if (mTextureState != Valid || !mGL->CanUploadSubTextures()) {
|
||||
if (mTextureState != Valid) {
|
||||
nsIntRect bounds = nsIntRect(0, 0, mSize.width, mSize.height);
|
||||
region = nsIntRegion(bounds);
|
||||
} else {
|
||||
|
@ -1952,7 +1922,6 @@ ShaderProgramType
|
|||
GLContext::UploadSurfaceToTexture(gfxASurface *aSurface,
|
||||
const nsIntRegion& aDstRegion,
|
||||
GLuint& aTexture,
|
||||
const nsIntSize& aTextureSize,
|
||||
bool aOverwrite,
|
||||
const nsIntPoint& aSrcPoint,
|
||||
bool aPixelBuffer)
|
||||
|
@ -2016,7 +1985,6 @@ GLContext::UploadSurfaceToTexture(gfxASurface *aSurface,
|
|||
if (!aPixelBuffer) {
|
||||
data = imageSurface->Data();
|
||||
}
|
||||
|
||||
data += DataOffset(imageSurface, aSrcPoint);
|
||||
}
|
||||
|
||||
|
@ -2081,20 +2049,7 @@ GLContext::UploadSurfaceToTexture(gfxASurface *aSurface,
|
|||
NS_ASSERTION(textureInited || (iterRect->x == 0 && iterRect->y == 0),
|
||||
"Must be uploading to the origin when we don't have an existing texture");
|
||||
|
||||
bool useTexSubImage2D = true;
|
||||
|
||||
nsIntRect bounds = aDstRegion.GetBounds();
|
||||
|
||||
// Only use glTexSubImage2D when we aren't rendering
|
||||
// the entire texture
|
||||
if (iterRect->x == 0 &&
|
||||
iterRect->y == 0 &&
|
||||
iterRect->width >= aTextureSize.width &&
|
||||
iterRect->height >= aTextureSize.height) {
|
||||
useTexSubImage2D = false;
|
||||
}
|
||||
|
||||
if (textureInited && useTexSubImage2D) {
|
||||
if (textureInited) {
|
||||
TexSubImage2D(LOCAL_GL_TEXTURE_2D,
|
||||
0,
|
||||
iterRect->x,
|
||||
|
@ -2145,10 +2100,6 @@ GLContext::TexImage2D(GLenum target, GLint level, GLint internalformat,
|
|||
GLenum type, const GLvoid *pixels)
|
||||
{
|
||||
#ifdef USE_GLES2
|
||||
|
||||
NS_ASSERTION(format == internalformat,
|
||||
"format and internalformat not the same for glTexImage2D on GLES2");
|
||||
|
||||
// Use GLES-specific workarounds for GL_UNPACK_ROW_LENGTH; these are
|
||||
// implemented in TexSubImage2D.
|
||||
fTexImage2D(target,
|
||||
|
|
|
@ -545,7 +545,6 @@ public:
|
|||
mHasRobustness(false),
|
||||
mContextLost(false),
|
||||
mVendor(-1),
|
||||
mRenderer(-1),
|
||||
mDebugMode(0),
|
||||
mCreationFormat(aFormat),
|
||||
mSharedContext(aSharedContext),
|
||||
|
@ -689,21 +688,10 @@ public:
|
|||
VendorOther
|
||||
};
|
||||
|
||||
enum {
|
||||
RendererAdreno200,
|
||||
RendererOther
|
||||
};
|
||||
|
||||
int Vendor() const {
|
||||
return mVendor;
|
||||
}
|
||||
|
||||
int Renderer() const {
|
||||
return mRenderer;
|
||||
}
|
||||
|
||||
bool CanUploadSubTextures();
|
||||
|
||||
/**
|
||||
* If this context wraps a double-buffered target, swap the back
|
||||
* and front buffers. It should be assumed that after a swap, the
|
||||
|
@ -779,7 +767,6 @@ protected:
|
|||
bool mFlushGuaranteesResolve;
|
||||
|
||||
public:
|
||||
|
||||
void SetFlushGuaranteesResolve(bool aFlushGuaranteesResolve) {
|
||||
mFlushGuaranteesResolve = aFlushGuaranteesResolve;
|
||||
}
|
||||
|
@ -1201,7 +1188,6 @@ public:
|
|||
* \param aSurface Surface to upload.
|
||||
* \param aDstRegion Region of texture to upload to.
|
||||
* \param aTexture Texture to use, or 0 to have one created for you.
|
||||
* \param aTextureSize The size of the texture to use.
|
||||
* \param aOverwrite Over an existing texture with a new one.
|
||||
* \param aSrcPoint Offset into aSrc where the region's bound's
|
||||
* TopLeft() sits.
|
||||
|
@ -1213,7 +1199,6 @@ public:
|
|||
ShaderProgramType UploadSurfaceToTexture(gfxASurface *aSurface,
|
||||
const nsIntRegion& aDstRegion,
|
||||
GLuint& aTexture,
|
||||
const nsIntSize& aTextureSize,
|
||||
bool aOverwrite = false,
|
||||
const nsIntPoint& aSrcPoint = nsIntPoint(0, 0),
|
||||
bool aPixelBuffer = false);
|
||||
|
@ -1396,7 +1381,6 @@ protected:
|
|||
bool mContextLost;
|
||||
|
||||
PRInt32 mVendor;
|
||||
PRInt32 mRenderer;
|
||||
|
||||
enum {
|
||||
DebugEnabled = 1 << 0,
|
||||
|
@ -2699,23 +2683,23 @@ public:
|
|||
};
|
||||
|
||||
inline bool
|
||||
DoesStringMatch(const char* aString, const char *aWantedString)
|
||||
DoesVendorStringMatch(const char* aVendorString, const char *aWantedVendor)
|
||||
{
|
||||
if (!aString || !aWantedString)
|
||||
if (!aVendorString || !aWantedVendor)
|
||||
return false;
|
||||
|
||||
const char *occurrence = strstr(aString, aWantedString);
|
||||
const char *occurrence = strstr(aVendorString, aWantedVendor);
|
||||
|
||||
// aWanted not found
|
||||
// aWantedVendor not found
|
||||
if (!occurrence)
|
||||
return false;
|
||||
|
||||
// aWantedString preceded by alpha character
|
||||
if (occurrence != aString && isalpha(*(occurrence-1)))
|
||||
// aWantedVendor preceded by alpha character
|
||||
if (occurrence != aVendorString && isalpha(*(occurrence-1)))
|
||||
return false;
|
||||
|
||||
// aWantedVendor followed by alpha character
|
||||
const char *afterOccurrence = occurrence + strlen(aWantedString);
|
||||
const char *afterOccurrence = occurrence + strlen(aWantedVendor);
|
||||
if (isalpha(*afterOccurrence))
|
||||
return false;
|
||||
|
||||
|
|
|
@ -1474,7 +1474,6 @@ public:
|
|||
mGLContext->UploadSurfaceToTexture(aSurf,
|
||||
region,
|
||||
mTexture,
|
||||
mSize,
|
||||
mTextureState == Created,
|
||||
bounds.TopLeft() + aFrom,
|
||||
false);
|
||||
|
|
|
@ -261,11 +261,11 @@ GLXLibrary::EnsureInitialized()
|
|||
mHasRobustness = true;
|
||||
}
|
||||
|
||||
gIsATI = serverVendor && DoesStringMatch(serverVendor, "ATI");
|
||||
gIsATI = serverVendor && DoesVendorStringMatch(serverVendor, "ATI");
|
||||
gIsChromium = (serverVendor &&
|
||||
DoesStringMatch(serverVendor, "Chromium")) ||
|
||||
DoesVendorStringMatch(serverVendor, "Chromium")) ||
|
||||
(serverVersionStr &&
|
||||
DoesStringMatch(serverVersionStr, "Chromium"));
|
||||
DoesVendorStringMatch(serverVersionStr, "Chromium"));
|
||||
|
||||
mInitialized = true;
|
||||
return true;
|
||||
|
|
|
@ -212,7 +212,6 @@ CanvasLayerOGL::UpdateSurface()
|
|||
gl()->UploadSurfaceToTexture(updatedAreaSurface,
|
||||
mBounds,
|
||||
mTexture,
|
||||
nsIntSize(mBounds.width, mBounds.height),
|
||||
false,
|
||||
nsIntPoint(0, 0));
|
||||
}
|
||||
|
@ -261,7 +260,6 @@ CanvasLayerOGL::RenderLayer(int aPreviousDestination,
|
|||
gl()->UploadSurfaceToTexture(surf,
|
||||
nsIntRect(0, 0, drawRect.width, drawRect.height),
|
||||
mTexture,
|
||||
nsIntSize(mBounds.width, mBounds.height),
|
||||
true,
|
||||
drawRect.TopLeft());
|
||||
}
|
||||
|
|
|
@ -727,7 +727,7 @@ UploadYUVToTexture(GLContext* gl, const PlanarYCbCrImage::Data& aData,
|
|||
aData.mYSize,
|
||||
aData.mYStride,
|
||||
gfxASurface::ImageFormatA8);
|
||||
gl->UploadSurfaceToTexture(surf, size, texture, aData.mYSize, true);
|
||||
gl->UploadSurfaceToTexture(surf, size, texture, true);
|
||||
|
||||
size = nsIntRect(0, 0, aData.mCbCrSize.width, aData.mCbCrSize.height);
|
||||
texture = aUTexture->GetTextureID();
|
||||
|
@ -735,14 +735,14 @@ UploadYUVToTexture(GLContext* gl, const PlanarYCbCrImage::Data& aData,
|
|||
aData.mCbCrSize,
|
||||
aData.mCbCrStride,
|
||||
gfxASurface::ImageFormatA8);
|
||||
gl->UploadSurfaceToTexture(surf, size, texture, aData.mCbCrSize, true);
|
||||
gl->UploadSurfaceToTexture(surf, size, texture, true);
|
||||
|
||||
texture = aVTexture->GetTextureID();
|
||||
surf = new gfxImageSurface(aData.mCrChannel,
|
||||
aData.mCbCrSize,
|
||||
aData.mCbCrStride,
|
||||
gfxASurface::ImageFormatA8);
|
||||
gl->UploadSurfaceToTexture(surf, size, texture, aData.mCbCrSize, true);
|
||||
gl->UploadSurfaceToTexture(surf, size, texture, true);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -797,7 +797,7 @@ CairoImageOGL::SetData(const CairoImage::Data &aData)
|
|||
mLayerProgram =
|
||||
gl->UploadSurfaceToTexture(aData.mSurface,
|
||||
nsIntRect(0,0, mSize.width, mSize.height),
|
||||
tex, mSize, true);
|
||||
tex, true);
|
||||
}
|
||||
|
||||
void CairoImageOGL::SetTiling(bool aTiling)
|
||||
|
|
Загрузка…
Ссылка в новой задаче