OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 | 8 |
9 #include "GrGpuGL.h" | 9 #include "GrGpuGL.h" |
10 #include "GrGLStencilBuffer.h" | 10 #include "GrGLStencilBuffer.h" |
(...skipping 1258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1269 if (NULL != rect) { | 1269 if (NULL != rect) { |
1270 // flushScissor expects rect to be clipped to the target. | 1270 // flushScissor expects rect to be clipped to the target. |
1271 clippedRect = *rect; | 1271 clippedRect = *rect; |
1272 SkIRect rtRect = SkIRect::MakeWH(rt->width(), rt->height()); | 1272 SkIRect rtRect = SkIRect::MakeWH(rt->width(), rt->height()); |
1273 if (clippedRect.intersect(rtRect)) { | 1273 if (clippedRect.intersect(rtRect)) { |
1274 rect = &clippedRect; | 1274 rect = &clippedRect; |
1275 } else { | 1275 } else { |
1276 return; | 1276 return; |
1277 } | 1277 } |
1278 } | 1278 } |
| 1279 |
1279 this->flushRenderTarget(rect); | 1280 this->flushRenderTarget(rect); |
1280 GrAutoTRestore<ScissorState> asr(&fScissorState); | 1281 GrAutoTRestore<ScissorState> asr(&fScissorState); |
1281 fScissorState.fEnabled = (NULL != rect); | 1282 fScissorState.fEnabled = (NULL != rect); |
1282 if (fScissorState.fEnabled) { | 1283 if (fScissorState.fEnabled) { |
1283 fScissorState.fRect = *rect; | 1284 fScissorState.fRect = *rect; |
1284 } | 1285 } |
1285 this->flushScissor(); | 1286 this->flushScissor(); |
1286 | 1287 |
1287 GrGLfloat r, g, b, a; | 1288 GrGLfloat r, g, b, a; |
1288 static const GrGLfloat scale255 = 1.f / 255.f; | 1289 static const GrGLfloat scale255 = 1.f / 255.f; |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1515 | 1516 |
1516 void GrGpuGL::flushRenderTarget(const SkIRect* bound) { | 1517 void GrGpuGL::flushRenderTarget(const SkIRect* bound) { |
1517 | 1518 |
1518 GrGLRenderTarget* rt = | 1519 GrGLRenderTarget* rt = |
1519 static_cast<GrGLRenderTarget*>(this->drawState()->getRenderTarget()); | 1520 static_cast<GrGLRenderTarget*>(this->drawState()->getRenderTarget()); |
1520 SkASSERT(NULL != rt); | 1521 SkASSERT(NULL != rt); |
1521 | 1522 |
1522 if (fHWBoundRenderTarget != rt) { | 1523 if (fHWBoundRenderTarget != rt) { |
1523 GL_CALL(BindFramebuffer(GR_GL_FRAMEBUFFER, rt->renderFBOID())); | 1524 GL_CALL(BindFramebuffer(GR_GL_FRAMEBUFFER, rt->renderFBOID())); |
1524 #ifdef SK_DEBUG | 1525 #ifdef SK_DEBUG |
1525 GrGLenum status; | 1526 // don't do this check in Chromium -- this is causing |
1526 GL_CALL_RET(status, CheckFramebufferStatus(GR_GL_FRAMEBUFFER)); | 1527 // lots of repeated command buffer flushes when the compositor is |
1527 if (status != GR_GL_FRAMEBUFFER_COMPLETE) { | 1528 // rendering with Ganesh, which is really slow; even too slow for |
1528 GrPrintf("GrGpuGL::flushRenderTarget glCheckFramebufferStatus %x\n",
status); | 1529 // Debug mode. |
| 1530 if (!this->glContext().info().isChromium()) { |
| 1531 GrGLenum status; |
| 1532 GL_CALL_RET(status, CheckFramebufferStatus(GR_GL_FRAMEBUFFER)); |
| 1533 if (status != GR_GL_FRAMEBUFFER_COMPLETE) { |
| 1534 GrPrintf("GrGpuGL::flushRenderTarget glCheckFramebufferStatus %x
\n", status); |
| 1535 } |
1529 } | 1536 } |
1530 #endif | 1537 #endif |
1531 fHWBoundRenderTarget = rt; | 1538 fHWBoundRenderTarget = rt; |
1532 const GrGLIRect& vp = rt->getViewport(); | 1539 const GrGLIRect& vp = rt->getViewport(); |
1533 if (fHWViewport != vp) { | 1540 if (fHWViewport != vp) { |
1534 vp.pushToGLViewport(this->glInterface()); | 1541 vp.pushToGLViewport(this->glInterface()); |
1535 fHWViewport = vp; | 1542 fHWViewport = vp; |
1536 } | 1543 } |
1537 } | 1544 } |
1538 if (NULL == bound || !bound->isEmpty()) { | 1545 if (NULL == bound || !bound->isEmpty()) { |
(...skipping 1143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2682 this->setVertexArrayID(gpu, 0); | 2689 this->setVertexArrayID(gpu, 0); |
2683 } | 2690 } |
2684 int attrCount = gpu->glCaps().maxVertexAttributes(); | 2691 int attrCount = gpu->glCaps().maxVertexAttributes(); |
2685 if (fDefaultVertexArrayAttribState.count() != attrCount) { | 2692 if (fDefaultVertexArrayAttribState.count() != attrCount) { |
2686 fDefaultVertexArrayAttribState.resize(attrCount); | 2693 fDefaultVertexArrayAttribState.resize(attrCount); |
2687 } | 2694 } |
2688 attribState = &fDefaultVertexArrayAttribState; | 2695 attribState = &fDefaultVertexArrayAttribState; |
2689 } | 2696 } |
2690 return attribState; | 2697 return attribState; |
2691 } | 2698 } |
OLD | NEW |