From 767d08948790527e9df951a752703938ff517d30 Mon Sep 17 00:00:00 2001 From: Jesse Hall Date: Fri, 2 Mar 2012 23:10:57 -0800 Subject: [PATCH] Delete dead code. Change-Id: I5b87fac4e2140a903221a1f68b16fa6a96e5effc --- .../host/libs/libOpenglRender/ColorBuffer.cpp | 57 ------------- .../host/libs/libOpenglRender/ColorBuffer.h | 2 - .../libs/libOpenglRender/WindowSurface.cpp | 80 ------------------- .../host/libs/libOpenglRender/WindowSurface.h | 1 - 4 files changed, 140 deletions(-) diff --git a/tools/emulator/opengl/host/libs/libOpenglRender/ColorBuffer.cpp b/tools/emulator/opengl/host/libs/libOpenglRender/ColorBuffer.cpp index 950ababee..87e7a24a4 100644 --- a/tools/emulator/opengl/host/libs/libOpenglRender/ColorBuffer.cpp +++ b/tools/emulator/opengl/host/libs/libOpenglRender/ColorBuffer.cpp @@ -131,17 +131,6 @@ ColorBuffer::~ColorBuffer() fb->unbind_locked(); } -void ColorBuffer::update(GLenum p_format, GLenum p_type, void *pixels) -{ - FrameBuffer *fb = FrameBuffer::getFB(); - if (!fb->bind_locked()) return; - s_gl.glBindTexture(GL_TEXTURE_2D, m_tex); - s_gl.glPixelStorei(GL_UNPACK_ALIGNMENT, 1); - s_gl.glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, - m_width, m_height, p_format, p_type, pixels); - fb->unbind_locked(); -} - void ColorBuffer::subUpdate(int x, int y, int width, int height, GLenum p_format, GLenum p_type, void *pixels) { FrameBuffer *fb = FrameBuffer::getFB(); @@ -153,52 +142,6 @@ void ColorBuffer::subUpdate(int x, int y, int width, int height, GLenum p_format fb->unbind_locked(); } -bool ColorBuffer::blitFromPbuffer(EGLSurface p_pbufSurface) -{ - FrameBuffer *fb = FrameBuffer::getFB(); - if (!fb->bind_locked()) return false; - - // - // bind FBO object which has this colorbuffer as render target - // - if (!bind_fbo()) { - fb->unbind_locked(); - return false; - } - - // - // bind the pbuffer to a temporary texture object - // - GLuint tempTex; - s_gl.glGenTextures(1, &tempTex); - s_gl.glBindTexture(GL_TEXTURE_2D, tempTex); - if (!s_egl.eglBindTexImage(fb->getDisplay(), p_pbufSurface, EGL_BACK_BUFFER)) { - printf("eglBindTexImage failed 0x%x\n", s_egl.eglGetError()); - s_gl.glDeleteTextures(1, &tempTex); - fb->unbind_locked(); - return false; - } - - s_gl.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - s_gl.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - s_gl.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); - s_gl.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); - s_gl.glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); - s_gl.glEnable(GL_TEXTURE_2D); - - drawTexQuad(); - - // - // unbind FBO, release the pbuffer and delete the temp texture object - // - s_gl.glBindFramebufferOES(GL_FRAMEBUFFER_OES, 0); - s_egl.eglReleaseTexImage(fb->getDisplay(), p_pbufSurface, EGL_BACK_BUFFER); - s_gl.glDeleteTextures(1, &tempTex); - - fb->unbind_locked(); - return true; -} - bool ColorBuffer::blitFromCurrentReadBuffer() { RenderThreadInfo *tInfo = getRenderThreadInfo(); diff --git a/tools/emulator/opengl/host/libs/libOpenglRender/ColorBuffer.h b/tools/emulator/opengl/host/libs/libOpenglRender/ColorBuffer.h index 5e01dccc5..16d1ee989 100644 --- a/tools/emulator/opengl/host/libs/libOpenglRender/ColorBuffer.h +++ b/tools/emulator/opengl/host/libs/libOpenglRender/ColorBuffer.h @@ -32,9 +32,7 @@ public: GLuint getWidth() const { return m_width; } GLuint getHeight() const { return m_height; } - void update(GLenum p_format, GLenum p_type, void *pixels); void subUpdate(int x, int y, int width, int height, GLenum p_format, GLenum p_type, void *pixels); - bool blitFromPbuffer(EGLSurface p_pbufSurface); bool post(); bool bindToTexture(); bool bindToRenderbuffer(); diff --git a/tools/emulator/opengl/host/libs/libOpenglRender/WindowSurface.cpp b/tools/emulator/opengl/host/libs/libOpenglRender/WindowSurface.cpp index b8d1bd280..367412062 100644 --- a/tools/emulator/opengl/host/libs/libOpenglRender/WindowSurface.cpp +++ b/tools/emulator/opengl/host/libs/libOpenglRender/WindowSurface.cpp @@ -84,8 +84,6 @@ WindowSurface *WindowSurface::create(int p_config, int p_width, int p_height) void WindowSurface::flushColorBuffer() { if (m_attachedColorBuffer.Ptr() != NULL) { - - //copyToColorBuffer(); blitToColorBuffer(); } } @@ -142,84 +140,6 @@ void WindowSurface::bind(RenderContextPtr p_ctx, SurfaceBindType p_bindType) } -void WindowSurface::copyToColorBuffer() -{ - if (!m_width && !m_height) return; - - if (m_attachedColorBuffer->getWidth() != m_width || - m_attachedColorBuffer->getHeight() != m_height) { - // XXX: should never happen - how this needs to be handled? - return; - } - - void *data = m_xferBuffer.alloc(m_width * m_height * 4); - if (!data) { - fprintf(stderr,"WARNING: Failed to copy buffer data - OutOfMemory\n"); - return; - } - - // - // Make the surface current - // - EGLContext prevContext = s_egl.eglGetCurrentContext(); - EGLSurface prevReadSurf = s_egl.eglGetCurrentSurface(EGL_READ); - EGLSurface prevDrawSurf = s_egl.eglGetCurrentSurface(EGL_DRAW); - FrameBuffer *fb = FrameBuffer::getFB(); - if (!s_egl.eglMakeCurrent(fb->getDisplay(), m_eglSurface, - m_eglSurface, m_drawContext->getEGLContext())) { - return; - } - - if (m_drawContext->isGL2()) { -#ifdef WITH_GLES2 - s_gl2.glPixelStorei(GL_PACK_ALIGNMENT, 1); - s_gl2.glReadPixels(0, 0, m_width, m_height, - GL_RGBA, GL_UNSIGNED_BYTE, data); -#else - return; // should never happen, context cannot be GL2 in this case. -#endif - } - else { - s_gl.glPixelStorei(GL_PACK_ALIGNMENT, 1); - s_gl.glReadPixels(0, 0, m_width, m_height, - GL_RGBA, GL_UNSIGNED_BYTE, data); - } - -// -// XXX: for some reason flipping the image is not required on -// Mac. Need to find the reason, currently unkbown. -// -#ifndef __APPLE__ -#define FLIP_BUFFER 1 -#endif - -#if FLIP_BUFFER - //We need to flip the pixels - int bpp = 4; - void *tmpBuf = m_xUpdateBuf.alloc(m_width * m_height * bpp); - - int dst_line_len = m_width * bpp; - int src_line_len = m_width * bpp; - char *src = (char *)data; - char *dst = (char*)tmpBuf + (m_height-1)*dst_line_len; - for (uint32_t y=0; yupdate(GL_RGBA, GL_UNSIGNED_BYTE, tmpBuf); -#else - // update the attached color buffer with the readback pixels - m_attachedColorBuffer->update(GL_RGBA, GL_UNSIGNED_BYTE, data); -#endif - - // restore current context/surface - s_egl.eglMakeCurrent(fb->getDisplay(), prevDrawSurf, - prevReadSurf, prevContext); - -} - void WindowSurface::blitToColorBuffer() { if (!m_width && !m_height) return; diff --git a/tools/emulator/opengl/host/libs/libOpenglRender/WindowSurface.h b/tools/emulator/opengl/host/libs/libOpenglRender/WindowSurface.h index 6c089540e..1b655c93a 100644 --- a/tools/emulator/opengl/host/libs/libOpenglRender/WindowSurface.h +++ b/tools/emulator/opengl/host/libs/libOpenglRender/WindowSurface.h @@ -44,7 +44,6 @@ public: private: WindowSurface(); - void copyToColorBuffer(); // copy pbuffer content with readback+download void blitToColorBuffer(); // copy pbuffer content with texload and blit bool resizePbuffer(unsigned int p_width, unsigned int p_height);