blob: a23e676ea9964057c061eea3a689a3623c6ee118 [file] [log] [blame]
John Reck3b202512014-06-23 13:13:08 -07001/*
2 * Copyright (C) 2014 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 */
Greg Daniel8cd3edf2017-01-09 14:15:41 -050016#include "GlLayer.h"
John Reck38e0c322015-11-10 12:19:17 -080017#include <GpuMemoryTracker.h>
Chris Craik96a5c4c2015-01-27 15:46:35 -080018#include "renderstate/RenderState.h"
John Reck3b202512014-06-23 13:13:08 -070019
John Reck443a7142014-09-04 17:40:05 -070020#include "renderthread/CanvasContext.h"
John Reck0e89e2b2014-10-31 14:49:06 -070021#include "renderthread/EglManager.h"
Chris Craik117bdbc2015-02-05 10:12:38 -080022#include "utils/GLUtils.h"
Chris Craik9db58c02015-08-19 15:19:18 -070023#include <algorithm>
24
John Reck3b202512014-06-23 13:13:08 -070025namespace android {
26namespace uirenderer {
27
John Reck0e89e2b2014-10-31 14:49:06 -070028RenderState::RenderState(renderthread::RenderThread& thread)
29 : mRenderThread(thread)
John Reck3b202512014-06-23 13:13:08 -070030 , mViewportWidth(0)
31 , mViewportHeight(0)
32 , mFramebuffer(0) {
John Reck0e89e2b2014-10-31 14:49:06 -070033 mThreadId = pthread_self();
John Reck3b202512014-06-23 13:13:08 -070034}
35
36RenderState::~RenderState() {
Chris Craik44eb2c02015-01-29 09:45:09 -080037 LOG_ALWAYS_FATAL_IF(mBlend || mMeshState || mScissor || mStencil,
Chris Craik96a5c4c2015-01-27 15:46:35 -080038 "State object lifecycle not managed correctly");
John Reck3b202512014-06-23 13:13:08 -070039}
40
41void RenderState::onGLContextCreated() {
Chris Craik44eb2c02015-01-29 09:45:09 -080042 LOG_ALWAYS_FATAL_IF(mBlend || mMeshState || mScissor || mStencil,
Chris Craik96a5c4c2015-01-27 15:46:35 -080043 "State object lifecycle not managed correctly");
John Reck38e0c322015-11-10 12:19:17 -080044 GpuMemoryTracker::onGLContextCreated();
45
Chris Craik44eb2c02015-01-29 09:45:09 -080046 mBlend = new Blend();
Chris Craik96a5c4c2015-01-27 15:46:35 -080047 mMeshState = new MeshState();
48 mScissor = new Scissor();
49 mStencil = new Stencil();
Chris Craik65fe5ee2015-01-26 18:06:29 -080050
Chris Craik96a5c4c2015-01-27 15:46:35 -080051 // This is delayed because the first access of Caches makes GL calls
Chris Craikff5c8e82015-01-30 09:46:18 -080052 if (!mCaches) {
53 mCaches = &Caches::createInstance(*this);
54 }
Chris Craik96a5c4c2015-01-27 15:46:35 -080055 mCaches->init();
John Reck3b202512014-06-23 13:13:08 -070056}
57
John Reck49bc4ac2015-01-29 12:53:38 -080058static void layerLostGlContext(Layer* layer) {
Greg Daniel8cd3edf2017-01-09 14:15:41 -050059 LOG_ALWAYS_FATAL_IF(layer->getApi() != Layer::Api::OpenGL,
60 "layerLostGlContext on non GL layer");
61 static_cast<GlLayer*>(layer)->onGlContextLost();
John Reck49bc4ac2015-01-29 12:53:38 -080062}
63
Chris Craik1d477422014-08-26 17:30:15 -070064void RenderState::onGLContextDestroyed() {
Chris Craik9fded232015-11-11 16:42:34 -080065 mLayerPool.clear();
66
Chris Craik96a5c4c2015-01-27 15:46:35 -080067 // TODO: reset all cached state in state objects
John Reck49bc4ac2015-01-29 12:53:38 -080068 std::for_each(mActiveLayers.begin(), mActiveLayers.end(), layerLostGlContext);
Chris Craik96a5c4c2015-01-27 15:46:35 -080069
Chris Craik44eb2c02015-01-29 09:45:09 -080070 mCaches->terminate();
71
72 delete mBlend;
73 mBlend = nullptr;
Chris Craik96a5c4c2015-01-27 15:46:35 -080074 delete mMeshState;
75 mMeshState = nullptr;
76 delete mScissor;
77 mScissor = nullptr;
78 delete mStencil;
79 mStencil = nullptr;
John Reck38e0c322015-11-10 12:19:17 -080080
81 GpuMemoryTracker::onGLContextDestroyed();
Chris Craik1d477422014-08-26 17:30:15 -070082}
83
Chris Craik9fded232015-11-11 16:42:34 -080084void RenderState::flush(Caches::FlushMode mode) {
85 switch (mode) {
86 case Caches::FlushMode::Full:
87 // fall through
88 case Caches::FlushMode::Moderate:
89 // fall through
90 case Caches::FlushMode::Layers:
91 mLayerPool.clear();
92 break;
93 }
94 mCaches->flush(mode);
95}
96
John Reck3b202512014-06-23 13:13:08 -070097void RenderState::setViewport(GLsizei width, GLsizei height) {
98 mViewportWidth = width;
99 mViewportHeight = height;
100 glViewport(0, 0, mViewportWidth, mViewportHeight);
101}
102
103
104void RenderState::getViewport(GLsizei* outWidth, GLsizei* outHeight) {
105 *outWidth = mViewportWidth;
106 *outHeight = mViewportHeight;
107}
108
109void RenderState::bindFramebuffer(GLuint fbo) {
110 if (mFramebuffer != fbo) {
111 mFramebuffer = fbo;
112 glBindFramebuffer(GL_FRAMEBUFFER, mFramebuffer);
113 }
114}
115
John Reck0b8d0672016-01-29 14:18:22 -0800116GLuint RenderState::createFramebuffer() {
Chris Craik818c9fb2015-10-23 14:33:42 -0700117 GLuint ret;
118 glGenFramebuffers(1, &ret);
119 return ret;
120}
121
122void RenderState::deleteFramebuffer(GLuint fbo) {
123 if (mFramebuffer == fbo) {
124 // GL defines that deleting the currently bound FBO rebinds FBO 0.
125 // Reflect this in our cached value.
126 mFramebuffer = 0;
127 }
128 glDeleteFramebuffers(1, &fbo);
129}
130
John Reck3b202512014-06-23 13:13:08 -0700131void RenderState::invokeFunctor(Functor* functor, DrawGlInfo::Mode mode, DrawGlInfo* info) {
John Reck95cd24b2015-08-04 11:17:39 -0700132 if (mode == DrawGlInfo::kModeProcessNoContext) {
133 // If there's no context we don't need to interrupt as there's
134 // no gl state to save/restore
135 (*functor)(mode, info);
136 } else {
137 interruptForFunctorInvoke();
138 (*functor)(mode, info);
139 resumeFromFunctorInvoke();
140 }
John Reck3b202512014-06-23 13:13:08 -0700141}
142
143void RenderState::interruptForFunctorInvoke() {
Chris Craik6c15ffa2015-02-02 13:50:55 -0800144 mCaches->setProgram(nullptr);
Chris Craik44eb2c02015-01-29 09:45:09 -0800145 mCaches->textureState().resetActiveTexture();
Chris Craik96a5c4c2015-01-27 15:46:35 -0800146 meshState().unbindMeshBuffer();
147 meshState().unbindIndicesBuffer();
148 meshState().resetVertexPointers();
149 meshState().disableTexCoordsVertexArray();
John Reck3b202512014-06-23 13:13:08 -0700150 debugOverdraw(false, false);
Romain Guy253f2c22016-09-28 17:34:42 -0700151 // TODO: We need a way to know whether the functor is sRGB aware (b/32072673)
152 if (mCaches->extensions().hasSRGBWriteControl()) {
153 glDisable(GL_FRAMEBUFFER_SRGB_EXT);
154 }
John Reck3b202512014-06-23 13:13:08 -0700155}
156
157void RenderState::resumeFromFunctorInvoke() {
Romain Guy253f2c22016-09-28 17:34:42 -0700158 if (mCaches->extensions().hasSRGBWriteControl()) {
159 glEnable(GL_FRAMEBUFFER_SRGB_EXT);
160 }
161
John Reck3b202512014-06-23 13:13:08 -0700162 glViewport(0, 0, mViewportWidth, mViewportHeight);
163 glBindFramebuffer(GL_FRAMEBUFFER, mFramebuffer);
164 debugOverdraw(false, false);
165
166 glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
167
Chris Craik65fe5ee2015-01-26 18:06:29 -0800168 scissor().invalidate();
Chris Craik44eb2c02015-01-29 09:45:09 -0800169 blend().invalidate();
John Reck3b202512014-06-23 13:13:08 -0700170
Chris Craik44eb2c02015-01-29 09:45:09 -0800171 mCaches->textureState().activateTexture(0);
172 mCaches->textureState().resetBoundTextures();
John Reck3b202512014-06-23 13:13:08 -0700173}
174
175void RenderState::debugOverdraw(bool enable, bool clear) {
Chris Craik2507c342015-05-04 14:36:49 -0700176 if (Properties::debugOverdraw && mFramebuffer == 0) {
John Reck3b202512014-06-23 13:13:08 -0700177 if (clear) {
Chris Craik65fe5ee2015-01-26 18:06:29 -0800178 scissor().setEnabled(false);
Chris Craik96a5c4c2015-01-27 15:46:35 -0800179 stencil().clear();
John Reck3b202512014-06-23 13:13:08 -0700180 }
181 if (enable) {
Chris Craik96a5c4c2015-01-27 15:46:35 -0800182 stencil().enableDebugWrite();
John Reck3b202512014-06-23 13:13:08 -0700183 } else {
Chris Craik96a5c4c2015-01-27 15:46:35 -0800184 stencil().disable();
John Reck3b202512014-06-23 13:13:08 -0700185 }
186 }
187}
188
John Reck0e89e2b2014-10-31 14:49:06 -0700189class DecStrongTask : public renderthread::RenderTask {
190public:
Chih-Hung Hsiehc6baf562016-04-27 11:29:23 -0700191 explicit DecStrongTask(VirtualLightRefBase* object) : mObject(object) {}
John Reck0e89e2b2014-10-31 14:49:06 -0700192
Chris Craikd41c4d82015-01-05 15:51:13 -0800193 virtual void run() override {
194 mObject->decStrong(nullptr);
195 mObject = nullptr;
John Reck0e89e2b2014-10-31 14:49:06 -0700196 delete this;
197 }
198
199private:
200 VirtualLightRefBase* mObject;
201};
202
203void RenderState::postDecStrong(VirtualLightRefBase* object) {
John Recka55b5d62016-01-14 15:09:10 -0800204 if (pthread_equal(mThreadId, pthread_self())) {
205 object->decStrong(nullptr);
206 } else {
207 mRenderThread.queue(new DecStrongTask(object));
208 }
John Reck0e89e2b2014-10-31 14:49:06 -0700209}
210
Chris Craik6c15ffa2015-02-02 13:50:55 -0800211///////////////////////////////////////////////////////////////////////////////
212// Render
213///////////////////////////////////////////////////////////////////////////////
214
Chris Craik12efe642015-09-28 15:52:12 -0700215void RenderState::render(const Glop& glop, const Matrix4& orthoMatrix) {
Chris Craik6c15ffa2015-02-02 13:50:55 -0800216 const Glop::Mesh& mesh = glop.mesh;
Chris Craikef250742015-02-25 17:16:16 -0800217 const Glop::Mesh::Vertices& vertices = mesh.vertices;
218 const Glop::Mesh::Indices& indices = mesh.indices;
Chris Craik0519c8102015-02-11 13:17:06 -0800219 const Glop::Fill& fill = glop.fill;
Chris Craik6c15ffa2015-02-02 13:50:55 -0800220
John Reck975591a2016-01-22 16:28:07 -0800221 GL_CHECKPOINT(MODERATE);
John Reck9372ac32016-01-19 11:46:52 -0800222
Chris Craik0519c8102015-02-11 13:17:06 -0800223 // ---------------------------------------------
224 // ---------- Program + uniform setup ----------
225 // ---------------------------------------------
226 mCaches->setProgram(fill.program);
Chris Craik6c15ffa2015-02-02 13:50:55 -0800227
Chris Craik0519c8102015-02-11 13:17:06 -0800228 if (fill.colorEnabled) {
229 fill.program->setColor(fill.color);
230 }
Chris Craik6c15ffa2015-02-02 13:50:55 -0800231
Chris Craik12efe642015-09-28 15:52:12 -0700232 fill.program->set(orthoMatrix,
Chris Craik6c15ffa2015-02-02 13:50:55 -0800233 glop.transform.modelView,
Chris Craik53e51e42015-06-01 10:35:35 -0700234 glop.transform.meshTransform(),
235 glop.transform.transformFlags & TransformFlags::OffsetByFudgeFactor);
Chris Craik6c15ffa2015-02-02 13:50:55 -0800236
Chris Craik0519c8102015-02-11 13:17:06 -0800237 // Color filter uniforms
Chris Craikb9ce116d2015-08-20 15:14:06 -0700238 if (fill.filterMode == ProgramDescription::ColorFilterMode::Blend) {
Chris Craikef250742015-02-25 17:16:16 -0800239 const FloatColor& color = fill.filter.color;
Chris Craik117bdbc2015-02-05 10:12:38 -0800240 glUniform4f(mCaches->program().getUniform("colorBlend"),
241 color.r, color.g, color.b, color.a);
Chris Craikb9ce116d2015-08-20 15:14:06 -0700242 } else if (fill.filterMode == ProgramDescription::ColorFilterMode::Matrix) {
Chris Craik117bdbc2015-02-05 10:12:38 -0800243 glUniformMatrix4fv(mCaches->program().getUniform("colorMatrix"), 1, GL_FALSE,
Chris Craikef250742015-02-25 17:16:16 -0800244 fill.filter.matrix.matrix);
Chris Craik117bdbc2015-02-05 10:12:38 -0800245 glUniform4fv(mCaches->program().getUniform("colorMatrixVector"), 1,
Chris Craikef250742015-02-25 17:16:16 -0800246 fill.filter.matrix.vector);
Chris Craik117bdbc2015-02-05 10:12:38 -0800247 }
248
Chris Craik0519c8102015-02-11 13:17:06 -0800249 // Round rect clipping uniforms
250 if (glop.roundRectClipState) {
251 // TODO: avoid query, and cache values (or RRCS ptr) in program
252 const RoundRectClipState* state = glop.roundRectClipState;
253 const Rect& innerRect = state->innerRect;
254 glUniform4f(fill.program->getUniform("roundRectInnerRectLTRB"),
255 innerRect.left, innerRect.top,
256 innerRect.right, innerRect.bottom);
257 glUniformMatrix4fv(fill.program->getUniform("roundRectInvTransform"),
258 1, GL_FALSE, &state->matrix.data[0]);
259
260 // add half pixel to round out integer rect space to cover pixel centers
261 float roundedOutRadius = state->radius + 0.5f;
262 glUniform1f(fill.program->getUniform("roundRectRadius"),
263 roundedOutRadius);
264 }
Chris Craikef250742015-02-25 17:16:16 -0800265
John Reck975591a2016-01-22 16:28:07 -0800266 GL_CHECKPOINT(MODERATE);
John Reck9372ac32016-01-19 11:46:52 -0800267
Chris Craik117bdbc2015-02-05 10:12:38 -0800268 // --------------------------------
Chris Craik6c15ffa2015-02-02 13:50:55 -0800269 // ---------- Mesh setup ----------
Chris Craik117bdbc2015-02-05 10:12:38 -0800270 // --------------------------------
271 // vertices
Chris Craik1b7db402016-02-24 18:25:32 -0800272 meshState().bindMeshBuffer(vertices.bufferObject);
273 meshState().bindPositionVertexPointer(vertices.position, vertices.stride);
Chris Craik117bdbc2015-02-05 10:12:38 -0800274
275 // indices
Chris Craik1b7db402016-02-24 18:25:32 -0800276 meshState().bindIndicesBuffer(indices.bufferObject);
Chris Craik117bdbc2015-02-05 10:12:38 -0800277
Chris Craik138c21f2016-04-28 16:59:42 -0700278 // texture
279 if (fill.texture.texture != nullptr) {
Chris Craik26bf3422015-02-26 16:28:17 -0800280 const Glop::Fill::TextureData& texture = fill.texture;
281 // texture always takes slot 0, shader samplers increment from there
Chris Craik0519c8102015-02-11 13:17:06 -0800282 mCaches->textureState().activateTexture(0);
283
sergeyv2a38c422016-10-25 15:21:50 -0700284 mCaches->textureState().bindTexture(texture.texture->target(), texture.texture->id());
Chris Craik26bf3422015-02-26 16:28:17 -0800285 if (texture.clamp != GL_INVALID_ENUM) {
sergeyv2a38c422016-10-25 15:21:50 -0700286 texture.texture->setWrap(texture.clamp, false, false);
Chris Craik30036092015-02-12 10:41:39 -0800287 }
Chris Craik26bf3422015-02-26 16:28:17 -0800288 if (texture.filter != GL_INVALID_ENUM) {
sergeyv2a38c422016-10-25 15:21:50 -0700289 texture.texture->setFilter(texture.filter, false, false);
Chris Craik30036092015-02-12 10:41:39 -0800290 }
Chris Craik0519c8102015-02-11 13:17:06 -0800291
Chris Craik26bf3422015-02-26 16:28:17 -0800292 if (texture.textureTransform) {
293 glUniformMatrix4fv(fill.program->getUniform("mainTextureTransform"), 1,
294 GL_FALSE, &texture.textureTransform->data[0]);
295 }
Chris Craik138c21f2016-04-28 16:59:42 -0700296 }
297
298 // vertex attributes (tex coord, color, alpha)
299 if (vertices.attribFlags & VertexAttribFlags::TextureCoord) {
300 meshState().enableTexCoordsVertexArray();
301 meshState().bindTexCoordsVertexPointer(vertices.texCoord, vertices.stride);
Chris Craik6c15ffa2015-02-02 13:50:55 -0800302 } else {
303 meshState().disableTexCoordsVertexArray();
304 }
Chris Craikef250742015-02-25 17:16:16 -0800305 int colorLocation = -1;
Chris Craik53e51e42015-06-01 10:35:35 -0700306 if (vertices.attribFlags & VertexAttribFlags::Color) {
Chris Craikef250742015-02-25 17:16:16 -0800307 colorLocation = fill.program->getAttrib("colors");
308 glEnableVertexAttribArray(colorLocation);
309 glVertexAttribPointer(colorLocation, 4, GL_FLOAT, GL_FALSE, vertices.stride, vertices.color);
Chris Craik6c15ffa2015-02-02 13:50:55 -0800310 }
Chris Craikef250742015-02-25 17:16:16 -0800311 int alphaLocation = -1;
Chris Craik53e51e42015-06-01 10:35:35 -0700312 if (vertices.attribFlags & VertexAttribFlags::Alpha) {
Chris Craikef250742015-02-25 17:16:16 -0800313 // NOTE: alpha vertex position is computed assuming no VBO
314 const void* alphaCoords = ((const GLbyte*) vertices.position) + kVertexAlphaOffset;
315 alphaLocation = fill.program->getAttrib("vtxAlpha");
316 glEnableVertexAttribArray(alphaLocation);
317 glVertexAttribPointer(alphaLocation, 1, GL_FLOAT, GL_FALSE, vertices.stride, alphaCoords);
Chris Craik6c15ffa2015-02-02 13:50:55 -0800318 }
Chris Craik922d3a72015-02-13 17:47:21 -0800319 // Shader uniforms
Romain Guy253f2c22016-09-28 17:34:42 -0700320 SkiaShader::apply(*mCaches, fill.skiaShaderData, mViewportWidth, mViewportHeight);
Chris Craik922d3a72015-02-13 17:47:21 -0800321
John Reck975591a2016-01-22 16:28:07 -0800322 GL_CHECKPOINT(MODERATE);
Dohyun Leec5a3efd2016-01-21 13:46:21 +0900323 Texture* texture = (fill.skiaShaderData.skiaShaderType & kBitmap_SkiaShaderType) ?
324 fill.skiaShaderData.bitmapData.bitmapTexture : nullptr;
325 const AutoTexture autoCleanup(texture);
John Reck9372ac32016-01-19 11:46:52 -0800326
Chris Craik117bdbc2015-02-05 10:12:38 -0800327 // ------------------------------------
Chris Craik6c15ffa2015-02-02 13:50:55 -0800328 // ---------- GL state setup ----------
Chris Craik117bdbc2015-02-05 10:12:38 -0800329 // ------------------------------------
Chris Craik03188872015-02-02 18:39:33 -0800330 blend().setFactors(glop.blend.src, glop.blend.dst);
Chris Craik6c15ffa2015-02-02 13:50:55 -0800331
John Reck975591a2016-01-22 16:28:07 -0800332 GL_CHECKPOINT(MODERATE);
John Reck9372ac32016-01-19 11:46:52 -0800333
Chris Craik117bdbc2015-02-05 10:12:38 -0800334 // ------------------------------------
Chris Craik2ab95d72015-02-06 15:25:51 -0800335 // ---------- Actual drawing ----------
Chris Craik117bdbc2015-02-05 10:12:38 -0800336 // ------------------------------------
Chris Craikef250742015-02-25 17:16:16 -0800337 if (indices.bufferObject == meshState().getQuadListIBO()) {
Chris Craik2ab95d72015-02-06 15:25:51 -0800338 // Since the indexed quad list is of limited length, we loop over
339 // the glDrawXXX method while updating the vertex pointer
Chris Craik0519c8102015-02-11 13:17:06 -0800340 GLsizei elementsCount = mesh.elementCount;
Chris Craikef250742015-02-25 17:16:16 -0800341 const GLbyte* vertexData = static_cast<const GLbyte*>(vertices.position);
Chris Craik2ab95d72015-02-06 15:25:51 -0800342 while (elementsCount > 0) {
Chris Craik9db58c02015-08-19 15:19:18 -0700343 GLsizei drawCount = std::min(elementsCount, (GLsizei) kMaxNumberOfQuads * 6);
Chris Craik1b7db402016-02-24 18:25:32 -0800344 meshState().bindPositionVertexPointer(vertexData, vertices.stride);
Chris Craik53e51e42015-06-01 10:35:35 -0700345 if (vertices.attribFlags & VertexAttribFlags::TextureCoord) {
Chris Craik1b7db402016-02-24 18:25:32 -0800346 meshState().bindTexCoordsVertexPointer(
Chris Craikef250742015-02-25 17:16:16 -0800347 vertexData + kMeshTextureOffset, vertices.stride);
Chris Craikf27133d2015-02-19 09:51:53 -0800348 }
349
Chris Craik2ab95d72015-02-06 15:25:51 -0800350 glDrawElements(mesh.primitiveMode, drawCount, GL_UNSIGNED_SHORT, nullptr);
351 elementsCount -= drawCount;
Chris Craikef250742015-02-25 17:16:16 -0800352 vertexData += (drawCount / 6) * 4 * vertices.stride;
Chris Craik2ab95d72015-02-06 15:25:51 -0800353 }
Chris Craikef250742015-02-25 17:16:16 -0800354 } else if (indices.bufferObject || indices.indices) {
355 glDrawElements(mesh.primitiveMode, mesh.elementCount, GL_UNSIGNED_SHORT, indices.indices);
Chris Craik6c15ffa2015-02-02 13:50:55 -0800356 } else {
Chris Craik0519c8102015-02-11 13:17:06 -0800357 glDrawArrays(mesh.primitiveMode, 0, mesh.elementCount);
Chris Craik6c15ffa2015-02-02 13:50:55 -0800358 }
Chris Craik117bdbc2015-02-05 10:12:38 -0800359
John Reck975591a2016-01-22 16:28:07 -0800360 GL_CHECKPOINT(MODERATE);
John Reck9372ac32016-01-19 11:46:52 -0800361
Chris Craik2ab95d72015-02-06 15:25:51 -0800362 // -----------------------------------
363 // ---------- Mesh teardown ----------
364 // -----------------------------------
Chris Craik53e51e42015-06-01 10:35:35 -0700365 if (vertices.attribFlags & VertexAttribFlags::Alpha) {
Chris Craikef250742015-02-25 17:16:16 -0800366 glDisableVertexAttribArray(alphaLocation);
367 }
Chris Craik53e51e42015-06-01 10:35:35 -0700368 if (vertices.attribFlags & VertexAttribFlags::Color) {
Chris Craikef250742015-02-25 17:16:16 -0800369 glDisableVertexAttribArray(colorLocation);
Chris Craik117bdbc2015-02-05 10:12:38 -0800370 }
John Reck9372ac32016-01-19 11:46:52 -0800371
John Reck975591a2016-01-22 16:28:07 -0800372 GL_CHECKPOINT(MODERATE);
Chris Craik117bdbc2015-02-05 10:12:38 -0800373}
374
375void RenderState::dump() {
376 blend().dump();
377 meshState().dump();
378 scissor().dump();
379 stencil().dump();
Chris Craik6c15ffa2015-02-02 13:50:55 -0800380}
381
John Reck3b202512014-06-23 13:13:08 -0700382} /* namespace uirenderer */
383} /* namespace android */