aboutsummaryrefslogtreecommitdiffstats
path: root/emulator
diff options
context:
space:
mode:
authorMartin Storsjo <martin@martin.st>2013-08-10 00:27:38 +0300
committerMartin Storsjo <martin@martin.st>2013-08-10 00:41:16 +0300
commit57501158002f2b81b0aecec9ecf609970950ae85 (patch)
treef4d6f8b0d8ad5d961c07a2ce00001b42c9ec5ef1 /emulator
parent6da9a761cd06c67a9c30534b4da2b8447aced5d0 (diff)
downloadsdk-57501158002f2b81b0aecec9ecf609970950ae85.zip
sdk-57501158002f2b81b0aecec9ecf609970950ae85.tar.gz
sdk-57501158002f2b81b0aecec9ecf609970950ae85.tar.bz2
EglMacApi: Use the right pbuffer texture target and format parameters
The target and format parameters are in the EGL parameter range (and are stored in EGLints), while nsCreatePBuffer (which calls NSOpenGLPixelBuffer initWithTextureTarget) takes GLenums. This is pretty much similar to the same function in EglWindowsApi.cpp, but contrary to that function, there's nothing similar to WGL_NO_TEXTURE_ARB in initWithTextureTarget, so something has to be specified in all cases. Previously, the default EGL_NO_TEXTURE (0x305C) was passed through. While this mostly worked just fine, it had the surprising hidden side effect of using a vertically flipped coordinate system in glReadPixels (with the origin being the top left corner instead of the bottom left one, which is default in OpenGL). This makes the EncodeDecodeTest media CTS test pass with surface output on the emulator on Mac OS X. (This test renders the decoded video to a pbuffer and checks individual pixel values using glReadPixels.) Change-Id: I21a2430ce6334a5e82ea3203c4d157f5bad1558d
Diffstat (limited to 'emulator')
-rw-r--r--emulator/opengl/host/libs/Translator/EGL/EglMacApi.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/emulator/opengl/host/libs/Translator/EGL/EglMacApi.cpp b/emulator/opengl/host/libs/Translator/EGL/EglMacApi.cpp
index fd3cb0b..31527af 100644
--- a/emulator/opengl/host/libs/Translator/EGL/EglMacApi.cpp
+++ b/emulator/opengl/host/libs/Translator/EGL/EglMacApi.cpp
@@ -142,11 +142,20 @@ bool checkPixmapPixelFormatMatch(EGLNativeDisplayType dpy,EGLNativePixmapType pi
EGLNativeSurfaceType createPbufferSurface(EGLNativeDisplayType dpy,EglConfig* cfg,EglPbufferSurface* srfc){
EGLint width,height,hasMipmap,tmp;
EGLint target,format;
+ GLenum glTexFormat = GL_RGBA, glTexTarget = GL_TEXTURE_2D;
srfc->getDim(&width,&height,&tmp);
srfc->getTexInfo(&format,&target);
+ switch (format) {
+ case EGL_TEXTURE_RGB:
+ glTexFormat = GL_RGB;
+ break;
+ case EGL_TEXTURE_RGBA:
+ glTexFormat = GL_RGBA;
+ break;
+ }
srfc->getAttrib(EGL_MIPMAP_TEXTURE,&hasMipmap);
EGLint maxMipmap = hasMipmap ? MAX_PBUFFER_MIPMAP_LEVEL:0;
- return (EGLNativeSurfaceType)nsCreatePBuffer(target,format,maxMipmap,width,height);
+ return (EGLNativeSurfaceType)nsCreatePBuffer(glTexTarget,glTexFormat,maxMipmap,width,height);
}
bool releasePbuffer(EGLNativeDisplayType dis,EGLNativeSurfaceType pb) {