Romain Guy | 6c319ca | 2011-01-11 14:29:25 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2011 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | #define LOG_TAG "OpenGLRenderer" |
John Reck | ec4cefc | 2014-07-29 09:49:13 -0700 | [diff] [blame] | 18 | #define ATRACE_TAG ATRACE_TAG_VIEW |
Romain Guy | 6c319ca | 2011-01-11 14:29:25 -0800 | [diff] [blame] | 19 | |
Romain Guy | 3a3133d | 2011-02-01 22:59:58 -0800 | [diff] [blame] | 20 | #include <ui/Rect.h> |
| 21 | |
Romain Guy | 7c25aab | 2012-10-18 15:05:02 -0700 | [diff] [blame] | 22 | #include <private/hwui/DrawGlInfo.h> |
| 23 | |
John Reck | 3b20251 | 2014-06-23 13:13:08 -0700 | [diff] [blame] | 24 | #include "RenderState.h" |
Romain Guy | 09b7c91 | 2011-02-02 20:28:09 -0800 | [diff] [blame] | 25 | #include "LayerCache.h" |
Romain Guy | 6c319ca | 2011-01-11 14:29:25 -0800 | [diff] [blame] | 26 | #include "LayerRenderer.h" |
Romain Guy | aa6c24c | 2011-04-28 18:40:04 -0700 | [diff] [blame] | 27 | #include "Matrix.h" |
Romain Guy | 1fc883b | 2011-01-12 14:30:59 -0800 | [diff] [blame] | 28 | #include "Properties.h" |
Romain Guy | 3a3133d | 2011-02-01 22:59:58 -0800 | [diff] [blame] | 29 | #include "Rect.h" |
Chris Craik | 70850ea | 2014-11-18 10:49:23 -0800 | [diff] [blame] | 30 | #include "utils/TraceUtils.h" |
Romain Guy | 6c319ca | 2011-01-11 14:29:25 -0800 | [diff] [blame] | 31 | |
| 32 | namespace android { |
| 33 | namespace uirenderer { |
| 34 | |
| 35 | /////////////////////////////////////////////////////////////////////////////// |
| 36 | // Rendering |
| 37 | /////////////////////////////////////////////////////////////////////////////// |
| 38 | |
John Reck | 3b20251 | 2014-06-23 13:13:08 -0700 | [diff] [blame] | 39 | LayerRenderer::LayerRenderer(RenderState& renderState, Layer* layer) |
| 40 | : OpenGLRenderer(renderState) |
| 41 | , mLayer(layer) { |
Romain Guy | 7953745 | 2011-10-12 13:48:51 -0700 | [diff] [blame] | 42 | } |
| 43 | |
| 44 | LayerRenderer::~LayerRenderer() { |
| 45 | } |
| 46 | |
Tom Hudson | 107843d | 2014-09-08 11:26:26 -0400 | [diff] [blame] | 47 | void LayerRenderer::prepareDirty(float left, float top, float right, float bottom, |
Romain Guy | 7c25aab | 2012-10-18 15:05:02 -0700 | [diff] [blame] | 48 | bool opaque) { |
Romain Guy | 9ace8f5 | 2011-07-07 20:50:11 -0700 | [diff] [blame] | 49 | LAYER_RENDERER_LOGD("Rendering into layer, fbo = %d", mLayer->getFbo()); |
Romain Guy | 1fc883b | 2011-01-12 14:30:59 -0800 | [diff] [blame] | 50 | |
John Reck | 3b20251 | 2014-06-23 13:13:08 -0700 | [diff] [blame] | 51 | renderState().bindFramebuffer(mLayer->getFbo()); |
Romain Guy | 62687ec | 2011-02-02 15:44:19 -0800 | [diff] [blame] | 52 | |
Romain Guy | 09b7c91 | 2011-02-02 20:28:09 -0800 | [diff] [blame] | 53 | const float width = mLayer->layer.getWidth(); |
| 54 | const float height = mLayer->layer.getHeight(); |
| 55 | |
Romain Guy | 3a3133d | 2011-02-01 22:59:58 -0800 | [diff] [blame] | 56 | Rect dirty(left, top, right, bottom); |
| 57 | if (dirty.isEmpty() || (dirty.left <= 0 && dirty.top <= 0 && |
Romain Guy | 09b7c91 | 2011-02-02 20:28:09 -0800 | [diff] [blame] | 58 | dirty.right >= width && dirty.bottom >= height)) { |
Romain Guy | 3a3133d | 2011-02-01 22:59:58 -0800 | [diff] [blame] | 59 | mLayer->region.clear(); |
Romain Guy | 09b7c91 | 2011-02-02 20:28:09 -0800 | [diff] [blame] | 60 | dirty.set(0.0f, 0.0f, width, height); |
Romain Guy | 3a3133d | 2011-02-01 22:59:58 -0800 | [diff] [blame] | 61 | } else { |
Romain Guy | 09b7c91 | 2011-02-02 20:28:09 -0800 | [diff] [blame] | 62 | dirty.intersect(0.0f, 0.0f, width, height); |
Romain Guy | 3a3133d | 2011-02-01 22:59:58 -0800 | [diff] [blame] | 63 | android::Rect r(dirty.left, dirty.top, dirty.right, dirty.bottom); |
| 64 | mLayer->region.subtractSelf(r); |
| 65 | } |
Romain Guy | c3fedaf | 2013-01-29 17:26:25 -0800 | [diff] [blame] | 66 | mLayer->clipRect.set(dirty); |
Romain Guy | c88e357 | 2011-01-22 00:32:12 -0800 | [diff] [blame] | 67 | |
Tom Hudson | 107843d | 2014-09-08 11:26:26 -0400 | [diff] [blame] | 68 | OpenGLRenderer::prepareDirty(dirty.left, dirty.top, dirty.right, dirty.bottom, opaque); |
Romain Guy | 6c319ca | 2011-01-11 14:29:25 -0800 | [diff] [blame] | 69 | } |
| 70 | |
Tom Hudson | 107843d | 2014-09-08 11:26:26 -0400 | [diff] [blame] | 71 | void LayerRenderer::clear(float left, float top, float right, float bottom, bool opaque) { |
Romain Guy | 7c25aab | 2012-10-18 15:05:02 -0700 | [diff] [blame] | 72 | if (mLayer->isDirty()) { |
| 73 | getCaches().disableScissor(); |
| 74 | glClear(GL_COLOR_BUFFER_BIT); |
| 75 | |
| 76 | getCaches().resetScissor(); |
| 77 | mLayer->setDirty(false); |
Tom Hudson | 107843d | 2014-09-08 11:26:26 -0400 | [diff] [blame] | 78 | } else { |
| 79 | OpenGLRenderer::clear(left, top, right, bottom, opaque); |
Romain Guy | 7c25aab | 2012-10-18 15:05:02 -0700 | [diff] [blame] | 80 | } |
Romain Guy | 7c25aab | 2012-10-18 15:05:02 -0700 | [diff] [blame] | 81 | } |
| 82 | |
Tom Hudson | 107843d | 2014-09-08 11:26:26 -0400 | [diff] [blame] | 83 | bool LayerRenderer::finish() { |
| 84 | bool retval = OpenGLRenderer::finish(); |
Romain Guy | 1fc883b | 2011-01-12 14:30:59 -0800 | [diff] [blame] | 85 | |
Romain Guy | f219da5 | 2011-01-16 12:54:25 -0800 | [diff] [blame] | 86 | generateMesh(); |
| 87 | |
Romain Guy | 9ace8f5 | 2011-07-07 20:50:11 -0700 | [diff] [blame] | 88 | LAYER_RENDERER_LOGD("Finished rendering into layer, fbo = %d", mLayer->getFbo()); |
Romain Guy | 42f3a4b | 2011-01-19 13:42:26 -0800 | [diff] [blame] | 89 | |
| 90 | // No need to unbind our FBO, this will be taken care of by the caller |
| 91 | // who will invoke OpenGLRenderer::resume() |
Tom Hudson | 107843d | 2014-09-08 11:26:26 -0400 | [diff] [blame] | 92 | return retval; |
Romain Guy | 42f3a4b | 2011-01-19 13:42:26 -0800 | [diff] [blame] | 93 | } |
| 94 | |
Tom Hudson | 984162f | 2014-10-10 13:38:16 -0400 | [diff] [blame] | 95 | GLuint LayerRenderer::onGetTargetFbo() const { |
Romain Guy | 9ace8f5 | 2011-07-07 20:50:11 -0700 | [diff] [blame] | 96 | return mLayer->getFbo(); |
Romain Guy | 6c319ca | 2011-01-11 14:29:25 -0800 | [diff] [blame] | 97 | } |
| 98 | |
Romain Guy | 624234f | 2013-03-05 16:43:31 -0800 | [diff] [blame] | 99 | bool LayerRenderer::suppressErrorChecks() const { |
Romain Guy | 11cb642 | 2012-09-21 00:39:43 -0700 | [diff] [blame] | 100 | return true; |
| 101 | } |
| 102 | |
Romain Guy | 6c319ca | 2011-01-11 14:29:25 -0800 | [diff] [blame] | 103 | /////////////////////////////////////////////////////////////////////////////// |
Romain Guy | 8ce0030 | 2013-01-15 18:51:42 -0800 | [diff] [blame] | 104 | // Layer support |
Romain Guy | f219da5 | 2011-01-16 12:54:25 -0800 | [diff] [blame] | 105 | /////////////////////////////////////////////////////////////////////////////// |
| 106 | |
Romain Guy | 624234f | 2013-03-05 16:43:31 -0800 | [diff] [blame] | 107 | bool LayerRenderer::hasLayer() const { |
Romain Guy | f219da5 | 2011-01-16 12:54:25 -0800 | [diff] [blame] | 108 | return true; |
| 109 | } |
| 110 | |
Romain Guy | 8ce0030 | 2013-01-15 18:51:42 -0800 | [diff] [blame] | 111 | void LayerRenderer::ensureStencilBuffer() { |
| 112 | attachStencilBufferToLayer(mLayer); |
| 113 | } |
| 114 | |
| 115 | /////////////////////////////////////////////////////////////////////////////// |
| 116 | // Dirty region tracking |
| 117 | /////////////////////////////////////////////////////////////////////////////// |
| 118 | |
Romain Guy | 624234f | 2013-03-05 16:43:31 -0800 | [diff] [blame] | 119 | Region* LayerRenderer::getRegion() const { |
Tom Hudson | 984162f | 2014-10-10 13:38:16 -0400 | [diff] [blame] | 120 | if (mState.currentFlags() & Snapshot::kFlagFboTarget) { |
Romain Guy | f219da5 | 2011-01-16 12:54:25 -0800 | [diff] [blame] | 121 | return OpenGLRenderer::getRegion(); |
| 122 | } |
| 123 | return &mLayer->region; |
Romain Guy | f219da5 | 2011-01-16 12:54:25 -0800 | [diff] [blame] | 124 | } |
| 125 | |
Chris Craik | 6c5b9be | 2013-02-27 14:03:19 -0800 | [diff] [blame] | 126 | // TODO: This implementation uses a very simple approach to fixing T-junctions which keeps the |
| 127 | // results as rectangles, and is thus not necessarily efficient in the geometry |
| 128 | // produced. Eventually, it may be better to develop triangle-based mechanism. |
Romain Guy | f219da5 | 2011-01-16 12:54:25 -0800 | [diff] [blame] | 129 | void LayerRenderer::generateMesh() { |
Romain Guy | f219da5 | 2011-01-16 12:54:25 -0800 | [diff] [blame] | 130 | if (mLayer->region.isRect() || mLayer->region.isEmpty()) { |
| 131 | if (mLayer->mesh) { |
Romain Guy | 96885eb | 2013-03-26 15:05:58 -0700 | [diff] [blame] | 132 | delete[] mLayer->mesh; |
Chris Craik | d41c4d8 | 2015-01-05 15:51:13 -0800 | [diff] [blame^] | 133 | mLayer->mesh = nullptr; |
Romain Guy | f219da5 | 2011-01-16 12:54:25 -0800 | [diff] [blame] | 134 | mLayer->meshElementCount = 0; |
| 135 | } |
Romain Guy | 4066767 | 2011-03-18 14:34:03 -0700 | [diff] [blame] | 136 | |
Romain Guy | 9fc2781 | 2011-04-27 14:21:41 -0700 | [diff] [blame] | 137 | mLayer->setRegionAsRect(); |
Romain Guy | f219da5 | 2011-01-16 12:54:25 -0800 | [diff] [blame] | 138 | return; |
| 139 | } |
| 140 | |
Chris Craik | 6c5b9be | 2013-02-27 14:03:19 -0800 | [diff] [blame] | 141 | // avoid T-junctions as they cause artifacts in between the resultant |
| 142 | // geometry when complex transforms occur. |
| 143 | // TODO: generate the safeRegion only if necessary based on drawing transform (see |
| 144 | // OpenGLRenderer::composeLayerRegion()) |
| 145 | Region safeRegion = Region::createTJunctionFreeRegion(mLayer->region); |
| 146 | |
Romain Guy | f219da5 | 2011-01-16 12:54:25 -0800 | [diff] [blame] | 147 | size_t count; |
Chris Craik | 6c5b9be | 2013-02-27 14:03:19 -0800 | [diff] [blame] | 148 | const android::Rect* rects = safeRegion.getArray(&count); |
Romain Guy | f219da5 | 2011-01-16 12:54:25 -0800 | [diff] [blame] | 149 | |
| 150 | GLsizei elementCount = count * 6; |
| 151 | |
| 152 | if (mLayer->mesh && mLayer->meshElementCount < elementCount) { |
Romain Guy | 96885eb | 2013-03-26 15:05:58 -0700 | [diff] [blame] | 153 | delete[] mLayer->mesh; |
Chris Craik | d41c4d8 | 2015-01-05 15:51:13 -0800 | [diff] [blame^] | 154 | mLayer->mesh = nullptr; |
Romain Guy | f219da5 | 2011-01-16 12:54:25 -0800 | [diff] [blame] | 155 | } |
| 156 | |
| 157 | if (!mLayer->mesh) { |
| 158 | mLayer->mesh = new TextureVertex[count * 4]; |
Romain Guy | f219da5 | 2011-01-16 12:54:25 -0800 | [diff] [blame] | 159 | } |
Romain Guy | 4f09f54 | 2011-01-26 22:41:43 -0800 | [diff] [blame] | 160 | mLayer->meshElementCount = elementCount; |
Romain Guy | f219da5 | 2011-01-16 12:54:25 -0800 | [diff] [blame] | 161 | |
Romain Guy | 9ace8f5 | 2011-07-07 20:50:11 -0700 | [diff] [blame] | 162 | const float texX = 1.0f / float(mLayer->getWidth()); |
| 163 | const float texY = 1.0f / float(mLayer->getHeight()); |
Romain Guy | f219da5 | 2011-01-16 12:54:25 -0800 | [diff] [blame] | 164 | const float height = mLayer->layer.getHeight(); |
| 165 | |
| 166 | TextureVertex* mesh = mLayer->mesh; |
Romain Guy | f219da5 | 2011-01-16 12:54:25 -0800 | [diff] [blame] | 167 | |
| 168 | for (size_t i = 0; i < count; i++) { |
| 169 | const android::Rect* r = &rects[i]; |
| 170 | |
| 171 | const float u1 = r->left * texX; |
| 172 | const float v1 = (height - r->top) * texY; |
| 173 | const float u2 = r->right * texX; |
| 174 | const float v2 = (height - r->bottom) * texY; |
| 175 | |
| 176 | TextureVertex::set(mesh++, r->left, r->top, u1, v1); |
| 177 | TextureVertex::set(mesh++, r->right, r->top, u2, v1); |
| 178 | TextureVertex::set(mesh++, r->left, r->bottom, u1, v2); |
| 179 | TextureVertex::set(mesh++, r->right, r->bottom, u2, v2); |
Romain Guy | f219da5 | 2011-01-16 12:54:25 -0800 | [diff] [blame] | 180 | } |
Romain Guy | f219da5 | 2011-01-16 12:54:25 -0800 | [diff] [blame] | 181 | } |
| 182 | |
| 183 | /////////////////////////////////////////////////////////////////////////////// |
| 184 | // Layers management |
Romain Guy | 6c319ca | 2011-01-11 14:29:25 -0800 | [diff] [blame] | 185 | /////////////////////////////////////////////////////////////////////////////// |
| 186 | |
John Reck | 3b20251 | 2014-06-23 13:13:08 -0700 | [diff] [blame] | 187 | Layer* LayerRenderer::createRenderLayer(RenderState& renderState, uint32_t width, uint32_t height) { |
Chris Craik | 70850ea | 2014-11-18 10:49:23 -0800 | [diff] [blame] | 188 | ATRACE_FORMAT("Allocate %ux%u HW Layer", width, height); |
Romain Guy | eea6069 | 2011-07-26 20:35:55 -0700 | [diff] [blame] | 189 | LAYER_RENDERER_LOGD("Requesting new render layer %dx%d", width, height); |
Romain Guy | 1fc883b | 2011-01-12 14:30:59 -0800 | [diff] [blame] | 190 | |
Romain Guy | a1d3c91 | 2011-12-13 14:55:06 -0800 | [diff] [blame] | 191 | Caches& caches = Caches::getInstance(); |
| 192 | GLuint fbo = caches.fboCache.get(); |
Romain Guy | 09b7c91 | 2011-02-02 20:28:09 -0800 | [diff] [blame] | 193 | if (!fbo) { |
Steve Block | 8564c8d | 2012-01-05 23:22:43 +0000 | [diff] [blame] | 194 | ALOGW("Could not obtain an FBO"); |
Chris Craik | d41c4d8 | 2015-01-05 15:51:13 -0800 | [diff] [blame^] | 195 | return nullptr; |
Romain Guy | 09b7c91 | 2011-02-02 20:28:09 -0800 | [diff] [blame] | 196 | } |
| 197 | |
Romain Guy | a1d3c91 | 2011-12-13 14:55:06 -0800 | [diff] [blame] | 198 | caches.activeTexture(0); |
John Reck | 3b20251 | 2014-06-23 13:13:08 -0700 | [diff] [blame] | 199 | Layer* layer = caches.layerCache.get(renderState, width, height); |
Romain Guy | 09b7c91 | 2011-02-02 20:28:09 -0800 | [diff] [blame] | 200 | if (!layer) { |
Steve Block | 8564c8d | 2012-01-05 23:22:43 +0000 | [diff] [blame] | 201 | ALOGW("Could not obtain a layer"); |
Chris Craik | d41c4d8 | 2015-01-05 15:51:13 -0800 | [diff] [blame^] | 202 | return nullptr; |
Romain Guy | 09b7c91 | 2011-02-02 20:28:09 -0800 | [diff] [blame] | 203 | } |
| 204 | |
Romain Guy | ce4a7df | 2013-03-28 11:32:33 -0700 | [diff] [blame] | 205 | // We first obtain a layer before comparing against the max texture size |
| 206 | // because layers are not allocated at the exact desired size. They are |
| 207 | // always created slighly larger to improve recycling |
| 208 | const uint32_t maxTextureSize = caches.maxTextureSize; |
| 209 | if (layer->getWidth() > maxTextureSize || layer->getHeight() > maxTextureSize) { |
| 210 | ALOGW("Layer exceeds max. dimensions supported by the GPU (%dx%d, max=%dx%d)", |
| 211 | width, height, maxTextureSize, maxTextureSize); |
| 212 | |
| 213 | // Creating a new layer always increment its refcount by 1, this allows |
| 214 | // us to destroy the layer object if one was created for us |
Chris Craik | d41c4d8 | 2015-01-05 15:51:13 -0800 | [diff] [blame^] | 215 | layer->decStrong(nullptr); |
Romain Guy | ce4a7df | 2013-03-28 11:32:33 -0700 | [diff] [blame] | 216 | |
Chris Craik | d41c4d8 | 2015-01-05 15:51:13 -0800 | [diff] [blame^] | 217 | return nullptr; |
Romain Guy | ce4a7df | 2013-03-28 11:32:33 -0700 | [diff] [blame] | 218 | } |
| 219 | |
Romain Guy | 9ace8f5 | 2011-07-07 20:50:11 -0700 | [diff] [blame] | 220 | layer->setFbo(fbo); |
Romain Guy | 09b7c91 | 2011-02-02 20:28:09 -0800 | [diff] [blame] | 221 | layer->layer.set(0.0f, 0.0f, width, height); |
Romain Guy | 9ace8f5 | 2011-07-07 20:50:11 -0700 | [diff] [blame] | 222 | layer->texCoords.set(0.0f, height / float(layer->getHeight()), |
| 223 | width / float(layer->getWidth()), 0.0f); |
| 224 | layer->setAlpha(255, SkXfermode::kSrcOver_Mode); |
Chris Craik | d41c4d8 | 2015-01-05 15:51:13 -0800 | [diff] [blame^] | 225 | layer->setColorFilter(nullptr); |
Romain Guy | 7c25aab | 2012-10-18 15:05:02 -0700 | [diff] [blame] | 226 | layer->setDirty(true); |
Romain Guy | 09b7c91 | 2011-02-02 20:28:09 -0800 | [diff] [blame] | 227 | layer->region.clear(); |
Romain Guy | ada830f | 2011-01-13 12:13:20 -0800 | [diff] [blame] | 228 | |
John Reck | 3b20251 | 2014-06-23 13:13:08 -0700 | [diff] [blame] | 229 | GLuint previousFbo = renderState.getFramebuffer(); |
Romain Guy | 6c319ca | 2011-01-11 14:29:25 -0800 | [diff] [blame] | 230 | |
John Reck | 3b20251 | 2014-06-23 13:13:08 -0700 | [diff] [blame] | 231 | renderState.bindFramebuffer(layer->getFbo()); |
Romain Guy | 9ace8f5 | 2011-07-07 20:50:11 -0700 | [diff] [blame] | 232 | layer->bindTexture(); |
Romain Guy | 6c319ca | 2011-01-11 14:29:25 -0800 | [diff] [blame] | 233 | |
Romain Guy | 09b7c91 | 2011-02-02 20:28:09 -0800 | [diff] [blame] | 234 | // Initialize the texture if needed |
Romain Guy | 9ace8f5 | 2011-07-07 20:50:11 -0700 | [diff] [blame] | 235 | if (layer->isEmpty()) { |
| 236 | layer->setEmpty(false); |
Romain Guy | 0908764 | 2013-04-04 12:27:54 -0700 | [diff] [blame] | 237 | layer->allocateTexture(); |
Romain Guy | 6c319ca | 2011-01-11 14:29:25 -0800 | [diff] [blame] | 238 | |
Romain Guy | ce4a7df | 2013-03-28 11:32:33 -0700 | [diff] [blame] | 239 | // This should only happen if we run out of memory |
Romain Guy | 09b7c91 | 2011-02-02 20:28:09 -0800 | [diff] [blame] | 240 | if (glGetError() != GL_NO_ERROR) { |
Romain Guy | ce4a7df | 2013-03-28 11:32:33 -0700 | [diff] [blame] | 241 | ALOGE("Could not allocate texture for layer (fbo=%d %dx%d)", fbo, width, height); |
John Reck | 3b20251 | 2014-06-23 13:13:08 -0700 | [diff] [blame] | 242 | renderState.bindFramebuffer(previousFbo); |
Chris Craik | d41c4d8 | 2015-01-05 15:51:13 -0800 | [diff] [blame^] | 243 | layer->decStrong(nullptr); |
| 244 | return nullptr; |
Romain Guy | 09b7c91 | 2011-02-02 20:28:09 -0800 | [diff] [blame] | 245 | } |
Romain Guy | 6c319ca | 2011-01-11 14:29:25 -0800 | [diff] [blame] | 246 | } |
| 247 | |
| 248 | glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, |
Romain Guy | 9ace8f5 | 2011-07-07 20:50:11 -0700 | [diff] [blame] | 249 | layer->getTexture(), 0); |
Romain Guy | 6c319ca | 2011-01-11 14:29:25 -0800 | [diff] [blame] | 250 | |
John Reck | 3b20251 | 2014-06-23 13:13:08 -0700 | [diff] [blame] | 251 | renderState.bindFramebuffer(previousFbo); |
Romain Guy | 6c319ca | 2011-01-11 14:29:25 -0800 | [diff] [blame] | 252 | |
Romain Guy | ada830f | 2011-01-13 12:13:20 -0800 | [diff] [blame] | 253 | return layer; |
Romain Guy | 6c319ca | 2011-01-11 14:29:25 -0800 | [diff] [blame] | 254 | } |
| 255 | |
Romain Guy | ada830f | 2011-01-13 12:13:20 -0800 | [diff] [blame] | 256 | bool LayerRenderer::resizeLayer(Layer* layer, uint32_t width, uint32_t height) { |
| 257 | if (layer) { |
Romain Guy | 9ace8f5 | 2011-07-07 20:50:11 -0700 | [diff] [blame] | 258 | LAYER_RENDERER_LOGD("Resizing layer fbo = %d to %dx%d", layer->getFbo(), width, height); |
Romain Guy | 1fc883b | 2011-01-12 14:30:59 -0800 | [diff] [blame] | 259 | |
Romain Guy | 2055aba | 2013-01-18 16:42:51 -0800 | [diff] [blame] | 260 | if (layer->resize(width, height)) { |
Romain Guy | 09b7c91 | 2011-02-02 20:28:09 -0800 | [diff] [blame] | 261 | layer->layer.set(0.0f, 0.0f, width, height); |
Romain Guy | 9ace8f5 | 2011-07-07 20:50:11 -0700 | [diff] [blame] | 262 | layer->texCoords.set(0.0f, height / float(layer->getHeight()), |
| 263 | width / float(layer->getWidth()), 0.0f); |
Romain Guy | 09b7c91 | 2011-02-02 20:28:09 -0800 | [diff] [blame] | 264 | } else { |
Romain Guy | ada830f | 2011-01-13 12:13:20 -0800 | [diff] [blame] | 265 | return false; |
| 266 | } |
Romain Guy | 6c319ca | 2011-01-11 14:29:25 -0800 | [diff] [blame] | 267 | } |
Romain Guy | 09b7c91 | 2011-02-02 20:28:09 -0800 | [diff] [blame] | 268 | |
Romain Guy | ada830f | 2011-01-13 12:13:20 -0800 | [diff] [blame] | 269 | return true; |
Romain Guy | 6c319ca | 2011-01-11 14:29:25 -0800 | [diff] [blame] | 270 | } |
| 271 | |
John Reck | 3b20251 | 2014-06-23 13:13:08 -0700 | [diff] [blame] | 272 | Layer* LayerRenderer::createTextureLayer(RenderState& renderState) { |
Romain Guy | 4a5a715 | 2011-06-24 17:53:53 -0700 | [diff] [blame] | 273 | LAYER_RENDERER_LOGD("Creating new texture layer"); |
| 274 | |
Chris Craik | 8a226d2 | 2014-09-08 16:40:21 -0700 | [diff] [blame] | 275 | Layer* layer = new Layer(Layer::kType_Texture, renderState, 0, 0); |
Romain Guy | 9ace8f5 | 2011-07-07 20:50:11 -0700 | [diff] [blame] | 276 | layer->setCacheable(false); |
Romain Guy | 9ace8f5 | 2011-07-07 20:50:11 -0700 | [diff] [blame] | 277 | layer->setEmpty(true); |
| 278 | layer->setFbo(0); |
| 279 | layer->setAlpha(255, SkXfermode::kSrcOver_Mode); |
Romain Guy | 4a5a715 | 2011-06-24 17:53:53 -0700 | [diff] [blame] | 280 | layer->layer.set(0.0f, 0.0f, 0.0f, 0.0f); |
Romain Guy | a9dc86b | 2011-10-11 14:06:21 -0700 | [diff] [blame] | 281 | layer->texCoords.set(0.0f, 1.0f, 1.0f, 0.0f); |
Romain Guy | 4a5a715 | 2011-06-24 17:53:53 -0700 | [diff] [blame] | 282 | layer->region.clear(); |
Romain Guy | 9ace8f5 | 2011-07-07 20:50:11 -0700 | [diff] [blame] | 283 | layer->setRenderTarget(GL_NONE); // see ::updateTextureLayer() |
Romain Guy | 4a5a715 | 2011-06-24 17:53:53 -0700 | [diff] [blame] | 284 | |
Romain Guy | a1d3c91 | 2011-12-13 14:55:06 -0800 | [diff] [blame] | 285 | Caches::getInstance().activeTexture(0); |
Romain Guy | 9ace8f5 | 2011-07-07 20:50:11 -0700 | [diff] [blame] | 286 | layer->generateTexture(); |
Romain Guy | 4a5a715 | 2011-06-24 17:53:53 -0700 | [diff] [blame] | 287 | |
| 288 | return layer; |
| 289 | } |
| 290 | |
Romain Guy | aa6c24c | 2011-04-28 18:40:04 -0700 | [diff] [blame] | 291 | void LayerRenderer::updateTextureLayer(Layer* layer, uint32_t width, uint32_t height, |
Chris Craik | 9757ac0 | 2014-02-25 18:50:17 -0800 | [diff] [blame] | 292 | bool isOpaque, bool forceFilter, GLenum renderTarget, float* textureTransform) { |
Romain Guy | aa6c24c | 2011-04-28 18:40:04 -0700 | [diff] [blame] | 293 | if (layer) { |
Romain Guy | 9ace8f5 | 2011-07-07 20:50:11 -0700 | [diff] [blame] | 294 | layer->setBlend(!isOpaque); |
Chris Craik | 9757ac0 | 2014-02-25 18:50:17 -0800 | [diff] [blame] | 295 | layer->setForceFilter(forceFilter); |
Romain Guy | 9ace8f5 | 2011-07-07 20:50:11 -0700 | [diff] [blame] | 296 | layer->setSize(width, height); |
Romain Guy | aa6c24c | 2011-04-28 18:40:04 -0700 | [diff] [blame] | 297 | layer->layer.set(0.0f, 0.0f, width, height); |
| 298 | layer->region.set(width, height); |
| 299 | layer->regionRect.set(0.0f, 0.0f, width, height); |
Chris Craik | 9757ac0 | 2014-02-25 18:50:17 -0800 | [diff] [blame] | 300 | layer->getTexTransform().load(textureTransform); |
Romain Guy | 8f0095c | 2011-05-02 17:24:22 -0700 | [diff] [blame] | 301 | |
Romain Guy | 9ace8f5 | 2011-07-07 20:50:11 -0700 | [diff] [blame] | 302 | if (renderTarget != layer->getRenderTarget()) { |
| 303 | layer->setRenderTarget(renderTarget); |
| 304 | layer->bindTexture(); |
Romain Guy | d21b6e1 | 2011-11-30 20:21:23 -0800 | [diff] [blame] | 305 | layer->setFilter(GL_NEAREST, false, true); |
| 306 | layer->setWrap(GL_CLAMP_TO_EDGE, false, true); |
Romain Guy | 4a5a715 | 2011-06-24 17:53:53 -0700 | [diff] [blame] | 307 | } |
Romain Guy | aa6c24c | 2011-04-28 18:40:04 -0700 | [diff] [blame] | 308 | } |
| 309 | } |
| 310 | |
Romain Guy | ada830f | 2011-01-13 12:13:20 -0800 | [diff] [blame] | 311 | void LayerRenderer::destroyLayer(Layer* layer) { |
| 312 | if (layer) { |
Chris Craik | 70850ea | 2014-11-18 10:49:23 -0800 | [diff] [blame] | 313 | ATRACE_FORMAT("Destroy %ux%u HW Layer", layer->getWidth(), layer->getHeight()); |
Romain Guy | eea6069 | 2011-07-26 20:35:55 -0700 | [diff] [blame] | 314 | LAYER_RENDERER_LOGD("Recycling layer, %dx%d fbo = %d", |
| 315 | layer->getWidth(), layer->getHeight(), layer->getFbo()); |
Romain Guy | 1fc883b | 2011-01-12 14:30:59 -0800 | [diff] [blame] | 316 | |
Romain Guy | 09b7c91 | 2011-02-02 20:28:09 -0800 | [diff] [blame] | 317 | if (!Caches::getInstance().layerCache.put(layer)) { |
Romain Guy | eea6069 | 2011-07-26 20:35:55 -0700 | [diff] [blame] | 318 | LAYER_RENDERER_LOGD(" Destroyed!"); |
Chris Craik | d41c4d8 | 2015-01-05 15:51:13 -0800 | [diff] [blame^] | 319 | layer->decStrong(nullptr); |
Romain Guy | 09b7c91 | 2011-02-02 20:28:09 -0800 | [diff] [blame] | 320 | } else { |
Romain Guy | eea6069 | 2011-07-26 20:35:55 -0700 | [diff] [blame] | 321 | LAYER_RENDERER_LOGD(" Cached!"); |
Romain Guy | 65b345f | 2011-07-27 18:51:50 -0700 | [diff] [blame] | 322 | #if DEBUG_LAYER_RENDERER |
Romain Guy | eea6069 | 2011-07-26 20:35:55 -0700 | [diff] [blame] | 323 | Caches::getInstance().layerCache.dump(); |
| 324 | #endif |
Chet Haase | 98d3a64 | 2012-09-26 10:27:40 -0700 | [diff] [blame] | 325 | layer->removeFbo(); |
Romain Guy | 09b7c91 | 2011-02-02 20:28:09 -0800 | [diff] [blame] | 326 | layer->region.clear(); |
| 327 | } |
Romain Guy | ada830f | 2011-01-13 12:13:20 -0800 | [diff] [blame] | 328 | } |
Romain Guy | 6c319ca | 2011-01-11 14:29:25 -0800 | [diff] [blame] | 329 | } |
| 330 | |
John Reck | 3b20251 | 2014-06-23 13:13:08 -0700 | [diff] [blame] | 331 | void LayerRenderer::flushLayer(RenderState& renderState, Layer* layer) { |
Romain Guy | 9c4b79a | 2011-11-10 19:23:58 -0800 | [diff] [blame] | 332 | #ifdef GL_EXT_discard_framebuffer |
Digish Pandya | 1fa4cef | 2014-06-12 10:42:54 +0530 | [diff] [blame] | 333 | if (!layer) return; |
| 334 | |
Romain Guy | 9c4b79a | 2011-11-10 19:23:58 -0800 | [diff] [blame] | 335 | GLuint fbo = layer->getFbo(); |
Digish Pandya | 1fa4cef | 2014-06-12 10:42:54 +0530 | [diff] [blame] | 336 | if (fbo) { |
Romain Guy | 9c4b79a | 2011-11-10 19:23:58 -0800 | [diff] [blame] | 337 | // If possible, discard any enqueud operations on deferred |
| 338 | // rendering architectures |
Romain Guy | 3bbacf2 | 2013-02-06 16:51:04 -0800 | [diff] [blame] | 339 | if (Extensions::getInstance().hasDiscardFramebuffer()) { |
John Reck | 3b20251 | 2014-06-23 13:13:08 -0700 | [diff] [blame] | 340 | GLuint previousFbo = renderState.getFramebuffer(); |
| 341 | if (fbo != previousFbo) { |
| 342 | renderState.bindFramebuffer(fbo); |
| 343 | } |
Romain Guy | 45e4c3d | 2012-09-11 17:17:07 -0700 | [diff] [blame] | 344 | |
| 345 | const GLenum attachments[] = { GL_COLOR_ATTACHMENT0 }; |
| 346 | glDiscardFramebufferEXT(GL_FRAMEBUFFER, 1, attachments); |
Romain Guy | 9c4b79a | 2011-11-10 19:23:58 -0800 | [diff] [blame] | 347 | |
John Reck | 3b20251 | 2014-06-23 13:13:08 -0700 | [diff] [blame] | 348 | if (fbo != previousFbo) { |
| 349 | renderState.bindFramebuffer(previousFbo); |
| 350 | } |
Romain Guy | 9c4b79a | 2011-11-10 19:23:58 -0800 | [diff] [blame] | 351 | } |
| 352 | } |
| 353 | #endif |
| 354 | } |
| 355 | |
John Reck | 3b20251 | 2014-06-23 13:13:08 -0700 | [diff] [blame] | 356 | bool LayerRenderer::copyLayer(RenderState& renderState, Layer* layer, SkBitmap* bitmap) { |
Romain Guy | 77a8116 | 2011-06-14 16:45:55 -0700 | [diff] [blame] | 357 | Caches& caches = Caches::getInstance(); |
Chris Craik | 710f46d | 2012-09-17 17:25:49 -0700 | [diff] [blame] | 358 | if (layer && bitmap->width() <= caches.maxTextureSize && |
Romain Guy | 77a8116 | 2011-06-14 16:45:55 -0700 | [diff] [blame] | 359 | bitmap->height() <= caches.maxTextureSize) { |
| 360 | |
| 361 | GLuint fbo = caches.fboCache.get(); |
| 362 | if (!fbo) { |
Steve Block | 8564c8d | 2012-01-05 23:22:43 +0000 | [diff] [blame] | 363 | ALOGW("Could not obtain an FBO"); |
Romain Guy | 77a8116 | 2011-06-14 16:45:55 -0700 | [diff] [blame] | 364 | return false; |
| 365 | } |
| 366 | |
Romain Guy | d6b2a00 | 2011-06-17 17:45:59 -0700 | [diff] [blame] | 367 | SkAutoLockPixels alp(*bitmap); |
| 368 | |
Romain Guy | 77a8116 | 2011-06-14 16:45:55 -0700 | [diff] [blame] | 369 | GLuint texture; |
| 370 | GLuint previousFbo; |
John Reck | 3b20251 | 2014-06-23 13:13:08 -0700 | [diff] [blame] | 371 | GLsizei previousViewportWidth; |
| 372 | GLsizei previousViewportHeight; |
Romain Guy | 77a8116 | 2011-06-14 16:45:55 -0700 | [diff] [blame] | 373 | |
| 374 | GLenum format; |
| 375 | GLenum type; |
| 376 | |
Romain Guy | d6b2a00 | 2011-06-17 17:45:59 -0700 | [diff] [blame] | 377 | GLenum error = GL_NO_ERROR; |
| 378 | bool status = false; |
| 379 | |
Mike Reed | 1103b32 | 2014-07-08 12:36:44 -0400 | [diff] [blame] | 380 | switch (bitmap->colorType()) { |
| 381 | case kAlpha_8_SkColorType: |
Romain Guy | 77a8116 | 2011-06-14 16:45:55 -0700 | [diff] [blame] | 382 | format = GL_ALPHA; |
| 383 | type = GL_UNSIGNED_BYTE; |
| 384 | break; |
Mike Reed | 1103b32 | 2014-07-08 12:36:44 -0400 | [diff] [blame] | 385 | case kRGB_565_SkColorType: |
Romain Guy | 77a8116 | 2011-06-14 16:45:55 -0700 | [diff] [blame] | 386 | format = GL_RGB; |
| 387 | type = GL_UNSIGNED_SHORT_5_6_5; |
| 388 | break; |
Mike Reed | 1103b32 | 2014-07-08 12:36:44 -0400 | [diff] [blame] | 389 | case kARGB_4444_SkColorType: |
Romain Guy | 77a8116 | 2011-06-14 16:45:55 -0700 | [diff] [blame] | 390 | format = GL_RGBA; |
| 391 | type = GL_UNSIGNED_SHORT_4_4_4_4; |
| 392 | break; |
Mike Reed | 1103b32 | 2014-07-08 12:36:44 -0400 | [diff] [blame] | 393 | case kN32_SkColorType: |
Romain Guy | 77a8116 | 2011-06-14 16:45:55 -0700 | [diff] [blame] | 394 | default: |
| 395 | format = GL_RGBA; |
| 396 | type = GL_UNSIGNED_BYTE; |
| 397 | break; |
| 398 | } |
| 399 | |
Romain Guy | 9ace8f5 | 2011-07-07 20:50:11 -0700 | [diff] [blame] | 400 | float alpha = layer->getAlpha(); |
| 401 | SkXfermode::Mode mode = layer->getMode(); |
Chris Craik | 710f46d | 2012-09-17 17:25:49 -0700 | [diff] [blame] | 402 | GLuint previousLayerFbo = layer->getFbo(); |
Romain Guy | d6b2a00 | 2011-06-17 17:45:59 -0700 | [diff] [blame] | 403 | |
Romain Guy | 9ace8f5 | 2011-07-07 20:50:11 -0700 | [diff] [blame] | 404 | layer->setAlpha(255, SkXfermode::kSrc_Mode); |
| 405 | layer->setFbo(fbo); |
Romain Guy | d6b2a00 | 2011-06-17 17:45:59 -0700 | [diff] [blame] | 406 | |
John Reck | 3b20251 | 2014-06-23 13:13:08 -0700 | [diff] [blame] | 407 | previousFbo = renderState.getFramebuffer(); |
| 408 | renderState.getViewport(&previousViewportWidth, &previousViewportHeight); |
| 409 | renderState.bindFramebuffer(fbo); |
Romain Guy | 77a8116 | 2011-06-14 16:45:55 -0700 | [diff] [blame] | 410 | |
| 411 | glGenTextures(1, &texture); |
Romain Guy | d6b2a00 | 2011-06-17 17:45:59 -0700 | [diff] [blame] | 412 | if ((error = glGetError()) != GL_NO_ERROR) goto error; |
Romain Guy | 77a8116 | 2011-06-14 16:45:55 -0700 | [diff] [blame] | 413 | |
Romain Guy | a1d3c91 | 2011-12-13 14:55:06 -0800 | [diff] [blame] | 414 | caches.activeTexture(0); |
Romain Guy | 8aa195d | 2013-06-04 18:00:09 -0700 | [diff] [blame] | 415 | caches.bindTexture(texture); |
Romain Guy | 77a8116 | 2011-06-14 16:45:55 -0700 | [diff] [blame] | 416 | |
Romain Guy | e49d7ec | 2012-09-07 18:42:38 -0700 | [diff] [blame] | 417 | glPixelStorei(GL_PACK_ALIGNMENT, bitmap->bytesPerPixel()); |
| 418 | |
Romain Guy | ec19b4a | 2011-07-07 21:05:04 -0700 | [diff] [blame] | 419 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); |
| 420 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); |
Romain Guy | 77a8116 | 2011-06-14 16:45:55 -0700 | [diff] [blame] | 421 | |
| 422 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); |
| 423 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); |
| 424 | |
| 425 | glTexImage2D(GL_TEXTURE_2D, 0, format, bitmap->width(), bitmap->height(), |
Chris Craik | d41c4d8 | 2015-01-05 15:51:13 -0800 | [diff] [blame^] | 426 | 0, format, type, nullptr); |
Romain Guy | d6b2a00 | 2011-06-17 17:45:59 -0700 | [diff] [blame] | 427 | if ((error = glGetError()) != GL_NO_ERROR) goto error; |
| 428 | |
Romain Guy | 77a8116 | 2011-06-14 16:45:55 -0700 | [diff] [blame] | 429 | glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, |
| 430 | GL_TEXTURE_2D, texture, 0); |
Romain Guy | d6b2a00 | 2011-06-17 17:45:59 -0700 | [diff] [blame] | 431 | if ((error = glGetError()) != GL_NO_ERROR) goto error; |
Romain Guy | 77a8116 | 2011-06-14 16:45:55 -0700 | [diff] [blame] | 432 | |
Romain Guy | d6b2a00 | 2011-06-17 17:45:59 -0700 | [diff] [blame] | 433 | { |
John Reck | 3b20251 | 2014-06-23 13:13:08 -0700 | [diff] [blame] | 434 | LayerRenderer renderer(renderState, layer); |
Romain Guy | d6b2a00 | 2011-06-17 17:45:59 -0700 | [diff] [blame] | 435 | renderer.setViewport(bitmap->width(), bitmap->height()); |
| 436 | renderer.OpenGLRenderer::prepareDirty(0.0f, 0.0f, |
Romain Guy | 9ace8f5 | 2011-07-07 20:50:11 -0700 | [diff] [blame] | 437 | bitmap->width(), bitmap->height(), !layer->isBlend()); |
Romain Guy | a9dc86b | 2011-10-11 14:06:21 -0700 | [diff] [blame] | 438 | |
Romain Guy | 586cae3 | 2012-07-13 15:28:31 -0700 | [diff] [blame] | 439 | caches.disableScissor(); |
Romain Guy | a9dc86b | 2011-10-11 14:06:21 -0700 | [diff] [blame] | 440 | renderer.translate(0.0f, bitmap->height()); |
| 441 | renderer.scale(1.0f, -1.0f); |
| 442 | |
| 443 | mat4 texTransform(layer->getTexTransform()); |
| 444 | |
| 445 | mat4 invert; |
Romain Guy | 4c2547f | 2013-06-11 16:19:24 -0700 | [diff] [blame] | 446 | invert.translate(0.0f, 1.0f); |
Romain Guy | a9dc86b | 2011-10-11 14:06:21 -0700 | [diff] [blame] | 447 | invert.scale(1.0f, -1.0f, 1.0f); |
| 448 | layer->getTexTransform().multiply(invert); |
| 449 | |
Romain Guy | d6b2a00 | 2011-06-17 17:45:59 -0700 | [diff] [blame] | 450 | if ((error = glGetError()) != GL_NO_ERROR) goto error; |
Romain Guy | 77a8116 | 2011-06-14 16:45:55 -0700 | [diff] [blame] | 451 | |
Romain Guy | d6b2a00 | 2011-06-17 17:45:59 -0700 | [diff] [blame] | 452 | { |
| 453 | Rect bounds; |
| 454 | bounds.set(0.0f, 0.0f, bitmap->width(), bitmap->height()); |
| 455 | renderer.drawTextureLayer(layer, bounds); |
Romain Guy | 77a8116 | 2011-06-14 16:45:55 -0700 | [diff] [blame] | 456 | |
Romain Guy | d6b2a00 | 2011-06-17 17:45:59 -0700 | [diff] [blame] | 457 | glReadPixels(0, 0, bitmap->width(), bitmap->height(), format, |
| 458 | type, bitmap->getPixels()); |
Romain Guy | 77a8116 | 2011-06-14 16:45:55 -0700 | [diff] [blame] | 459 | |
Romain Guy | d6b2a00 | 2011-06-17 17:45:59 -0700 | [diff] [blame] | 460 | if ((error = glGetError()) != GL_NO_ERROR) goto error; |
| 461 | } |
Romain Guy | 77a8116 | 2011-06-14 16:45:55 -0700 | [diff] [blame] | 462 | |
Romain Guy | a9dc86b | 2011-10-11 14:06:21 -0700 | [diff] [blame] | 463 | layer->getTexTransform().load(texTransform); |
Romain Guy | d6b2a00 | 2011-06-17 17:45:59 -0700 | [diff] [blame] | 464 | status = true; |
| 465 | } |
Romain Guy | 77a8116 | 2011-06-14 16:45:55 -0700 | [diff] [blame] | 466 | |
Romain Guy | d6b2a00 | 2011-06-17 17:45:59 -0700 | [diff] [blame] | 467 | error: |
| 468 | #if DEBUG_OPENGL |
| 469 | if (error != GL_NO_ERROR) { |
Steve Block | 5baa3a6 | 2011-12-20 16:23:08 +0000 | [diff] [blame] | 470 | ALOGD("GL error while copying layer into bitmap = 0x%x", error); |
Romain Guy | d6b2a00 | 2011-06-17 17:45:59 -0700 | [diff] [blame] | 471 | } |
| 472 | #endif |
Romain Guy | 77a8116 | 2011-06-14 16:45:55 -0700 | [diff] [blame] | 473 | |
John Reck | 3b20251 | 2014-06-23 13:13:08 -0700 | [diff] [blame] | 474 | renderState.bindFramebuffer(previousFbo); |
Romain Guy | 9ace8f5 | 2011-07-07 20:50:11 -0700 | [diff] [blame] | 475 | layer->setAlpha(alpha, mode); |
Chris Craik | 710f46d | 2012-09-17 17:25:49 -0700 | [diff] [blame] | 476 | layer->setFbo(previousLayerFbo); |
Romain Guy | be1b127 | 2013-06-06 14:02:54 -0700 | [diff] [blame] | 477 | caches.deleteTexture(texture); |
Romain Guy | 77a8116 | 2011-06-14 16:45:55 -0700 | [diff] [blame] | 478 | caches.fboCache.put(fbo); |
John Reck | 3b20251 | 2014-06-23 13:13:08 -0700 | [diff] [blame] | 479 | renderState.setViewport(previousViewportWidth, previousViewportHeight); |
Romain Guy | 77a8116 | 2011-06-14 16:45:55 -0700 | [diff] [blame] | 480 | |
Romain Guy | d6b2a00 | 2011-06-17 17:45:59 -0700 | [diff] [blame] | 481 | return status; |
Romain Guy | 77a8116 | 2011-06-14 16:45:55 -0700 | [diff] [blame] | 482 | } |
| 483 | return false; |
| 484 | } |
| 485 | |
Romain Guy | 6c319ca | 2011-01-11 14:29:25 -0800 | [diff] [blame] | 486 | }; // namespace uirenderer |
| 487 | }; // namespace android |