Chromium Code Reviews| 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 871 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 882 } | 882 } |
| 883 return false; | 883 return false; |
| 884 } | 884 } |
| 885 | 885 |
| 886 // good to set a break-point here to know when createTexture fails | 886 // good to set a break-point here to know when createTexture fails |
| 887 static GrTexture* return_null_texture() { | 887 static GrTexture* return_null_texture() { |
| 888 // SkASSERT(!"null texture"); | 888 // SkASSERT(!"null texture"); |
| 889 return NULL; | 889 return NULL; |
| 890 } | 890 } |
| 891 | 891 |
| 892 #if 0 && GR_DEBUG | 892 #if 0 && SK_DEBUG |
|
bsalomon
2013/08/24 02:28:36
#if 0 && defined(SK_DEBUG)
tfarina
2013/08/24 23:25:49
Done.
| |
| 893 static size_t as_size_t(int x) { | 893 static size_t as_size_t(int x) { |
| 894 return x; | 894 return x; |
| 895 } | 895 } |
| 896 #endif | 896 #endif |
| 897 | 897 |
| 898 GrTexture* GrGpuGL::onCreateTexture(const GrTextureDesc& desc, | 898 GrTexture* GrGpuGL::onCreateTexture(const GrTextureDesc& desc, |
| 899 const void* srcData, | 899 const void* srcData, |
| 900 size_t rowBytes) { | 900 size_t rowBytes) { |
| 901 | 901 |
| 902 GrGLTexture::Desc glTexDesc; | 902 GrGLTexture::Desc glTexDesc; |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1112 GrGLuint fbo = glrt->renderFBOID(); | 1112 GrGLuint fbo = glrt->renderFBOID(); |
| 1113 | 1113 |
| 1114 if (NULL == sb) { | 1114 if (NULL == sb) { |
| 1115 if (NULL != rt->getStencilBuffer()) { | 1115 if (NULL != rt->getStencilBuffer()) { |
| 1116 GL_CALL(FramebufferRenderbuffer(GR_GL_FRAMEBUFFER, | 1116 GL_CALL(FramebufferRenderbuffer(GR_GL_FRAMEBUFFER, |
| 1117 GR_GL_STENCIL_ATTACHMENT, | 1117 GR_GL_STENCIL_ATTACHMENT, |
| 1118 GR_GL_RENDERBUFFER, 0)); | 1118 GR_GL_RENDERBUFFER, 0)); |
| 1119 GL_CALL(FramebufferRenderbuffer(GR_GL_FRAMEBUFFER, | 1119 GL_CALL(FramebufferRenderbuffer(GR_GL_FRAMEBUFFER, |
| 1120 GR_GL_DEPTH_ATTACHMENT, | 1120 GR_GL_DEPTH_ATTACHMENT, |
| 1121 GR_GL_RENDERBUFFER, 0)); | 1121 GR_GL_RENDERBUFFER, 0)); |
| 1122 #if GR_DEBUG | 1122 #ifdef SK_DEBUG |
| 1123 GrGLenum status; | 1123 GrGLenum status; |
| 1124 GL_CALL_RET(status, CheckFramebufferStatus(GR_GL_FRAMEBUFFER)); | 1124 GL_CALL_RET(status, CheckFramebufferStatus(GR_GL_FRAMEBUFFER)); |
| 1125 SkASSERT(GR_GL_FRAMEBUFFER_COMPLETE == status); | 1125 SkASSERT(GR_GL_FRAMEBUFFER_COMPLETE == status); |
| 1126 #endif | 1126 #endif |
| 1127 } | 1127 } |
| 1128 return true; | 1128 return true; |
| 1129 } else { | 1129 } else { |
| 1130 GrGLStencilBuffer* glsb = static_cast<GrGLStencilBuffer*>(sb); | 1130 GrGLStencilBuffer* glsb = static_cast<GrGLStencilBuffer*>(sb); |
| 1131 GrGLuint rb = glsb->renderbufferID(); | 1131 GrGLuint rb = glsb->renderbufferID(); |
| 1132 | 1132 |
| (...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1532 } | 1532 } |
| 1533 | 1533 |
| 1534 void GrGpuGL::flushRenderTarget(const SkIRect* bound) { | 1534 void GrGpuGL::flushRenderTarget(const SkIRect* bound) { |
| 1535 | 1535 |
| 1536 GrGLRenderTarget* rt = | 1536 GrGLRenderTarget* rt = |
| 1537 static_cast<GrGLRenderTarget*>(this->drawState()->getRenderTarget()); | 1537 static_cast<GrGLRenderTarget*>(this->drawState()->getRenderTarget()); |
| 1538 SkASSERT(NULL != rt); | 1538 SkASSERT(NULL != rt); |
| 1539 | 1539 |
| 1540 if (fHWBoundRenderTarget != rt) { | 1540 if (fHWBoundRenderTarget != rt) { |
| 1541 GL_CALL(BindFramebuffer(GR_GL_FRAMEBUFFER, rt->renderFBOID())); | 1541 GL_CALL(BindFramebuffer(GR_GL_FRAMEBUFFER, rt->renderFBOID())); |
| 1542 #if GR_DEBUG | 1542 #ifdef SK_DEBUG |
| 1543 GrGLenum status; | 1543 GrGLenum status; |
| 1544 GL_CALL_RET(status, CheckFramebufferStatus(GR_GL_FRAMEBUFFER)); | 1544 GL_CALL_RET(status, CheckFramebufferStatus(GR_GL_FRAMEBUFFER)); |
| 1545 if (status != GR_GL_FRAMEBUFFER_COMPLETE) { | 1545 if (status != GR_GL_FRAMEBUFFER_COMPLETE) { |
| 1546 GrPrintf("GrGpuGL::flushRenderTarget glCheckFramebufferStatus %x\n", status); | 1546 GrPrintf("GrGpuGL::flushRenderTarget glCheckFramebufferStatus %x\n", status); |
| 1547 } | 1547 } |
| 1548 #endif | 1548 #endif |
| 1549 fHWBoundRenderTarget = rt; | 1549 fHWBoundRenderTarget = rt; |
| 1550 const GrGLIRect& vp = rt->getViewport(); | 1550 const GrGLIRect& vp = rt->getViewport(); |
| 1551 if (fHWViewport != vp) { | 1551 if (fHWViewport != vp) { |
| 1552 vp.pushToGLViewport(this->glInterface()); | 1552 vp.pushToGLViewport(this->glInterface()); |
| (...skipping 999 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2552 this->setVertexArrayID(gpu, 0); | 2552 this->setVertexArrayID(gpu, 0); |
| 2553 } | 2553 } |
| 2554 int attrCount = gpu->glCaps().maxVertexAttributes(); | 2554 int attrCount = gpu->glCaps().maxVertexAttributes(); |
| 2555 if (fDefaultVertexArrayAttribState.count() != attrCount) { | 2555 if (fDefaultVertexArrayAttribState.count() != attrCount) { |
| 2556 fDefaultVertexArrayAttribState.resize(attrCount); | 2556 fDefaultVertexArrayAttribState.resize(attrCount); |
| 2557 } | 2557 } |
| 2558 attribState = &fDefaultVertexArrayAttribState; | 2558 attribState = &fDefaultVertexArrayAttribState; |
| 2559 } | 2559 } |
| 2560 return attribState; | 2560 return attribState; |
| 2561 } | 2561 } |
| OLD | NEW |