diff options
| author | 2010-10-01 00:25:02 -0700 | |
|---|---|---|
| committer | 2010-10-01 00:25:02 -0700 | |
| commit | 0bb5667b4ef91fefd0500fae0186789d15d54e0e (patch) | |
| tree | 92dfccfc1a428b6124e2a41061cde6a403976cd1 /libs/hwui/OpenGLRenderer.cpp | |
| parent | 557ed7aa290497fb5764acb3f577edbe78bad5b9 (diff) | |
Fix INVALID_OPERATION error with layers rendering.
This change is a workaround for a driver bug that causes an INVALID_OPERATION
to be thrown on every glCopyTexSubImage() call. This change also adds a new
test for gradients local matrices.
Change-Id: I41b7437481026702d0a3a9677f099b4557c0a84e
Diffstat (limited to 'libs/hwui/OpenGLRenderer.cpp')
| -rw-r--r-- | libs/hwui/OpenGLRenderer.cpp | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp index 23de3a5a3f6f..0810fb8ce87c 100644 --- a/libs/hwui/OpenGLRenderer.cpp +++ b/libs/hwui/OpenGLRenderer.cpp @@ -366,6 +366,8 @@ bool OpenGLRenderer::createLayer(sp<Snapshot> snapshot, float left, float top, return false; } + glActiveTexture(GL_TEXTURE0); + LayerSize size(bounds.getWidth(), bounds.getHeight()); Layer* layer = mCaches.layerCache.get(size); if (!layer) { @@ -383,17 +385,22 @@ bool OpenGLRenderer::createLayer(sp<Snapshot> snapshot, float left, float top, // Copy the framebuffer into the layer glBindTexture(GL_TEXTURE_2D, layer->texture); - if (layer->empty) { - glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, bounds.left, mHeight - bounds.bottom, - bounds.getWidth(), bounds.getHeight(), 0); - layer->empty = false; - } else { - glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, bounds.left, mHeight - bounds.bottom, - bounds.getWidth(), bounds.getHeight()); - } - - if (flags & SkCanvas::kClipToLayer_SaveFlag) { - if (mSnapshot->clipTransformed(bounds)) setScissorFromClip(); + // TODO: Workaround for b/3054204 + glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, bounds.left, mHeight - bounds.bottom, + bounds.getWidth(), bounds.getHeight(), 0); + + // TODO: Waiting for b/3054204 to be fixed +// if (layer->empty) { +// glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, bounds.left, mHeight - bounds.bottom, +// bounds.getWidth(), bounds.getHeight(), 0); +// layer->empty = false; +// } else { +// glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, bounds.left, mHeight - bounds.bottom, +// bounds.getWidth(), bounds.getHeight()); +// } + + if (flags & SkCanvas::kClipToLayer_SaveFlag && mSnapshot->clipTransformed(bounds)) { + setScissorFromClip(); } // Enqueue the buffer coordinates to clear the corresponding region later |