diff options
Diffstat (limited to 'emulator/opengl')
3 files changed, 15 insertions, 30 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) { diff --git a/emulator/opengl/host/libs/libOpenglRender/ColorBuffer.cpp b/emulator/opengl/host/libs/libOpenglRender/ColorBuffer.cpp index 5f04a97..46c5acf 100644 --- a/emulator/opengl/host/libs/libOpenglRender/ColorBuffer.cpp +++ b/emulator/opengl/host/libs/libOpenglRender/ColorBuffer.cpp @@ -115,24 +115,8 @@ ColorBuffer::ColorBuffer() :      m_eglImage(NULL),      m_blitEGLImage(NULL),      m_fbo(0), -    m_internalFormat(0), -    m_warYInvertBug(false) +    m_internalFormat(0)  { -#if __APPLE__ -    // On Macs running OS X 10.6 and 10.7 with Intel HD Graphics 3000 or 4000, -    // some screens or parts of the screen are displayed upside down. The exact -    // conditions/sequence that triggers this aren't known yet; I haven't been -    // able to reproduce it in a standalone test. This way of enabling the -    // workaround will break if it is a driver bug (rather than a bug in this -    // code which works by accident elsewhere) and Apple/Intel release a fix -    // for it. Running a standalone test to detect the problem at runtime would -    // be more robust. -    const char* renderer = (const char*)s_gl.glGetString(GL_RENDERER); -    if (strstr(renderer, "Intel HD Graphics 3000") || -        strstr(renderer, "Intel HD Graphics 4000")) { -        m_warYInvertBug = true; -    } -#endif  }  ColorBuffer::~ColorBuffer() @@ -225,7 +209,7 @@ bool ColorBuffer::blitFromCurrentReadBuffer()              s_gl.glBindTexture(GL_TEXTURE_2D, m_blitTex);              s_gl.glEnable(GL_TEXTURE_2D);              s_gl.glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); -            drawTexQuad(!m_warYInvertBug); +            drawTexQuad();  // this will render the texture flipped              // unbind the fbo              s_gl.glBindFramebufferOES(GL_FRAMEBUFFER_OES, 0); @@ -325,12 +309,12 @@ bool ColorBuffer::post()      s_gl.glBindTexture(GL_TEXTURE_2D, m_tex);      s_gl.glEnable(GL_TEXTURE_2D);      s_gl.glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); -    drawTexQuad(true); +    drawTexQuad();      return true;  } -void ColorBuffer::drawTexQuad(bool flipy) +void ColorBuffer::drawTexQuad()  {      GLfloat verts[] = { -1.0f, -1.0f, 0.0f,                           -1.0f, +1.0f, 0.0f, @@ -342,13 +326,6 @@ void ColorBuffer::drawTexQuad(bool flipy)                             1.0f, 1.0f,                             1.0f, 0.0f }; -    if (!flipy) { -        for (int i = 0; i < 4; i++) { -            // swap 0.0/1.0 in second element of each tcoord vector -            tcoords[2*i + 1] = tcoords[2*i + 1] == 0.0f ? 1.0f : 0.0f; -        } -    } -      s_gl.glClientActiveTexture(GL_TEXTURE0);      s_gl.glEnableClientState(GL_TEXTURE_COORD_ARRAY);      s_gl.glTexCoordPointer(2, GL_FLOAT, 0, tcoords); diff --git a/emulator/opengl/host/libs/libOpenglRender/ColorBuffer.h b/emulator/opengl/host/libs/libOpenglRender/ColorBuffer.h index d481891..883162b 100644 --- a/emulator/opengl/host/libs/libOpenglRender/ColorBuffer.h +++ b/emulator/opengl/host/libs/libOpenglRender/ColorBuffer.h @@ -41,7 +41,7 @@ public:  private:      ColorBuffer(); -    void drawTexQuad(bool flipy); +    void drawTexQuad();      bool bind_fbo();  // binds a fbo which have this texture as render target  private: @@ -53,7 +53,6 @@ private:      GLuint m_height;      GLuint m_fbo;      GLenum m_internalFormat; -    bool m_warYInvertBug;  };  typedef SmartPtr<ColorBuffer> ColorBufferPtr; | 
