| 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 1331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1342 this->notifyIndexBufferDelete(desc.fID); | 1342 this->notifyIndexBufferDelete(desc.fID); |
| 1343 return NULL; | 1343 return NULL; |
| 1344 } | 1344 } |
| 1345 GrIndexBuffer* indexBuffer = SkNEW_ARGS(GrGLIndexBuffer, (this, desc
)); | 1345 GrIndexBuffer* indexBuffer = SkNEW_ARGS(GrGLIndexBuffer, (this, desc
)); |
| 1346 return indexBuffer; | 1346 return indexBuffer; |
| 1347 } | 1347 } |
| 1348 return NULL; | 1348 return NULL; |
| 1349 } | 1349 } |
| 1350 } | 1350 } |
| 1351 | 1351 |
| 1352 void GrGpuGL::flushScissor() { | 1352 void GrGpuGL::flushScissor(const GrGLIRect& rtViewport, GrSurfaceOrigin rtOrigin
) { |
| 1353 if (fScissorState.fEnabled) { | 1353 if (fScissorState.fEnabled) { |
| 1354 // Only access the RT if scissoring is being enabled. We can call this b
efore performing | |
| 1355 // a glBitframebuffer for a surface->surface copy, which requires no RT
to be bound to the | |
| 1356 // GrDrawState. | |
| 1357 const GrDrawState& drawState = this->getDrawState(); | |
| 1358 const GrGLRenderTarget* rt = | |
| 1359 static_cast<const GrGLRenderTarget*>(drawState.getRenderTarget()); | |
| 1360 | |
| 1361 SkASSERT(NULL != rt); | |
| 1362 const GrGLIRect& vp = rt->getViewport(); | |
| 1363 GrGLIRect scissor; | 1354 GrGLIRect scissor; |
| 1364 scissor.setRelativeTo(vp, | 1355 scissor.setRelativeTo(rtViewport, |
| 1365 fScissorState.fRect.fLeft, | 1356 fScissorState.fRect.fLeft, |
| 1366 fScissorState.fRect.fTop, | 1357 fScissorState.fRect.fTop, |
| 1367 fScissorState.fRect.width(), | 1358 fScissorState.fRect.width(), |
| 1368 fScissorState.fRect.height(), | 1359 fScissorState.fRect.height(), |
| 1369 rt->origin()); | 1360 rtOrigin); |
| 1370 // if the scissor fully contains the viewport then we fall through and | 1361 // if the scissor fully contains the viewport then we fall through and |
| 1371 // disable the scissor test. | 1362 // disable the scissor test. |
| 1372 if (!scissor.contains(vp)) { | 1363 if (!scissor.contains(rtViewport)) { |
| 1373 if (fHWScissorSettings.fRect != scissor) { | 1364 if (fHWScissorSettings.fRect != scissor) { |
| 1374 scissor.pushToGLScissor(this->glInterface()); | 1365 scissor.pushToGLScissor(this->glInterface()); |
| 1375 fHWScissorSettings.fRect = scissor; | 1366 fHWScissorSettings.fRect = scissor; |
| 1376 } | 1367 } |
| 1377 if (kYes_TriState != fHWScissorSettings.fEnabled) { | 1368 if (kYes_TriState != fHWScissorSettings.fEnabled) { |
| 1378 GL_CALL(Enable(GR_GL_SCISSOR_TEST)); | 1369 GL_CALL(Enable(GR_GL_SCISSOR_TEST)); |
| 1379 fHWScissorSettings.fEnabled = kYes_TriState; | 1370 fHWScissorSettings.fEnabled = kYes_TriState; |
| 1380 } | 1371 } |
| 1381 return; | 1372 return; |
| 1382 } | 1373 } |
| 1383 } | 1374 } |
| 1384 if (kNo_TriState != fHWScissorSettings.fEnabled) { | 1375 if (kNo_TriState != fHWScissorSettings.fEnabled) { |
| 1385 GL_CALL(Disable(GR_GL_SCISSOR_TEST)); | 1376 GL_CALL(Disable(GR_GL_SCISSOR_TEST)); |
| 1386 fHWScissorSettings.fEnabled = kNo_TriState; | 1377 fHWScissorSettings.fEnabled = kNo_TriState; |
| 1387 return; | 1378 return; |
| 1388 } | 1379 } |
| 1389 } | 1380 } |
| 1390 | 1381 |
| 1391 void GrGpuGL::onClear(const SkIRect* rect, GrColor color, bool canIgnoreRect) { | 1382 void GrGpuGL::onClear(GrRenderTarget* target, const SkIRect* rect, GrColor color
, |
| 1392 const GrDrawState& drawState = this->getDrawState(); | 1383 bool canIgnoreRect) { |
| 1393 const GrRenderTarget* rt = drawState.getRenderTarget(); | |
| 1394 // parent class should never let us get here with no RT | 1384 // parent class should never let us get here with no RT |
| 1395 SkASSERT(NULL != rt); | 1385 SkASSERT(NULL != target); |
| 1386 GrGLRenderTarget* glRT = static_cast<GrGLRenderTarget*>(target); |
| 1396 | 1387 |
| 1397 if (canIgnoreRect && this->glCaps().fullClearIsFree()) { | 1388 if (canIgnoreRect && this->glCaps().fullClearIsFree()) { |
| 1398 rect = NULL; | 1389 rect = NULL; |
| 1399 } | 1390 } |
| 1400 | 1391 |
| 1401 SkIRect clippedRect; | 1392 SkIRect clippedRect; |
| 1402 if (NULL != rect) { | 1393 if (NULL != rect) { |
| 1403 // flushScissor expects rect to be clipped to the target. | 1394 // flushScissor expects rect to be clipped to the target. |
| 1404 clippedRect = *rect; | 1395 clippedRect = *rect; |
| 1405 SkIRect rtRect = SkIRect::MakeWH(rt->width(), rt->height()); | 1396 SkIRect rtRect = SkIRect::MakeWH(target->width(), target->height()); |
| 1406 if (clippedRect.intersect(rtRect)) { | 1397 if (clippedRect.intersect(rtRect)) { |
| 1407 rect = &clippedRect; | 1398 rect = &clippedRect; |
| 1408 } else { | 1399 } else { |
| 1409 return; | 1400 return; |
| 1410 } | 1401 } |
| 1411 } | 1402 } |
| 1412 | 1403 |
| 1413 this->flushRenderTarget(rect); | 1404 this->flushRenderTarget(glRT, rect); |
| 1414 GrAutoTRestore<ScissorState> asr(&fScissorState); | 1405 GrAutoTRestore<ScissorState> asr(&fScissorState); |
| 1415 fScissorState.fEnabled = (NULL != rect); | 1406 fScissorState.fEnabled = (NULL != rect); |
| 1416 if (fScissorState.fEnabled) { | 1407 if (fScissorState.fEnabled) { |
| 1417 fScissorState.fRect = *rect; | 1408 fScissorState.fRect = *rect; |
| 1418 } | 1409 } |
| 1419 this->flushScissor(); | 1410 this->flushScissor(glRT->getViewport(), glRT->origin()); |
| 1420 | 1411 |
| 1421 GrGLfloat r, g, b, a; | 1412 GrGLfloat r, g, b, a; |
| 1422 static const GrGLfloat scale255 = 1.f / 255.f; | 1413 static const GrGLfloat scale255 = 1.f / 255.f; |
| 1423 a = GrColorUnpackA(color) * scale255; | 1414 a = GrColorUnpackA(color) * scale255; |
| 1424 GrGLfloat scaleRGB = scale255; | 1415 GrGLfloat scaleRGB = scale255; |
| 1425 r = GrColorUnpackR(color) * scaleRGB; | 1416 r = GrColorUnpackR(color) * scaleRGB; |
| 1426 g = GrColorUnpackG(color) * scaleRGB; | 1417 g = GrColorUnpackG(color) * scaleRGB; |
| 1427 b = GrColorUnpackB(color) * scaleRGB; | 1418 b = GrColorUnpackB(color) * scaleRGB; |
| 1428 | 1419 |
| 1429 GL_CALL(ColorMask(GR_GL_TRUE, GR_GL_TRUE, GR_GL_TRUE, GR_GL_TRUE)); | 1420 GL_CALL(ColorMask(GR_GL_TRUE, GR_GL_TRUE, GR_GL_TRUE, GR_GL_TRUE)); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1479 GL_CALL(DiscardFramebuffer(GR_GL_FRAMEBUFFER, SK_ARRAY_COUNT(att
achments), | 1470 GL_CALL(DiscardFramebuffer(GR_GL_FRAMEBUFFER, SK_ARRAY_COUNT(att
achments), |
| 1480 attachments)); | 1471 attachments)); |
| 1481 } | 1472 } |
| 1482 break; | 1473 break; |
| 1483 } | 1474 } |
| 1484 } | 1475 } |
| 1485 renderTarget->flagAsResolved(); | 1476 renderTarget->flagAsResolved(); |
| 1486 } | 1477 } |
| 1487 | 1478 |
| 1488 | 1479 |
| 1489 void GrGpuGL::clearStencil() { | 1480 void GrGpuGL::clearStencil(GrRenderTarget* target) { |
| 1490 if (NULL == this->getDrawState().getRenderTarget()) { | 1481 if (NULL == target) { |
| 1491 return; | 1482 return; |
| 1492 } | 1483 } |
| 1493 | 1484 GrGLRenderTarget* glRT = static_cast<GrGLRenderTarget*>(target); |
| 1494 this->flushRenderTarget(&SkIRect::EmptyIRect()); | 1485 this->flushRenderTarget(glRT, &SkIRect::EmptyIRect()); |
| 1495 | 1486 |
| 1496 GrAutoTRestore<ScissorState> asr(&fScissorState); | 1487 GrAutoTRestore<ScissorState> asr(&fScissorState); |
| 1497 fScissorState.fEnabled = false; | 1488 fScissorState.fEnabled = false; |
| 1498 this->flushScissor(); | 1489 this->flushScissor(glRT->getViewport(), glRT->origin()); |
| 1499 | 1490 |
| 1500 GL_CALL(StencilMask(0xffffffff)); | 1491 GL_CALL(StencilMask(0xffffffff)); |
| 1501 GL_CALL(ClearStencil(0)); | 1492 GL_CALL(ClearStencil(0)); |
| 1502 GL_CALL(Clear(GR_GL_STENCIL_BUFFER_BIT)); | 1493 GL_CALL(Clear(GR_GL_STENCIL_BUFFER_BIT)); |
| 1503 fHWStencilSettings.invalidate(); | 1494 fHWStencilSettings.invalidate(); |
| 1504 } | 1495 } |
| 1505 | 1496 |
| 1506 void GrGpuGL::clearStencilClip(const SkIRect& rect, bool insideClip) { | 1497 void GrGpuGL::clearStencilClip(GrRenderTarget* target, const SkIRect& rect, bool
insideClip) { |
| 1507 const GrDrawState& drawState = this->getDrawState(); | 1498 SkASSERT(NULL != target); |
| 1508 const GrRenderTarget* rt = drawState.getRenderTarget(); | |
| 1509 SkASSERT(NULL != rt); | |
| 1510 | 1499 |
| 1511 // this should only be called internally when we know we have a | 1500 // this should only be called internally when we know we have a |
| 1512 // stencil buffer. | 1501 // stencil buffer. |
| 1513 SkASSERT(NULL != rt->getStencilBuffer()); | 1502 SkASSERT(NULL != target->getStencilBuffer()); |
| 1514 GrGLint stencilBitCount = rt->getStencilBuffer()->bits(); | 1503 GrGLint stencilBitCount = target->getStencilBuffer()->bits(); |
| 1515 #if 0 | 1504 #if 0 |
| 1516 SkASSERT(stencilBitCount > 0); | 1505 SkASSERT(stencilBitCount > 0); |
| 1517 GrGLint clipStencilMask = (1 << (stencilBitCount - 1)); | 1506 GrGLint clipStencilMask = (1 << (stencilBitCount - 1)); |
| 1518 #else | 1507 #else |
| 1519 // we could just clear the clip bit but when we go through | 1508 // we could just clear the clip bit but when we go through |
| 1520 // ANGLE a partial stencil mask will cause clears to be | 1509 // ANGLE a partial stencil mask will cause clears to be |
| 1521 // turned into draws. Our contract on GrDrawTarget says that | 1510 // turned into draws. Our contract on GrDrawTarget says that |
| 1522 // changing the clip between stencil passes may or may not | 1511 // changing the clip between stencil passes may or may not |
| 1523 // zero the client's clip bits. So we just clear the whole thing. | 1512 // zero the client's clip bits. So we just clear the whole thing. |
| 1524 static const GrGLint clipStencilMask = ~0; | 1513 static const GrGLint clipStencilMask = ~0; |
| 1525 #endif | 1514 #endif |
| 1526 GrGLint value; | 1515 GrGLint value; |
| 1527 if (insideClip) { | 1516 if (insideClip) { |
| 1528 value = (1 << (stencilBitCount - 1)); | 1517 value = (1 << (stencilBitCount - 1)); |
| 1529 } else { | 1518 } else { |
| 1530 value = 0; | 1519 value = 0; |
| 1531 } | 1520 } |
| 1532 this->flushRenderTarget(&SkIRect::EmptyIRect()); | 1521 GrGLRenderTarget* glRT = static_cast<GrGLRenderTarget*>(target); |
| 1522 this->flushRenderTarget(glRT, &SkIRect::EmptyIRect()); |
| 1533 | 1523 |
| 1534 GrAutoTRestore<ScissorState> asr(&fScissorState); | 1524 GrAutoTRestore<ScissorState> asr(&fScissorState); |
| 1535 fScissorState.fEnabled = true; | 1525 fScissorState.fEnabled = true; |
| 1536 fScissorState.fRect = rect; | 1526 fScissorState.fRect = rect; |
| 1537 this->flushScissor(); | 1527 this->flushScissor(glRT->getViewport(), glRT->origin()); |
| 1538 | 1528 |
| 1539 GL_CALL(StencilMask((uint32_t) clipStencilMask)); | 1529 GL_CALL(StencilMask((uint32_t) clipStencilMask)); |
| 1540 GL_CALL(ClearStencil(value)); | 1530 GL_CALL(ClearStencil(value)); |
| 1541 GL_CALL(Clear(GR_GL_STENCIL_BUFFER_BIT)); | 1531 GL_CALL(Clear(GR_GL_STENCIL_BUFFER_BIT)); |
| 1542 fHWStencilSettings.invalidate(); | 1532 fHWStencilSettings.invalidate(); |
| 1543 } | 1533 } |
| 1544 | 1534 |
| 1545 bool GrGpuGL::readPixelsWillPayForYFlip(GrRenderTarget* renderTarget, | 1535 bool GrGpuGL::readPixelsWillPayForYFlip(GrRenderTarget* renderTarget, |
| 1546 int left, int top, | 1536 int left, int top, |
| 1547 int width, int height, | 1537 int width, int height, |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1593 size_t bpp = GrBytesPerPixel(config); | 1583 size_t bpp = GrBytesPerPixel(config); |
| 1594 if (!adjust_pixel_ops_params(target->width(), target->height(), bpp, | 1584 if (!adjust_pixel_ops_params(target->width(), target->height(), bpp, |
| 1595 &left, &top, &width, &height, | 1585 &left, &top, &width, &height, |
| 1596 const_cast<const void**>(&buffer), | 1586 const_cast<const void**>(&buffer), |
| 1597 &rowBytes)) { | 1587 &rowBytes)) { |
| 1598 return false; | 1588 return false; |
| 1599 } | 1589 } |
| 1600 | 1590 |
| 1601 // resolve the render target if necessary | 1591 // resolve the render target if necessary |
| 1602 GrGLRenderTarget* tgt = static_cast<GrGLRenderTarget*>(target); | 1592 GrGLRenderTarget* tgt = static_cast<GrGLRenderTarget*>(target); |
| 1603 GrDrawState::AutoRenderTargetRestore artr; | |
| 1604 switch (tgt->getResolveType()) { | 1593 switch (tgt->getResolveType()) { |
| 1605 case GrGLRenderTarget::kCantResolve_ResolveType: | 1594 case GrGLRenderTarget::kCantResolve_ResolveType: |
| 1606 return false; | 1595 return false; |
| 1607 case GrGLRenderTarget::kAutoResolves_ResolveType: | 1596 case GrGLRenderTarget::kAutoResolves_ResolveType: |
| 1608 artr.set(this->drawState(), target); | 1597 this->flushRenderTarget(static_cast<GrGLRenderTarget*>(target), |
| 1609 this->flushRenderTarget(&SkIRect::EmptyIRect()); | 1598 &SkIRect::EmptyIRect()); |
| 1610 break; | 1599 break; |
| 1611 case GrGLRenderTarget::kCanResolve_ResolveType: | 1600 case GrGLRenderTarget::kCanResolve_ResolveType: |
| 1612 this->onResolveRenderTarget(tgt); | 1601 this->onResolveRenderTarget(tgt); |
| 1613 // we don't track the state of the READ FBO ID. | 1602 // we don't track the state of the READ FBO ID. |
| 1614 GL_CALL(BindFramebuffer(GR_GL_READ_FRAMEBUFFER, | 1603 GL_CALL(BindFramebuffer(GR_GL_READ_FRAMEBUFFER, |
| 1615 tgt->textureFBOID())); | 1604 tgt->textureFBOID())); |
| 1616 break; | 1605 break; |
| 1617 default: | 1606 default: |
| 1618 SkFAIL("Unknown resolve type"); | 1607 SkFAIL("Unknown resolve type"); |
| 1619 } | 1608 } |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1695 if (!flipY) { | 1684 if (!flipY) { |
| 1696 dst += rowBytes; | 1685 dst += rowBytes; |
| 1697 } else { | 1686 } else { |
| 1698 dst -= rowBytes; | 1687 dst -= rowBytes; |
| 1699 } | 1688 } |
| 1700 } | 1689 } |
| 1701 } | 1690 } |
| 1702 return true; | 1691 return true; |
| 1703 } | 1692 } |
| 1704 | 1693 |
| 1705 void GrGpuGL::flushRenderTarget(const SkIRect* bound) { | 1694 void GrGpuGL::flushRenderTarget(GrGLRenderTarget* target, const SkIRect* bound)
{ |
| 1706 | 1695 |
| 1707 GrGLRenderTarget* rt = | 1696 SkASSERT(NULL != target); |
| 1708 static_cast<GrGLRenderTarget*>(this->drawState()->getRenderTarget()); | |
| 1709 SkASSERT(NULL != rt); | |
| 1710 | 1697 |
| 1711 uint32_t rtID = rt->getUniqueID(); | 1698 uint32_t rtID = target->getUniqueID(); |
| 1712 if (fHWBoundRenderTargetUniqueID != rtID) { | 1699 if (fHWBoundRenderTargetUniqueID != rtID) { |
| 1713 GL_CALL(BindFramebuffer(GR_GL_FRAMEBUFFER, rt->renderFBOID())); | 1700 GL_CALL(BindFramebuffer(GR_GL_FRAMEBUFFER, target->renderFBOID())); |
| 1714 #ifdef SK_DEBUG | 1701 #ifdef SK_DEBUG |
| 1715 // don't do this check in Chromium -- this is causing | 1702 // don't do this check in Chromium -- this is causing |
| 1716 // lots of repeated command buffer flushes when the compositor is | 1703 // lots of repeated command buffer flushes when the compositor is |
| 1717 // rendering with Ganesh, which is really slow; even too slow for | 1704 // rendering with Ganesh, which is really slow; even too slow for |
| 1718 // Debug mode. | 1705 // Debug mode. |
| 1719 if (!this->glContext().isChromium()) { | 1706 if (!this->glContext().isChromium()) { |
| 1720 GrGLenum status; | 1707 GrGLenum status; |
| 1721 GL_CALL_RET(status, CheckFramebufferStatus(GR_GL_FRAMEBUFFER)); | 1708 GL_CALL_RET(status, CheckFramebufferStatus(GR_GL_FRAMEBUFFER)); |
| 1722 if (status != GR_GL_FRAMEBUFFER_COMPLETE) { | 1709 if (status != GR_GL_FRAMEBUFFER_COMPLETE) { |
| 1723 GrPrintf("GrGpuGL::flushRenderTarget glCheckFramebufferStatus %x
\n", status); | 1710 GrPrintf("GrGpuGL::flushRenderTarget glCheckFramebufferStatus %x
\n", status); |
| 1724 } | 1711 } |
| 1725 } | 1712 } |
| 1726 #endif | 1713 #endif |
| 1727 fHWBoundRenderTargetUniqueID = rtID; | 1714 fHWBoundRenderTargetUniqueID = rtID; |
| 1728 const GrGLIRect& vp = rt->getViewport(); | 1715 const GrGLIRect& vp = target->getViewport(); |
| 1729 if (fHWViewport != vp) { | 1716 if (fHWViewport != vp) { |
| 1730 vp.pushToGLViewport(this->glInterface()); | 1717 vp.pushToGLViewport(this->glInterface()); |
| 1731 fHWViewport = vp; | 1718 fHWViewport = vp; |
| 1732 } | 1719 } |
| 1733 } | 1720 } |
| 1734 if (NULL == bound || !bound->isEmpty()) { | 1721 if (NULL == bound || !bound->isEmpty()) { |
| 1735 rt->flagAsNeedingResolve(bound); | 1722 target->flagAsNeedingResolve(bound); |
| 1736 } | 1723 } |
| 1737 | 1724 |
| 1738 GrTexture *texture = rt->asTexture(); | 1725 GrTexture *texture = target->asTexture(); |
| 1739 if (NULL != texture) { | 1726 if (NULL != texture) { |
| 1740 texture->impl()->dirtyMipMaps(true); | 1727 texture->impl()->dirtyMipMaps(true); |
| 1741 } | 1728 } |
| 1742 } | 1729 } |
| 1743 | 1730 |
| 1744 GrGLenum gPrimitiveType2GLMode[] = { | 1731 GrGLenum gPrimitiveType2GLMode[] = { |
| 1745 GR_GL_TRIANGLES, | 1732 GR_GL_TRIANGLES, |
| 1746 GR_GL_TRIANGLE_STRIP, | 1733 GR_GL_TRIANGLE_STRIP, |
| 1747 GR_GL_TRIANGLE_FAN, | 1734 GR_GL_TRIANGLE_FAN, |
| 1748 GR_GL_POINTS, | 1735 GR_GL_POINTS, |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1822 GrGLIRect r; | 1809 GrGLIRect r; |
| 1823 r.setRelativeTo(vp, dirtyRect.fLeft, dirtyRect.fTop, | 1810 r.setRelativeTo(vp, dirtyRect.fLeft, dirtyRect.fTop, |
| 1824 dirtyRect.width(), dirtyRect.height(), target->origi
n()); | 1811 dirtyRect.width(), dirtyRect.height(), target->origi
n()); |
| 1825 | 1812 |
| 1826 GrAutoTRestore<ScissorState> asr; | 1813 GrAutoTRestore<ScissorState> asr; |
| 1827 if (GrGLCaps::kES_Apple_MSFBOType == this->glCaps().msFBOType()) { | 1814 if (GrGLCaps::kES_Apple_MSFBOType == this->glCaps().msFBOType()) { |
| 1828 // Apple's extension uses the scissor as the blit bounds. | 1815 // Apple's extension uses the scissor as the blit bounds. |
| 1829 asr.reset(&fScissorState); | 1816 asr.reset(&fScissorState); |
| 1830 fScissorState.fEnabled = true; | 1817 fScissorState.fEnabled = true; |
| 1831 fScissorState.fRect = dirtyRect; | 1818 fScissorState.fRect = dirtyRect; |
| 1832 this->flushScissor(); | 1819 this->flushScissor(rt->getViewport(), rt->origin()); |
| 1833 GL_CALL(ResolveMultisampleFramebuffer()); | 1820 GL_CALL(ResolveMultisampleFramebuffer()); |
| 1834 } else { | 1821 } else { |
| 1835 if (GrGLCaps::kDesktop_EXT_MSFBOType == this->glCaps().msFBOType
()) { | 1822 if (GrGLCaps::kDesktop_EXT_MSFBOType == this->glCaps().msFBOType
()) { |
| 1836 // this respects the scissor during the blit, so disable it. | 1823 // this respects the scissor during the blit, so disable it. |
| 1837 asr.reset(&fScissorState); | 1824 asr.reset(&fScissorState); |
| 1838 fScissorState.fEnabled = false; | 1825 fScissorState.fEnabled = false; |
| 1839 this->flushScissor(); | 1826 this->flushScissor(rt->getViewport(), rt->origin()); |
| 1840 } | 1827 } |
| 1841 int right = r.fLeft + r.fWidth; | 1828 int right = r.fLeft + r.fWidth; |
| 1842 int top = r.fBottom + r.fHeight; | 1829 int top = r.fBottom + r.fHeight; |
| 1843 GL_CALL(BlitFramebuffer(r.fLeft, r.fBottom, right, top, | 1830 GL_CALL(BlitFramebuffer(r.fLeft, r.fBottom, right, top, |
| 1844 r.fLeft, r.fBottom, right, top, | 1831 r.fLeft, r.fBottom, right, top, |
| 1845 GR_GL_COLOR_BUFFER_BIT, GR_GL_NEAREST)); | 1832 GR_GL_COLOR_BUFFER_BIT, GR_GL_NEAREST)); |
| 1846 } | 1833 } |
| 1847 } | 1834 } |
| 1848 rt->flagAsResolved(); | 1835 rt->flagAsResolved(); |
| 1849 } | 1836 } |
| (...skipping 655 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2505 dstRect.fTop, | 2492 dstRect.fTop, |
| 2506 dstRect.width(), | 2493 dstRect.width(), |
| 2507 dstRect.height(), | 2494 dstRect.height(), |
| 2508 dst->origin()); | 2495 dst->origin()); |
| 2509 | 2496 |
| 2510 GrAutoTRestore<ScissorState> asr; | 2497 GrAutoTRestore<ScissorState> asr; |
| 2511 if (GrGLCaps::kDesktop_EXT_MSFBOType == this->glCaps().msFBOType())
{ | 2498 if (GrGLCaps::kDesktop_EXT_MSFBOType == this->glCaps().msFBOType())
{ |
| 2512 // The EXT version applies the scissor during the blit, so disab
le it. | 2499 // The EXT version applies the scissor during the blit, so disab
le it. |
| 2513 asr.reset(&fScissorState); | 2500 asr.reset(&fScissorState); |
| 2514 fScissorState.fEnabled = false; | 2501 fScissorState.fEnabled = false; |
| 2515 this->flushScissor(); | 2502 this->flushScissor(dstGLRect, dst->origin()); |
| 2516 } | 2503 } |
| 2517 GrGLint srcY0; | 2504 GrGLint srcY0; |
| 2518 GrGLint srcY1; | 2505 GrGLint srcY1; |
| 2519 // Does the blit need to y-mirror or not? | 2506 // Does the blit need to y-mirror or not? |
| 2520 if (src->origin() == dst->origin()) { | 2507 if (src->origin() == dst->origin()) { |
| 2521 srcY0 = srcGLRect.fBottom; | 2508 srcY0 = srcGLRect.fBottom; |
| 2522 srcY1 = srcGLRect.fBottom + srcGLRect.fHeight; | 2509 srcY1 = srcGLRect.fBottom + srcGLRect.fHeight; |
| 2523 } else { | 2510 } else { |
| 2524 srcY0 = srcGLRect.fBottom + srcGLRect.fHeight; | 2511 srcY0 = srcGLRect.fBottom + srcGLRect.fHeight; |
| 2525 srcY1 = srcGLRect.fBottom; | 2512 srcY1 = srcGLRect.fBottom; |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2610 this->setVertexArrayID(gpu, 0); | 2597 this->setVertexArrayID(gpu, 0); |
| 2611 } | 2598 } |
| 2612 int attrCount = gpu->glCaps().maxVertexAttributes(); | 2599 int attrCount = gpu->glCaps().maxVertexAttributes(); |
| 2613 if (fDefaultVertexArrayAttribState.count() != attrCount) { | 2600 if (fDefaultVertexArrayAttribState.count() != attrCount) { |
| 2614 fDefaultVertexArrayAttribState.resize(attrCount); | 2601 fDefaultVertexArrayAttribState.resize(attrCount); |
| 2615 } | 2602 } |
| 2616 attribState = &fDefaultVertexArrayAttribState; | 2603 attribState = &fDefaultVertexArrayAttribState; |
| 2617 } | 2604 } |
| 2618 return attribState; | 2605 return attribState; |
| 2619 } | 2606 } |
| OLD | NEW |