diff options
author | Teng-Hui Zhu <ztenghui@google.com> | 2011-09-28 17:28:58 -0700 |
---|---|---|
committer | Teng-Hui Zhu <ztenghui@google.com> | 2011-09-30 10:48:22 -0700 |
commit | 9c68932a992e1d4697374eca5beee18005812424 (patch) | |
tree | e0a4a3ccdfd56346e3f30b529a830abe93d02377 | |
parent | a3d78debd21a173383183bacf55836fa9b87da1b (diff) | |
download | external_webkit-9c68932a992e1d4697374eca5beee18005812424.zip external_webkit-9c68932a992e1d4697374eca5beee18005812424.tar.gz external_webkit-9c68932a992e1d4697374eca5beee18005812424.tar.bz2 |
The new Gpu upload code path.
This relied on the hacky Surface Texture change:
https://android-git.corp.google.com/g/#/c/138516/
bug:5347539
Change-Id: I78e0f677a9c201ba49e11ddb24fa095471cbf3c9
-rw-r--r-- | Source/WebCore/platform/graphics/android/TransferQueue.cpp | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/Source/WebCore/platform/graphics/android/TransferQueue.cpp b/Source/WebCore/platform/graphics/android/TransferQueue.cpp index a857adb..47a85e6 100644 --- a/Source/WebCore/platform/graphics/android/TransferQueue.cpp +++ b/Source/WebCore/platform/graphics/android/TransferQueue.cpp @@ -52,6 +52,10 @@ #define ST_BUFFER_NUMBER 4 +// Set this to 1 if we would like to take the new GpuUpload approach which +// relied on the glCopyTexSubImage2D instead of a glDraw call +#define GPU_UPLOAD_WITHOUT_DRAW 0 + namespace WebCore { TransferQueue::TransferQueue() @@ -85,7 +89,11 @@ void TransferQueue::initSharedSurfaceTextures(int width, int height) if (!m_sharedSurfaceTextureId) { glGenTextures(1, &m_sharedSurfaceTextureId); m_sharedSurfaceTexture = +#if GPU_UPLOAD_WITHOUT_DRAW + new android::SurfaceTexture(m_sharedSurfaceTextureId, true, GL_TEXTURE_2D); +#else new android::SurfaceTexture(m_sharedSurfaceTextureId); +#endif m_ANW = new android::SurfaceTextureClient(m_sharedSurfaceTexture); m_sharedSurfaceTexture->setSynchronousMode(true); m_sharedSurfaceTexture->setBufferCount(ST_BUFFER_NUMBER+1); @@ -136,6 +144,18 @@ void TransferQueue::blitTileFromQueue(GLuint fboID, BaseTileTexture* destTex, GLuint srcTexId, GLenum srcTexTarget, int index) { +#if GPU_UPLOAD_WITHOUT_DRAW + glBindFramebuffer(GL_FRAMEBUFFER, fboID); + glFramebufferTexture2D(GL_FRAMEBUFFER, + GL_COLOR_ATTACHMENT0, + GL_TEXTURE_2D, + srcTexId, + 0); + glBindTexture(GL_TEXTURE_2D, destTex->m_ownTextureId); + glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, + destTex->getSize().width(), + destTex->getSize().height()); +#else // Then set up the FBO and copy the SurfTex content in. glBindFramebuffer(GL_FRAMEBUFFER, fboID); glFramebufferTexture2D(GL_FRAMEBUFFER, @@ -173,7 +193,7 @@ void TransferQueue::blitTileFromQueue(GLuint fboID, BaseTileTexture* destTex, 0); } GLUtils::checkEglError("CreateSyncKHR"); - GLUtils::checkGlError("copy the surface texture into the normal one"); +#endif } void TransferQueue::interruptTransferQueue(bool interrupt) @@ -326,6 +346,7 @@ void TransferQueue::updateDirtyBaseTiles() if (usedFboForUpload) { glBindFramebuffer(GL_FRAMEBUFFER, 0); // rebind the standard FBO restoreGLState(); + GLUtils::checkGlError("updateDirtyBaseTiles"); } m_emptyItemCount = ST_BUFFER_NUMBER; |