aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Storsjo <martin@martin.st>2013-08-10 18:10:53 +0300
committerMartin Storsjo <martin@martin.st>2013-08-10 18:20:03 +0300
commit6aa81f9c3d516536eb27fcb4ca7e6d4f2ec1f5b1 (patch)
tree8331cfd149c587df2455adea5df44941ada133dc
parent57501158002f2b81b0aecec9ecf609970950ae85 (diff)
downloadsdk-6aa81f9c3d516536eb27fcb4ca7e6d4f2ec1f5b1.zip
sdk-6aa81f9c3d516536eb27fcb4ca7e6d4f2ec1f5b1.tar.gz
sdk-6aa81f9c3d516536eb27fcb4ca7e6d4f2ec1f5b1.tar.bz2
ColorBuffer: Remove the y-invert Intel GPU bug workaround
The fix in 57501158 makes sure pbuffers get initialized properly. The previously incorrect pbuffer texture parameters had different effects on different GPUs/drivers. On a Nvidia GT 650M, the buffers were rendered properly but glReadPixels calls were inverted, while Intel HD 3000/4000 seemed to get the rendering inverted as well. By passing proper pbuffer texture parameters, the bug (which in itself was no driver bug but inconsistent behaviour when given invalid parameters) vanishes. This reverts the bug workaround parts of 9322c5cb (from development.git). Change-Id: Ibc38147967361cba6ba85cdf3b4e9a2e2ee6d881
-rw-r--r--emulator/opengl/host/libs/libOpenglRender/ColorBuffer.cpp31
-rw-r--r--emulator/opengl/host/libs/libOpenglRender/ColorBuffer.h3
2 files changed, 5 insertions, 29 deletions
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;