| 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 "GrGLGpu.h" | 10 #include "GrGLGpu.h" |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 fMSColorRenderbufferID = 0; | 152 fMSColorRenderbufferID = 0; |
| 153 INHERITED::onAbandon(); | 153 INHERITED::onAbandon(); |
| 154 } | 154 } |
| 155 | 155 |
| 156 GrGLGpu* GrGLRenderTarget::getGLGpu() const { | 156 GrGLGpu* GrGLRenderTarget::getGLGpu() const { |
| 157 SkASSERT(!this->wasDestroyed()); | 157 SkASSERT(!this->wasDestroyed()); |
| 158 return static_cast<GrGLGpu*>(this->getGpu()); | 158 return static_cast<GrGLGpu*>(this->getGpu()); |
| 159 } | 159 } |
| 160 | 160 |
| 161 bool GrGLRenderTarget::canAttemptStencilAttachment() const { | 161 bool GrGLRenderTarget::canAttemptStencilAttachment() const { |
| 162 // When we have not created the FBO ID we do not attempt to modify its attac
hments. | 162 // Only modify the FBO's attachments if we have created the FBO. Public APIs
do not currently |
| 163 // Direct GrGLRenderTarget instances are always created with CreateWrapped. | 163 // allow for borrowed FBO ownership, so we can safely assume that if an obje
ct is owned, |
| 164 SkASSERT(this->resourcePriv().refsWrappedObjects()); | 164 // Skia created it. |
| 165 return false; | 165 return this->fRTFBOOwnership == GrBackendObjectOwnership::kOwned; |
| 166 } | 166 } |
| 167 | 167 |
| 168 void GrGLRenderTarget::dumpMemoryStatistics(SkTraceMemoryDump* traceMemoryDump)
const { | 168 void GrGLRenderTarget::dumpMemoryStatistics(SkTraceMemoryDump* traceMemoryDump)
const { |
| 169 // Don't log the backing texture's contribution to the memory size. This wil
l be handled by the | 169 // Don't log the backing texture's contribution to the memory size. This wil
l be handled by the |
| 170 // texture object. | 170 // texture object. |
| 171 | 171 |
| 172 // Log any renderbuffer's contribution to memory. We only do this if we own
the renderbuffer | 172 // Log any renderbuffer's contribution to memory. We only do this if we own
the renderbuffer |
| 173 // (have a fMSColorRenderbufferID). | 173 // (have a fMSColorRenderbufferID). |
| 174 if (fMSColorRenderbufferID) { | 174 if (fMSColorRenderbufferID) { |
| 175 size_t size = this->msaaSamples() * this->totalBytesPerSample(); | 175 size_t size = this->msaaSamples() * this->totalBytesPerSample(); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 int GrGLRenderTarget::totalSamples() const { | 217 int GrGLRenderTarget::totalSamples() const { |
| 218 int total_samples = this->msaaSamples(); | 218 int total_samples = this->msaaSamples(); |
| 219 | 219 |
| 220 if (fTexFBOID != kUnresolvableFBOID) { | 220 if (fTexFBOID != kUnresolvableFBOID) { |
| 221 // If we own the resolve buffer then that is one more sample per pixel. | 221 // If we own the resolve buffer then that is one more sample per pixel. |
| 222 total_samples += 1; | 222 total_samples += 1; |
| 223 } | 223 } |
| 224 | 224 |
| 225 return total_samples; | 225 return total_samples; |
| 226 } | 226 } |
| OLD | NEW |