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 877 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
888 } | 888 } |
889 return false; | 889 return false; |
890 } | 890 } |
891 | 891 |
892 // good to set a break-point here to know when createTexture fails | 892 // good to set a break-point here to know when createTexture fails |
893 static GrTexture* return_null_texture() { | 893 static GrTexture* return_null_texture() { |
894 // SkDEBUGFAIL("null texture"); | 894 // SkDEBUGFAIL("null texture"); |
895 return NULL; | 895 return NULL; |
896 } | 896 } |
897 | 897 |
898 #if 0 && GR_DEBUG | 898 #if 0 && defined(SK_DEBUG) |
899 static size_t as_size_t(int x) { | 899 static size_t as_size_t(int x) { |
900 return x; | 900 return x; |
901 } | 901 } |
902 #endif | 902 #endif |
903 | 903 |
904 GrTexture* GrGpuGL::onCreateTexture(const GrTextureDesc& desc, | 904 GrTexture* GrGpuGL::onCreateTexture(const GrTextureDesc& desc, |
905 const void* srcData, | 905 const void* srcData, |
906 size_t rowBytes) { | 906 size_t rowBytes) { |
907 | 907 |
908 GrGLTexture::Desc glTexDesc; | 908 GrGLTexture::Desc glTexDesc; |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1118 GrGLuint fbo = glrt->renderFBOID(); | 1118 GrGLuint fbo = glrt->renderFBOID(); |
1119 | 1119 |
1120 if (NULL == sb) { | 1120 if (NULL == sb) { |
1121 if (NULL != rt->getStencilBuffer()) { | 1121 if (NULL != rt->getStencilBuffer()) { |
1122 GL_CALL(FramebufferRenderbuffer(GR_GL_FRAMEBUFFER, | 1122 GL_CALL(FramebufferRenderbuffer(GR_GL_FRAMEBUFFER, |
1123 GR_GL_STENCIL_ATTACHMENT, | 1123 GR_GL_STENCIL_ATTACHMENT, |
1124 GR_GL_RENDERBUFFER, 0)); | 1124 GR_GL_RENDERBUFFER, 0)); |
1125 GL_CALL(FramebufferRenderbuffer(GR_GL_FRAMEBUFFER, | 1125 GL_CALL(FramebufferRenderbuffer(GR_GL_FRAMEBUFFER, |
1126 GR_GL_DEPTH_ATTACHMENT, | 1126 GR_GL_DEPTH_ATTACHMENT, |
1127 GR_GL_RENDERBUFFER, 0)); | 1127 GR_GL_RENDERBUFFER, 0)); |
1128 #if GR_DEBUG | 1128 #ifdef SK_DEBUG |
1129 GrGLenum status; | 1129 GrGLenum status; |
1130 GL_CALL_RET(status, CheckFramebufferStatus(GR_GL_FRAMEBUFFER)); | 1130 GL_CALL_RET(status, CheckFramebufferStatus(GR_GL_FRAMEBUFFER)); |
1131 SkASSERT(GR_GL_FRAMEBUFFER_COMPLETE == status); | 1131 SkASSERT(GR_GL_FRAMEBUFFER_COMPLETE == status); |
1132 #endif | 1132 #endif |
1133 } | 1133 } |
1134 return true; | 1134 return true; |
1135 } else { | 1135 } else { |
1136 GrGLStencilBuffer* glsb = static_cast<GrGLStencilBuffer*>(sb); | 1136 GrGLStencilBuffer* glsb = static_cast<GrGLStencilBuffer*>(sb); |
1137 GrGLuint rb = glsb->renderbufferID(); | 1137 GrGLuint rb = glsb->renderbufferID(); |
1138 | 1138 |
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1538 } | 1538 } |
1539 | 1539 |
1540 void GrGpuGL::flushRenderTarget(const SkIRect* bound) { | 1540 void GrGpuGL::flushRenderTarget(const SkIRect* bound) { |
1541 | 1541 |
1542 GrGLRenderTarget* rt = | 1542 GrGLRenderTarget* rt = |
1543 static_cast<GrGLRenderTarget*>(this->drawState()->getRenderTarget()); | 1543 static_cast<GrGLRenderTarget*>(this->drawState()->getRenderTarget()); |
1544 SkASSERT(NULL != rt); | 1544 SkASSERT(NULL != rt); |
1545 | 1545 |
1546 if (fHWBoundRenderTarget != rt) { | 1546 if (fHWBoundRenderTarget != rt) { |
1547 GL_CALL(BindFramebuffer(GR_GL_FRAMEBUFFER, rt->renderFBOID())); | 1547 GL_CALL(BindFramebuffer(GR_GL_FRAMEBUFFER, rt->renderFBOID())); |
1548 #if GR_DEBUG | 1548 #ifdef SK_DEBUG |
1549 GrGLenum status; | 1549 GrGLenum status; |
1550 GL_CALL_RET(status, CheckFramebufferStatus(GR_GL_FRAMEBUFFER)); | 1550 GL_CALL_RET(status, CheckFramebufferStatus(GR_GL_FRAMEBUFFER)); |
1551 if (status != GR_GL_FRAMEBUFFER_COMPLETE) { | 1551 if (status != GR_GL_FRAMEBUFFER_COMPLETE) { |
1552 GrPrintf("GrGpuGL::flushRenderTarget glCheckFramebufferStatus %x\n",
status); | 1552 GrPrintf("GrGpuGL::flushRenderTarget glCheckFramebufferStatus %x\n",
status); |
1553 } | 1553 } |
1554 #endif | 1554 #endif |
1555 fHWBoundRenderTarget = rt; | 1555 fHWBoundRenderTarget = rt; |
1556 const GrGLIRect& vp = rt->getViewport(); | 1556 const GrGLIRect& vp = rt->getViewport(); |
1557 if (fHWViewport != vp) { | 1557 if (fHWViewport != vp) { |
1558 vp.pushToGLViewport(this->glInterface()); | 1558 vp.pushToGLViewport(this->glInterface()); |
(...skipping 1000 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2559 this->setVertexArrayID(gpu, 0); | 2559 this->setVertexArrayID(gpu, 0); |
2560 } | 2560 } |
2561 int attrCount = gpu->glCaps().maxVertexAttributes(); | 2561 int attrCount = gpu->glCaps().maxVertexAttributes(); |
2562 if (fDefaultVertexArrayAttribState.count() != attrCount) { | 2562 if (fDefaultVertexArrayAttribState.count() != attrCount) { |
2563 fDefaultVertexArrayAttribState.resize(attrCount); | 2563 fDefaultVertexArrayAttribState.resize(attrCount); |
2564 } | 2564 } |
2565 attribState = &fDefaultVertexArrayAttribState; | 2565 attribState = &fDefaultVertexArrayAttribState; |
2566 } | 2566 } |
2567 return attribState; | 2567 return attribState; |
2568 } | 2568 } |
OLD | NEW |