Bug 741730 - Remove USE_GLES2 - r=romaxa

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

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

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

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

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

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

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

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

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