merge the backout of cset d4a04cc38326

This commit is contained in:
Jeff Gilbert 2012-07-18 15:25:59 -07:00
commit 420dd6ad44
7 changed files with 33 additions and 26 deletions

View File

@ -79,7 +79,6 @@ static const char *sExtensionNames[] = {
"GL_ARB_sync",
"GL_OES_EGL_image",
"GL_OES_EGL_sync",
"GL_OES_EGL_image_external",
nsnull
};
@ -471,7 +470,7 @@ GLContext::InitWithPrefix(const char *prefix, bool trygl)
if (IsExtensionSupported(OES_EGL_image)) {
SymLoadStruct imageSymbols[] = {
{ (PRFuncPtr*) &mSymbols.fEGLImageTargetTexture2D, { "EGLImageTargetTexture2DOES", nsnull } },
{ (PRFuncPtr*) &mSymbols.fImageTargetTexture2D, { "EGLImageTargetTexture2DOES", nsnull } },
{ nsnull, { nsnull } },
};
@ -479,7 +478,7 @@ GLContext::InitWithPrefix(const char *prefix, bool trygl)
NS_ERROR("GL supports OES_EGL_image without supplying its functions.");
MarkExtensionUnsupported(OES_EGL_image);
mSymbols.fEGLImageTargetTexture2D = nsnull;
mSymbols.fImageTargetTexture2D = nsnull;
}
}

View File

@ -1534,7 +1534,6 @@ public:
ARB_sync,
OES_EGL_image,
OES_EGL_sync,
OES_EGL_image_external,
Extensions_Max
};
@ -3083,10 +3082,10 @@ public:
}
// OES_EGL_image (GLES)
void fEGLImageTargetTexture2D(GLenum target, GLeglImage image)
void fImageTargetTexture2D(GLenum target, GLeglImage image)
{
BEFORE_GL_CALL;
mSymbols.fEGLImageTargetTexture2D(target, image);
mSymbols.fImageTargetTexture2D(target, image);
AFTER_GL_CALL;
}

View File

@ -43,6 +43,8 @@
using namespace android;
# define EGL_NATIVE_BUFFER_ANDROID 0x3140
# define EGL_IMAGE_PRESERVED_KHR 0x30D2
# define GL_TEXTURE_EXTERNAL_OES 0x8D65
# endif
@ -406,15 +408,15 @@ public:
{
#if defined(MOZ_WIDGET_GONK)
EGLint attrs[] = {
LOCAL_EGL_IMAGE_PRESERVED, LOCAL_EGL_TRUE,
EGL_IMAGE_PRESERVED_KHR, LOCAL_EGL_TRUE,
LOCAL_EGL_NONE, LOCAL_EGL_NONE
};
EGLImage image = sEGLLibrary.fCreateImage(EGL_DISPLAY(),
EGL_NO_CONTEXT,
EGL_NATIVE_BUFFER_ANDROID,
buffer, attrs);
fEGLImageTargetTexture2D(LOCAL_GL_TEXTURE_EXTERNAL, image);
fBindTexture(LOCAL_GL_TEXTURE_EXTERNAL, texture);
sEGLLibrary.fImageTargetTexture2DOES(GL_TEXTURE_EXTERNAL_OES, image);
fBindTexture(GL_TEXTURE_EXTERNAL_OES, texture);
sEGLLibrary.fDestroyImage(EGL_DISPLAY(), image);
return true;
#else
@ -863,7 +865,7 @@ bool GLContextEGL::AttachSharedHandle(TextureImage::TextureShareType aType,
EGLTextureWrapper* wrap = (EGLTextureWrapper*)aSharedHandle;
wrap->WaitSync();
fEGLImageTargetTexture2D(LOCAL_GL_TEXTURE_2D, wrap->GetEGLImage());
sEGLLibrary.fImageTargetTexture2DOES(LOCAL_GL_TEXTURE_2D, wrap->GetEGLImage());
return true;
}
@ -1309,7 +1311,7 @@ public:
if (UsingDirectTexture()) {
mGLContext->fActiveTexture(aTextureUnit);
mGLContext->fBindTexture(LOCAL_GL_TEXTURE_2D, mTexture);
fEGLImageTargetTexture2D(LOCAL_GL_TEXTURE_2D, mEGLImage);
sEGLLibrary.fImageTargetTexture2DOES(LOCAL_GL_TEXTURE_2D, mEGLImage);
if (sEGLLibrary.fGetError() != LOCAL_EGL_SUCCESS) {
LOG("Could not set image target texture. ERROR (0x%04x)", sEGLLibrary.fGetError());
}
@ -1412,7 +1414,7 @@ public:
mGLContext->MakeCurrent(true);
mGLContext->fActiveTexture(LOCAL_GL_TEXTURE0);
mGLContext->fBindTexture(LOCAL_GL_TEXTURE_2D, mTexture);
mGLContext->fEGLImageTargetTexture2D(LOCAL_GL_TEXTURE_2D, 0);
sEGLLibrary.fImageTargetTexture2DOES(LOCAL_GL_TEXTURE_2D, 0);
if (sEGLLibrary.fGetError() != LOCAL_EGL_SUCCESS) {
LOG("Could not set image target texture. ERROR (0x%04x)", sEGLLibrary.fGetError());
return false;
@ -1575,7 +1577,7 @@ public:
mEGLImage =
sEGLLibrary.fCreateImage(EGL_DISPLAY(),
EGL_NO_CONTEXT,
LOCAL_EGL_NATIVE_PIXMAP,
LOCAL_EGL_NATIVE_PIXMAP_KHR,
(EGLClientBuffer)xsurface->XDrawable(),
nsnull);
@ -1584,7 +1586,7 @@ public:
return false;
}
mGLContext->fBindTexture(LOCAL_GL_TEXTURE_2D, mTexture);
mGLContext->fEGLImageTargetTexture2D(LOCAL_GL_TEXTURE_2D, mEGLImage);
mGLContext->fImageTargetTexture2D(LOCAL_GL_TEXTURE_2D, mEGLImage);
sEGLLibrary.fDestroyImage(EGL_DISPLAY(), mEGLImage);
mEGLImage = nsnull;
} else {
@ -1613,7 +1615,7 @@ public:
GraphicBuffer::USAGE_SW_WRITE_OFTEN;
mGraphicBuffer = new GraphicBuffer(aSize.width, aSize.height, format, usage);
if (mGraphicBuffer->initCheck() == OK) {
const int eglImageAttributes[] = { LOCAL_EGL_IMAGE_PRESERVED, LOCAL_EGL_TRUE,
const int eglImageAttributes[] = { EGL_IMAGE_PRESERVED_KHR, LOCAL_EGL_TRUE,
LOCAL_EGL_NONE, LOCAL_EGL_NONE };
mEGLImage = sEGLLibrary.fCreateImage(EGL_DISPLAY(),
EGL_NO_CONTEXT,

View File

@ -373,8 +373,8 @@ struct GLContextSymbols
PFNGLGETSYNCIV fGetSynciv;
// OES_egl_image
typedef void (GLAPIENTRY * PFNGLEGLIMAGETARGETTEXTURE2D)(GLenum target, GLeglImage image);
PFNGLEGLIMAGETARGETTEXTURE2D fEGLImageTargetTexture2D;
typedef void (GLAPIENTRY * PFNGLIMAGETARGETTEXTURE2D)(GLenum target, GLeglImage image);
PFNGLIMAGETARGETTEXTURE2D fImageTargetTexture2D;
};
}

View File

@ -3024,9 +3024,6 @@ typedef void* GLeglImage;
#define LOCAL_GL_CONDITION_SATISFIED 0x911C
#define LOCAL_GL_WAIT_FAILED 0x911D
// OES_EGL_image_external
#define LOCAL_GL_TEXTURE_EXTERNAL 0x8D65
#define LOCAL_GL_MAX_VERTEX_UNIFORM_VECTORS 0x8DFB
#define LOCAL_GL_MAX_VARYING_VECTORS 0x8DFC
#define LOCAL_GL_MAX_FRAGMENT_UNIFORM_VECTORS 0x8DFD
@ -3239,6 +3236,8 @@ typedef void* GLeglImage;
#define LOCAL_EGL_TEXTURE_RGB 0x305D
#define LOCAL_EGL_TEXTURE_RGBA 0x305E
#define LOCAL_EGL_TEXTURE_2D 0x305F
#define LOCAL_EGL_NATIVE_PIXMAP_KHR 0x30B0
#define LOCAL_EGL_IMAGE_PRESERVED_KHR 0x30D2
#define LOCAL_EGL_FALSE 0
#define LOCAL_EGL_TRUE 1
#define LOCAL_EGL_BITMAP_POINTER_KHR 0x30C6
@ -3254,12 +3253,6 @@ typedef void* GLeglImage;
#define LOCAL_EGL_DRAW 0x3059
#define LOCAL_EGL_CONTEXT_LOST 0x300E
// EGL_KHR_image_base (not supplied by EGL_KHR_image!)
#define LOCAL_EGL_IMAGE_PRESERVED 0x30D2
// EGL_KHR_image_pixmap
#define LOCAL_EGL_NATIVE_PIXMAP 0x30B0
// EGL_KHR_gl_texture_2D_image
#define LOCAL_EGL_GL_TEXTURE_2D 0x30B1

View File

@ -309,6 +309,7 @@ GLLibraryEGL::LoadConfigSensitiveSymbols()
GLLibraryLoader::SymLoadStruct imageSymbols[] = {
{ (PRFuncPtr*) &mSymbols.fCreateImage, { "eglCreateImageKHR", nsnull } },
{ (PRFuncPtr*) &mSymbols.fDestroyImage, { "eglDestroyImageKHR", nsnull } },
{ (PRFuncPtr*) &mSymbols.fImageTargetTexture2DOES, { "glEGLImageTargetTexture2DOES", NULL } },
{ nsnull, { nsnull } }
};
@ -324,6 +325,7 @@ GLLibraryEGL::LoadConfigSensitiveSymbols()
mSymbols.fCreateImage = nsnull;
mSymbols.fDestroyImage = nsnull;
mSymbols.fImageTargetTexture2DOES = nsnull;
}
} else {
MarkExtensionUnsupported(KHR_image_pixmap);

View File

@ -421,6 +421,13 @@ public:
return b;
}
void fImageTargetTexture2DOES(GLenum target, EGLImage image)
{
BEFORE_GL_CALL;
mSymbols.fImageTargetTexture2DOES(target, image);
AFTER_GL_CALL;
}
EGLDisplay Display() {
return mEGLDisplay;
@ -535,6 +542,11 @@ public:
pfnClientWaitSync fClientWaitSync;
typedef EGLBoolean (GLAPIENTRY * pfnGetSyncAttrib)(EGLDisplay dpy, EGLSync sync, EGLint attribute, EGLint *value);
pfnGetSyncAttrib fGetSyncAttrib;
// This is EGL specific GL ext symbol "glEGLImageTargetTexture2DOES"
// Lets keep it here for now.
typedef void (GLAPIENTRY * pfnImageTargetTexture2DOES)(GLenum target, EGLImage image);
pfnImageTargetTexture2DOES fImageTargetTexture2DOES;
} mSymbols;
private: