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 // Only modify the FBO's attachments if we have created the FBO. | 162 // When we have not created the FBO ID we do not attempt to modify its attac
hments. |
163 return this->fRTFBOOwnership == GrBackendObjectOwnership::kOwned; | 163 // Direct GrGLRenderTarget instances are always created with CreateWrapped. |
| 164 SkASSERT(this->resourcePriv().refsWrappedObjects()); |
| 165 return false; |
164 } | 166 } |
165 | 167 |
166 void GrGLRenderTarget::dumpMemoryStatistics(SkTraceMemoryDump* traceMemoryDump)
const { | 168 void GrGLRenderTarget::dumpMemoryStatistics(SkTraceMemoryDump* traceMemoryDump)
const { |
167 // 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 |
168 // texture object. | 170 // texture object. |
169 | 171 |
170 // 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 |
171 // (have a fMSColorRenderbufferID). | 173 // (have a fMSColorRenderbufferID). |
172 if (fMSColorRenderbufferID) { | 174 if (fMSColorRenderbufferID) { |
173 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... |
215 int GrGLRenderTarget::totalSamples() const { | 217 int GrGLRenderTarget::totalSamples() const { |
216 int total_samples = this->msaaSamples(); | 218 int total_samples = this->msaaSamples(); |
217 | 219 |
218 if (fTexFBOID != kUnresolvableFBOID) { | 220 if (fTexFBOID != kUnresolvableFBOID) { |
219 // 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. |
220 total_samples += 1; | 222 total_samples += 1; |
221 } | 223 } |
222 | 224 |
223 return total_samples; | 225 return total_samples; |
224 } | 226 } |
OLD | NEW |