Bug 741730 - Remove USE_GLES2 - r=romaxa

This commit is contained in:
Benoit Jacob 2012-04-10 11:49:21 -04:00
Родитель d83877bc22
Коммит aabaa2c453
4 изменённых файлов: 143 добавлений и 165 удалений

Просмотреть файл

@ -2338,11 +2338,7 @@ GLContext::UploadSurfaceToTexture(gfxASurface *aSurface,
PRInt32 stride = imageSurface->Stride();
#ifndef USE_GLES2
internalformat = LOCAL_GL_RGBA;
#else
internalformat = format;
#endif
internalformat = mIsGLES2 ? format : LOCAL_GL_RGBA;
nsIntRegionRectIterator iter(paintRegion);
const nsIntRect *iterRect;
@ -2410,7 +2406,7 @@ GLContext::TexImage2D(GLenum target, GLint level, GLint internalformat,
GLint pixelsize, GLint border, GLenum format,
GLenum type, const GLvoid *pixels)
{
#ifdef USE_GLES2
if (mIsGLES2) {
NS_ASSERTION(format == internalformat,
"format and internalformat not the same for glTexImage2D on GLES2");
@ -2488,7 +2484,9 @@ GLContext::TexImage2D(GLenum target, GLint level, GLint internalformat,
type,
pixels);
}
#else
} else {
// desktop GL (non-ES) path
fPixelStorei(LOCAL_GL_UNPACK_ALIGNMENT,
NS_MIN(GetAddressAlignment((ptrdiff_t)pixels),
GetAddressAlignment((ptrdiff_t)stride)));
@ -2505,7 +2503,7 @@ GLContext::TexImage2D(GLenum target, GLint level, GLint internalformat,
pixels);
fPixelStorei(LOCAL_GL_UNPACK_ROW_LENGTH, 0);
fPixelStorei(LOCAL_GL_UNPACK_ALIGNMENT, 4);
#endif
}
}
void
@ -2515,7 +2513,7 @@ GLContext::TexSubImage2D(GLenum target, GLint level,
GLint pixelsize, GLenum format,
GLenum type, const GLvoid* pixels)
{
#ifdef USE_GLES2
if (mIsGLES2) {
if (stride == width * pixelsize) {
fPixelStorei(LOCAL_GL_UNPACK_ALIGNMENT,
NS_MIN(GetAddressAlignment((ptrdiff_t)pixels),
@ -2540,7 +2538,8 @@ GLContext::TexSubImage2D(GLenum target, GLint level,
width, height, stride,
pixelsize, format, type, pixels);
}
#else
} else {
// desktop GL (non-ES) path
fPixelStorei(LOCAL_GL_UNPACK_ALIGNMENT,
NS_MIN(GetAddressAlignment((ptrdiff_t)pixels),
GetAddressAlignment((ptrdiff_t)stride)));
@ -2557,7 +2556,7 @@ GLContext::TexSubImage2D(GLenum target, GLint level,
pixels);
fPixelStorei(LOCAL_GL_UNPACK_ROW_LENGTH, 0);
fPixelStorei(LOCAL_GL_UNPACK_ALIGNMENT, 4);
#endif
}
}
void

Просмотреть файл

@ -68,10 +68,6 @@
#include "nsAutoPtr.h"
#include "nsThreadUtils.h"
#if defined(MOZ_PLATFORM_MAEMO) || defined(ANDROID) || defined(MOZ_EGL_XRENDER_COMPOSITE)
#define USE_GLES2 1
#endif
typedef char realGLboolean;
#include "GLContextSymbols.h"
@ -531,11 +527,7 @@ public:
mOffscreenFBOsDirty(false),
mInitialized(false),
mIsOffscreen(aIsOffscreen),
#ifdef USE_GLES2
mIsGLES2(true),
#else
mIsGLES2(false),
#endif
mIsGlobalSharedContext(false),
mHasRobustness(false),
mContextLost(false),

Просмотреть файл

@ -153,13 +153,6 @@ EXPORTS_mozilla/layers += ShadowLayerUtilsX11.h
CPPSRCS += ShadowLayerUtilsX11.cpp
endif #}
# Enable GLES2.0 under maemo
ifdef MOZ_X11
ifdef MOZ_PLATFORM_MAEMO
DEFINES += -DUSE_GLES2
endif
endif
ifdef MOZ_ENABLE_D3D10_LAYER
EXPORTS_mozilla/layers += ShadowLayerUtilsD3D10.h
DEFINES += -DMOZ_ENABLE_D3D10_LAYER

Просмотреть файл

@ -259,15 +259,16 @@ LayerManagerOGL::Initialize(nsRefPtr<GLContext> aContext, bool force)
GLenum textureTargets[] = {
LOCAL_GL_TEXTURE_2D,
#ifndef USE_GLES2
LOCAL_GL_TEXTURE_RECTANGLE_ARB
#endif
mGLContext->IsGLES2() ? LOCAL_GL_TEXTURE_RECTANGLE_ARB : 0
};
mFBOTextureTarget = LOCAL_GL_NONE;
for (PRUint32 i = 0; i < ArrayLength(textureTargets); i++) {
GLenum target = textureTargets[i];
if (!target)
continue;
mGLContext->fGenTextures(1, &mBackBufferTexture);
mGLContext->fBindTexture(target, mBackBufferTexture);
mGLContext->fTexParameteri(target,
@ -1050,7 +1051,7 @@ LayerManagerOGL::CopyToTarget(gfxContext *aTarget)
mGLContext->fBindFramebuffer(LOCAL_GL_FRAMEBUFFER,
mGLContext->IsDoubleBuffered() ? 0 : mBackBufferFBO);
#ifndef USE_GLES2
if (!mGLContext->IsGLES2()) {
// GLES2 promises that binding to any custom FBO will attach
// to GL_COLOR_ATTACHMENT0 attachment point.
if (mGLContext->IsDoubleBuffered()) {
@ -1059,7 +1060,7 @@ LayerManagerOGL::CopyToTarget(gfxContext *aTarget)
else {
mGLContext->fReadBuffer(LOCAL_GL_COLOR_ATTACHMENT0);
}
#endif
}
NS_ASSERTION(imageSurface->Stride() == width * 4,
"Image Surfaces being created with weird stride!");
@ -1118,19 +1119,6 @@ GetFrameBufferInternalFormat(GLContext* gl,
return LOCAL_GL_RGBA;
}
static bool
AreFormatsCompatibleForCopyTexImage2D(GLenum aF1, GLenum aF2)
{
// GL requires that the implementation has to handle copies between
// different formats, so all are "compatible". GLES does not
// require that.
#ifdef USE_GLES2
return (aF1 == aF2);
#else
return true;
#endif
}
void
LayerManagerOGL::CreateFBOWithTexture(const nsIntRect& aRect, InitMode aInit,
GLuint aCurrentFrameBuffer,
@ -1141,6 +1129,7 @@ LayerManagerOGL::CreateFBOWithTexture(const nsIntRect& aRect, InitMode aInit,
mGLContext->fActiveTexture(LOCAL_GL_TEXTURE0);
mGLContext->fGenTextures(1, &tex);
mGLContext->fBindTexture(mFBOTextureTarget, tex);
if (aInit == InitModeCopy) {
// We're going to create an RGBA temporary fbo. But to
// CopyTexImage() from the current framebuffer, the framebuffer's
@ -1149,7 +1138,12 @@ LayerManagerOGL::CreateFBOWithTexture(const nsIntRect& aRect, InitMode aInit,
// if it's incompatible.
GLenum format =
GetFrameBufferInternalFormat(gl(), aCurrentFrameBuffer, mWidget);
if (AreFormatsCompatibleForCopyTexImage2D(format, LOCAL_GL_RGBA)) {
bool isFormatCompatibleWithRGBA
= gl()->IsGLES2() ? (format == LOCAL_GL_RGBA)
: true;
if (isFormatCompatibleWithRGBA) {
mGLContext->fCopyTexImage2D(mFBOTextureTarget,
0,
LOCAL_GL_RGBA,