| 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 #include "GrGLRenderTarget.h" | 8 #include "GrGLRenderTarget.h" |
| 9 | 9 |
| 10 #include "GrRenderTargetPriv.h" | 10 #include "GrRenderTargetPriv.h" |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 | 82 |
| 83 size_t GrGLRenderTarget::onGpuMemorySize() const { | 83 size_t GrGLRenderTarget::onGpuMemorySize() const { |
| 84 return fGpuMemorySize; | 84 return fGpuMemorySize; |
| 85 } | 85 } |
| 86 | 86 |
| 87 bool GrGLRenderTarget::completeStencilAttachment() { | 87 bool GrGLRenderTarget::completeStencilAttachment() { |
| 88 GrGLGpu* gpu = this->getGLGpu(); | 88 GrGLGpu* gpu = this->getGLGpu(); |
| 89 const GrGLInterface* interface = gpu->glInterface(); | 89 const GrGLInterface* interface = gpu->glInterface(); |
| 90 GrStencilAttachment* stencil = this->renderTargetPriv().getStencilAttachment
(); | 90 GrStencilAttachment* stencil = this->renderTargetPriv().getStencilAttachment
(); |
| 91 if (nullptr == stencil) { | 91 if (nullptr == stencil) { |
| 92 if (this->renderTargetPriv().getStencilAttachment()) { | 92 GR_GL_CALL(interface, FramebufferRenderbuffer(GR_GL_FRAMEBUFFER, |
| 93 GR_GL_CALL(interface, FramebufferRenderbuffer(GR_GL_FRAMEBUFFER, | 93 GR_GL_STENCIL_ATTACHMENT, |
| 94 GR_GL_STENCIL_ATTACHME
NT, | 94 GR_GL_RENDERBUFFER, 0)); |
| 95 GR_GL_RENDERBUFFER, 0)
); | 95 GR_GL_CALL(interface, FramebufferRenderbuffer(GR_GL_FRAMEBUFFER, |
| 96 GR_GL_CALL(interface, FramebufferRenderbuffer(GR_GL_FRAMEBUFFER, | 96 GR_GL_DEPTH_ATTACHMENT, |
| 97 GR_GL_DEPTH_ATTACHMENT
, | 97 GR_GL_RENDERBUFFER, 0)); |
| 98 GR_GL_RENDERBUFFER, 0)
); | |
| 99 #ifdef SK_DEBUG | 98 #ifdef SK_DEBUG |
| 100 GrGLenum status; | 99 GrGLenum status; |
| 101 GR_GL_CALL_RET(interface, status, CheckFramebufferStatus(GR_GL_FRAME
BUFFER)); | 100 GR_GL_CALL_RET(interface, status, CheckFramebufferStatus(GR_GL_FRAMEBUFF
ER)); |
| 102 SkASSERT(GR_GL_FRAMEBUFFER_COMPLETE == status); | 101 SkASSERT(GR_GL_FRAMEBUFFER_COMPLETE == status); |
| 103 #endif | 102 #endif |
| 104 } | |
| 105 return true; | 103 return true; |
| 106 } else { | 104 } else { |
| 107 const GrGLStencilAttachment* glStencil = static_cast<const GrGLStencilAt
tachment*>(stencil); | 105 const GrGLStencilAttachment* glStencil = static_cast<const GrGLStencilAt
tachment*>(stencil); |
| 108 GrGLuint rb = glStencil->renderbufferID(); | 106 GrGLuint rb = glStencil->renderbufferID(); |
| 109 | 107 |
| 110 gpu->invalidateBoundRenderTarget(); | 108 gpu->invalidateBoundRenderTarget(); |
| 111 gpu->stats()->incRenderTargetBinds(); | 109 gpu->stats()->incRenderTargetBinds(); |
| 112 GR_GL_CALL(interface, BindFramebuffer(GR_GL_FRAMEBUFFER, this->renderFBO
ID())); | 110 GR_GL_CALL(interface, BindFramebuffer(GR_GL_FRAMEBUFFER, this->renderFBO
ID())); |
| 113 GR_GL_CALL(interface, FramebufferRenderbuffer(GR_GL_FRAMEBUFFER, | 111 GR_GL_CALL(interface, FramebufferRenderbuffer(GR_GL_FRAMEBUFFER, |
| 114 GR_GL_STENCIL_ATTACHMENT, | 112 GR_GL_STENCIL_ATTACHMENT, |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 fTexFBOID = 0; | 153 fTexFBOID = 0; |
| 156 fMSColorRenderbufferID = 0; | 154 fMSColorRenderbufferID = 0; |
| 157 INHERITED::onAbandon(); | 155 INHERITED::onAbandon(); |
| 158 } | 156 } |
| 159 | 157 |
| 160 GrGLGpu* GrGLRenderTarget::getGLGpu() const { | 158 GrGLGpu* GrGLRenderTarget::getGLGpu() const { |
| 161 SkASSERT(!this->wasDestroyed()); | 159 SkASSERT(!this->wasDestroyed()); |
| 162 return static_cast<GrGLGpu*>(this->getGpu()); | 160 return static_cast<GrGLGpu*>(this->getGpu()); |
| 163 } | 161 } |
| 164 | 162 |
| OLD | NEW |