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 712 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
723 break; | 723 break; |
724 case GrGLCaps::kES_EXT_MsToTexture_MSFBOType: | 724 case GrGLCaps::kES_EXT_MsToTexture_MSFBOType: |
725 case GrGLCaps::kES_IMG_MsToTexture_MSFBOType: | 725 case GrGLCaps::kES_IMG_MsToTexture_MSFBOType: |
726 GL_ALLOC_CALL(ctx.interface(), | 726 GL_ALLOC_CALL(ctx.interface(), |
727 RenderbufferStorageMultisampleES2EXT(GR_GL_RENDERBUF
FER, | 727 RenderbufferStorageMultisampleES2EXT(GR_GL_RENDERBUF
FER, |
728 sampleCount, | 728 sampleCount, |
729 format, | 729 format, |
730 width, height)); | 730 width, height)); |
731 break; | 731 break; |
732 case GrGLCaps::kNone_MSFBOType: | 732 case GrGLCaps::kNone_MSFBOType: |
733 GrCrash("Shouldn't be here if we don't support multisampled renderbu
ffers."); | 733 SkFAIL("Shouldn't be here if we don't support multisampled renderbuf
fers."); |
734 break; | 734 break; |
735 } | 735 } |
736 return (GR_GL_NO_ERROR == CHECK_ALLOC_ERROR(ctx.interface()));; | 736 return (GR_GL_NO_ERROR == CHECK_ALLOC_ERROR(ctx.interface()));; |
737 } | 737 } |
738 | 738 |
739 bool GrGpuGL::createRenderTargetObjects(int width, int height, | 739 bool GrGpuGL::createRenderTargetObjects(int width, int height, |
740 GrGLuint texID, | 740 GrGLuint texID, |
741 GrGLRenderTarget::Desc* desc) { | 741 GrGLRenderTarget::Desc* desc) { |
742 desc->fMSColorRenderbufferID = 0; | 742 desc->fMSColorRenderbufferID = 0; |
743 desc->fRTFBOID = 0; | 743 desc->fRTFBOID = 0; |
(...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1296 } | 1296 } |
1297 } | 1297 } |
1298 | 1298 |
1299 GrGLRenderTarget* glRT = static_cast<GrGLRenderTarget*>(renderTarget); | 1299 GrGLRenderTarget* glRT = static_cast<GrGLRenderTarget*>(renderTarget); |
1300 if (renderTarget != fHWBoundRenderTarget) { | 1300 if (renderTarget != fHWBoundRenderTarget) { |
1301 fHWBoundRenderTarget = NULL; | 1301 fHWBoundRenderTarget = NULL; |
1302 GL_CALL(BindFramebuffer(GR_GL_FRAMEBUFFER, glRT->renderFBOID())); | 1302 GL_CALL(BindFramebuffer(GR_GL_FRAMEBUFFER, glRT->renderFBOID())); |
1303 } | 1303 } |
1304 switch (this->glCaps().invalidateFBType()) { | 1304 switch (this->glCaps().invalidateFBType()) { |
1305 case GrGLCaps::kNone_FBFetchType: | 1305 case GrGLCaps::kNone_FBFetchType: |
1306 GrCrash("Should never get here."); | 1306 SkFAIL("Should never get here."); |
1307 break; | 1307 break; |
1308 case GrGLCaps::kInvalidate_InvalidateFBType: | 1308 case GrGLCaps::kInvalidate_InvalidateFBType: |
1309 if (0 == glRT->renderFBOID()) { | 1309 if (0 == glRT->renderFBOID()) { |
1310 // When rendering to the default framebuffer the legal values f
or attachments | 1310 // When rendering to the default framebuffer the legal values f
or attachments |
1311 // are GL_COLOR, GL_DEPTH, GL_STENCIL, ... rather than the vari
ous FBO attachment | 1311 // are GL_COLOR, GL_DEPTH, GL_STENCIL, ... rather than the vari
ous FBO attachment |
1312 // types. | 1312 // types. |
1313 static const GrGLenum attachments[] = { GR_GL_COLOR }; | 1313 static const GrGLenum attachments[] = { GR_GL_COLOR }; |
1314 GL_CALL(InvalidateFramebuffer(GR_GL_FRAMEBUFFER, SK_ARRAY_COUNT(
attachments), | 1314 GL_CALL(InvalidateFramebuffer(GR_GL_FRAMEBUFFER, SK_ARRAY_COUNT(
attachments), |
1315 attachments)); | 1315 attachments)); |
1316 } else { | 1316 } else { |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1456 artr.set(this->drawState(), target); | 1456 artr.set(this->drawState(), target); |
1457 this->flushRenderTarget(&SkIRect::EmptyIRect()); | 1457 this->flushRenderTarget(&SkIRect::EmptyIRect()); |
1458 break; | 1458 break; |
1459 case GrGLRenderTarget::kCanResolve_ResolveType: | 1459 case GrGLRenderTarget::kCanResolve_ResolveType: |
1460 this->onResolveRenderTarget(tgt); | 1460 this->onResolveRenderTarget(tgt); |
1461 // we don't track the state of the READ FBO ID. | 1461 // we don't track the state of the READ FBO ID. |
1462 GL_CALL(BindFramebuffer(GR_GL_READ_FRAMEBUFFER, | 1462 GL_CALL(BindFramebuffer(GR_GL_READ_FRAMEBUFFER, |
1463 tgt->textureFBOID())); | 1463 tgt->textureFBOID())); |
1464 break; | 1464 break; |
1465 default: | 1465 default: |
1466 GrCrash("Unknown resolve type"); | 1466 SkFAIL("Unknown resolve type"); |
1467 } | 1467 } |
1468 | 1468 |
1469 const GrGLIRect& glvp = tgt->getViewport(); | 1469 const GrGLIRect& glvp = tgt->getViewport(); |
1470 | 1470 |
1471 // the read rect is viewport-relative | 1471 // the read rect is viewport-relative |
1472 GrGLIRect readRect; | 1472 GrGLIRect readRect; |
1473 readRect.setRelativeTo(glvp, left, top, width, height, target->origin()); | 1473 readRect.setRelativeTo(glvp, left, top, width, height, target->origin()); |
1474 | 1474 |
1475 size_t tightRowBytes = bpp * width; | 1475 size_t tightRowBytes = bpp * width; |
1476 if (0 == rowBytes) { | 1476 if (0 == rowBytes) { |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1649 SwapBuf(); | 1649 SwapBuf(); |
1650 int set_a_break_pt_here = 9; | 1650 int set_a_break_pt_here = 9; |
1651 SwapBuf(); | 1651 SwapBuf(); |
1652 #endif | 1652 #endif |
1653 #endif | 1653 #endif |
1654 } | 1654 } |
1655 | 1655 |
1656 static GrGLenum gr_stencil_op_to_gl_path_rendering_fill_mode(GrStencilOp op) { | 1656 static GrGLenum gr_stencil_op_to_gl_path_rendering_fill_mode(GrStencilOp op) { |
1657 switch (op) { | 1657 switch (op) { |
1658 default: | 1658 default: |
1659 GrCrash("Unexpected path fill."); | 1659 SkFAIL("Unexpected path fill."); |
1660 /* fallthrough */; | 1660 /* fallthrough */; |
1661 case kIncClamp_StencilOp: | 1661 case kIncClamp_StencilOp: |
1662 return GR_GL_COUNT_UP; | 1662 return GR_GL_COUNT_UP; |
1663 case kInvert_StencilOp: | 1663 case kInvert_StencilOp: |
1664 return GR_GL_INVERT; | 1664 return GR_GL_INVERT; |
1665 } | 1665 } |
1666 } | 1666 } |
1667 | 1667 |
1668 void GrGpuGL::onGpuStencilPath(const GrPath* path, SkPath::FillType fill) { | 1668 void GrGpuGL::onGpuStencilPath(const GrPath* path, SkPath::FillType fill) { |
1669 SkASSERT(this->caps()->pathRenderingSupport()); | 1669 SkASSERT(this->caps()->pathRenderingSupport()); |
(...skipping 680 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2350 GL_CALL(CullFace(GR_GL_BACK)); | 2350 GL_CALL(CullFace(GR_GL_BACK)); |
2351 break; | 2351 break; |
2352 case GrDrawState::kCW_DrawFace: | 2352 case GrDrawState::kCW_DrawFace: |
2353 GL_CALL(Enable(GR_GL_CULL_FACE)); | 2353 GL_CALL(Enable(GR_GL_CULL_FACE)); |
2354 GL_CALL(CullFace(GR_GL_FRONT)); | 2354 GL_CALL(CullFace(GR_GL_FRONT)); |
2355 break; | 2355 break; |
2356 case GrDrawState::kBoth_DrawFace: | 2356 case GrDrawState::kBoth_DrawFace: |
2357 GL_CALL(Disable(GR_GL_CULL_FACE)); | 2357 GL_CALL(Disable(GR_GL_CULL_FACE)); |
2358 break; | 2358 break; |
2359 default: | 2359 default: |
2360 GrCrash("Unknown draw face."); | 2360 SkFAIL("Unknown draw face."); |
2361 } | 2361 } |
2362 fHWDrawFace = drawState.getDrawFace(); | 2362 fHWDrawFace = drawState.getDrawFace(); |
2363 } | 2363 } |
2364 } | 2364 } |
2365 | 2365 |
2366 void GrGpuGL::notifyRenderTargetDelete(GrRenderTarget* renderTarget) { | 2366 void GrGpuGL::notifyRenderTargetDelete(GrRenderTarget* renderTarget) { |
2367 SkASSERT(NULL != renderTarget); | 2367 SkASSERT(NULL != renderTarget); |
2368 if (fHWBoundRenderTarget == renderTarget) { | 2368 if (fHWBoundRenderTarget == renderTarget) { |
2369 fHWBoundRenderTarget = NULL; | 2369 fHWBoundRenderTarget = NULL; |
2370 } | 2370 } |
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2803 this->setVertexArrayID(gpu, 0); | 2803 this->setVertexArrayID(gpu, 0); |
2804 } | 2804 } |
2805 int attrCount = gpu->glCaps().maxVertexAttributes(); | 2805 int attrCount = gpu->glCaps().maxVertexAttributes(); |
2806 if (fDefaultVertexArrayAttribState.count() != attrCount) { | 2806 if (fDefaultVertexArrayAttribState.count() != attrCount) { |
2807 fDefaultVertexArrayAttribState.resize(attrCount); | 2807 fDefaultVertexArrayAttribState.resize(attrCount); |
2808 } | 2808 } |
2809 attribState = &fDefaultVertexArrayAttribState; | 2809 attribState = &fDefaultVertexArrayAttribState; |
2810 } | 2810 } |
2811 return attribState; | 2811 return attribState; |
2812 } | 2812 } |
OLD | NEW |