bsalomon@google.com | aa5b673 | 2011-07-29 15:13:20 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2011 Google Inc. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license that can be |
| 5 | * found in the LICENSE file. |
| 6 | */ |
| 7 | |
bsalomon@google.com | aa5b673 | 2011-07-29 15:13:20 +0000 | [diff] [blame] | 8 | #include "GrGLRenderTarget.h" |
Eric Karl | 5c77975 | 2017-05-08 12:02:07 -0700 | [diff] [blame] | 9 | #include "GrContext.h" |
Brian Salomon | c7fe0f7 | 2018-05-11 10:14:21 -0400 | [diff] [blame] | 10 | #include "GrContextPriv.h" |
jvanverth | 39edf76 | 2014-12-22 11:44:19 -0800 | [diff] [blame] | 11 | #include "GrGLGpu.h" |
egdaniel | ec00d94 | 2015-09-14 12:56:10 -0700 | [diff] [blame] | 12 | #include "GrGLUtil.h" |
kkinnunen | 2e6055b | 2016-04-22 01:48:29 -0700 | [diff] [blame] | 13 | #include "GrGpuResourcePriv.h" |
| 14 | #include "GrRenderTargetPriv.h" |
ericrk | 0a5fa48 | 2015-09-15 14:16:10 -0700 | [diff] [blame] | 15 | #include "SkTraceMemoryDump.h" |
bsalomon@google.com | aa5b673 | 2011-07-29 15:13:20 +0000 | [diff] [blame] | 16 | |
egdaniel | d803f27 | 2015-03-18 13:01:52 -0700 | [diff] [blame] | 17 | #define GPUGL static_cast<GrGLGpu*>(this->getGpu()) |
| 18 | #define GL_CALL(X) GR_GL_CALL(GPUGL->glInterface(), X) |
bsalomon@google.com | 0b77d68 | 2011-08-19 13:28:54 +0000 | [diff] [blame] | 19 | |
bsalomon | 37dd331 | 2014-11-03 08:47:23 -0800 | [diff] [blame] | 20 | // Because this class is virtually derived from GrSurface we must explicitly call its constructor. |
kkinnunen | 2e6055b | 2016-04-22 01:48:29 -0700 | [diff] [blame] | 21 | // Constructor for wrapped render targets. |
egdaniel | ec00d94 | 2015-09-14 12:56:10 -0700 | [diff] [blame] | 22 | GrGLRenderTarget::GrGLRenderTarget(GrGLGpu* gpu, |
| 23 | const GrSurfaceDesc& desc, |
| 24 | const IDDesc& idDesc, |
| 25 | GrGLStencilAttachment* stencil) |
kkinnunen | 2e6055b | 2016-04-22 01:48:29 -0700 | [diff] [blame] | 26 | : GrSurface(gpu, desc) |
Robert Phillips | fe0253f | 2018-03-16 16:47:25 -0400 | [diff] [blame] | 27 | , INHERITED(gpu, desc, stencil) { |
| 28 | this->setFlags(gpu->glCaps(), idDesc); |
bsalomon | 37dd331 | 2014-11-03 08:47:23 -0800 | [diff] [blame] | 29 | this->init(desc, idDesc); |
kkinnunen | 2e6055b | 2016-04-22 01:48:29 -0700 | [diff] [blame] | 30 | this->registerWithCacheWrapped(); |
bsalomon@google.com | aa5b673 | 2011-07-29 15:13:20 +0000 | [diff] [blame] | 31 | } |
| 32 | |
kkinnunen | 2e6055b | 2016-04-22 01:48:29 -0700 | [diff] [blame] | 33 | GrGLRenderTarget::GrGLRenderTarget(GrGLGpu* gpu, const GrSurfaceDesc& desc, |
| 34 | const IDDesc& idDesc) |
| 35 | : GrSurface(gpu, desc) |
Robert Phillips | fe0253f | 2018-03-16 16:47:25 -0400 | [diff] [blame] | 36 | , INHERITED(gpu, desc) { |
| 37 | this->setFlags(gpu->glCaps(), idDesc); |
bsalomon | 37dd331 | 2014-11-03 08:47:23 -0800 | [diff] [blame] | 38 | this->init(desc, idDesc); |
bsalomon@google.com | 5bfc217 | 2011-07-29 20:29:05 +0000 | [diff] [blame] | 39 | } |
| 40 | |
Robert Phillips | fe0253f | 2018-03-16 16:47:25 -0400 | [diff] [blame] | 41 | inline void GrGLRenderTarget::setFlags(const GrGLCaps& glCaps, const IDDesc& idDesc) { |
csmartdalton | f963599 | 2016-08-10 11:09:07 -0700 | [diff] [blame] | 42 | if (idDesc.fIsMixedSampled) { |
| 43 | SkASSERT(glCaps.usesMixedSamples() && idDesc.fRTFBOID); // FBO 0 can't be mixed sampled. |
Robert Phillips | fe0253f | 2018-03-16 16:47:25 -0400 | [diff] [blame] | 44 | this->setHasMixedSamples(); |
csmartdalton | f963599 | 2016-08-10 11:09:07 -0700 | [diff] [blame] | 45 | } |
Jim Van Verth | 6a40abc | 2017-11-02 16:56:09 +0000 | [diff] [blame] | 46 | if (glCaps.maxWindowRectangles() > 0 && idDesc.fRTFBOID) { |
Robert Phillips | fe0253f | 2018-03-16 16:47:25 -0400 | [diff] [blame] | 47 | this->setSupportsWindowRects(); |
csmartdalton | f963599 | 2016-08-10 11:09:07 -0700 | [diff] [blame] | 48 | } |
Greg Daniel | a070ed7 | 2018-04-26 16:31:38 -0400 | [diff] [blame] | 49 | if (!idDesc.fRTFBOID) { |
| 50 | this->setGLRTFBOIDIs0(); |
| 51 | } |
csmartdalton | f963599 | 2016-08-10 11:09:07 -0700 | [diff] [blame] | 52 | } |
| 53 | |
bsalomon | 37dd331 | 2014-11-03 08:47:23 -0800 | [diff] [blame] | 54 | void GrGLRenderTarget::init(const GrSurfaceDesc& desc, const IDDesc& idDesc) { |
cdalton | d472792 | 2015-11-10 12:49:06 -0800 | [diff] [blame] | 55 | fRTFBOID = idDesc.fRTFBOID; |
| 56 | fTexFBOID = idDesc.fTexFBOID; |
| 57 | fMSColorRenderbufferID = idDesc.fMSColorRenderbufferID; |
kkinnunen | 2e6055b | 2016-04-22 01:48:29 -0700 | [diff] [blame] | 58 | fRTFBOOwnership = idDesc.fRTFBOOwnership; |
bsalomon | 37dd331 | 2014-11-03 08:47:23 -0800 | [diff] [blame] | 59 | |
| 60 | fViewport.fLeft = 0; |
| 61 | fViewport.fBottom = 0; |
| 62 | fViewport.fWidth = desc.fWidth; |
| 63 | fViewport.fHeight = desc.fHeight; |
| 64 | |
Robert Phillips | 29e52f1 | 2016-11-03 10:19:14 -0400 | [diff] [blame] | 65 | fNumSamplesOwnedPerPixel = this->totalSamples(); |
senorblanco | d298121 | 2015-04-30 12:06:10 -0700 | [diff] [blame] | 66 | } |
| 67 | |
bungeman | 6bd5284 | 2016-10-27 09:30:08 -0700 | [diff] [blame] | 68 | sk_sp<GrGLRenderTarget> GrGLRenderTarget::MakeWrapped(GrGLGpu* gpu, |
| 69 | const GrSurfaceDesc& desc, |
| 70 | const IDDesc& idDesc, |
| 71 | int stencilBits) { |
egdaniel | ec00d94 | 2015-09-14 12:56:10 -0700 | [diff] [blame] | 72 | GrGLStencilAttachment* sb = nullptr; |
| 73 | if (stencilBits) { |
| 74 | GrGLStencilAttachment::IDDesc sbDesc; |
| 75 | GrGLStencilAttachment::Format format; |
| 76 | format.fInternalFormat = GrGLStencilAttachment::kUnknownInternalFormat; |
| 77 | format.fPacked = false; |
| 78 | format.fStencilBits = stencilBits; |
| 79 | format.fTotalBits = stencilBits; |
Robert Phillips | cb2e235 | 2017-08-30 16:44:40 -0400 | [diff] [blame] | 80 | // Ownership of sb is passed to the GrRenderTarget so doesn't need to be deleted |
egdaniel | ec00d94 | 2015-09-14 12:56:10 -0700 | [diff] [blame] | 81 | sb = new GrGLStencilAttachment(gpu, sbDesc, desc.fWidth, desc.fHeight, |
| 82 | desc.fSampleCnt, format); |
| 83 | } |
bungeman | 6bd5284 | 2016-10-27 09:30:08 -0700 | [diff] [blame] | 84 | return sk_sp<GrGLRenderTarget>(new GrGLRenderTarget(gpu, desc, idDesc, sb)); |
egdaniel | ec00d94 | 2015-09-14 12:56:10 -0700 | [diff] [blame] | 85 | } |
| 86 | |
Greg Daniel | faa095e | 2017-12-19 13:15:02 -0500 | [diff] [blame] | 87 | GrBackendRenderTarget GrGLRenderTarget::getBackendRenderTarget() const { |
| 88 | GrGLFramebufferInfo fbi; |
| 89 | fbi.fFBOID = fRTFBOID; |
| 90 | fbi.fFormat = this->getGLGpu()->glCaps().configSizedInternalFormat(this->config()); |
Brian Salomon | 0c51eea | 2018-03-09 17:02:09 -0500 | [diff] [blame] | 91 | int numStencilBits = 0; |
| 92 | if (GrStencilAttachment* stencil = this->renderTargetPriv().getStencilAttachment()) { |
| 93 | numStencilBits = stencil->bits(); |
| 94 | } |
Greg Daniel | faa095e | 2017-12-19 13:15:02 -0500 | [diff] [blame] | 95 | |
Greg Daniel | 8a3f55c | 2018-03-14 17:32:12 +0000 | [diff] [blame] | 96 | return GrBackendRenderTarget(this->width(), this->height(), this->numColorSamples(), |
| 97 | numStencilBits, fbi); |
Greg Daniel | faa095e | 2017-12-19 13:15:02 -0500 | [diff] [blame] | 98 | } |
| 99 | |
senorblanco | d298121 | 2015-04-30 12:06:10 -0700 | [diff] [blame] | 100 | size_t GrGLRenderTarget::onGpuMemorySize() const { |
Brian Salomon | bb5711a | 2017-05-17 13:49:59 -0400 | [diff] [blame] | 101 | return GrSurface::ComputeSize(this->config(), this->width(), this->height(), |
Greg Daniel | e252f08 | 2017-10-23 16:05:23 -0400 | [diff] [blame] | 102 | fNumSamplesOwnedPerPixel, GrMipMapped::kNo); |
bsalomon@google.com | 5bfc217 | 2011-07-29 20:29:05 +0000 | [diff] [blame] | 103 | } |
| 104 | |
egdaniel | ec00d94 | 2015-09-14 12:56:10 -0700 | [diff] [blame] | 105 | bool GrGLRenderTarget::completeStencilAttachment() { |
| 106 | GrGLGpu* gpu = this->getGLGpu(); |
| 107 | const GrGLInterface* interface = gpu->glInterface(); |
| 108 | GrStencilAttachment* stencil = this->renderTargetPriv().getStencilAttachment(); |
| 109 | if (nullptr == stencil) { |
egdaniel | 79bd2ae | 2015-09-15 08:46:13 -0700 | [diff] [blame] | 110 | GR_GL_CALL(interface, FramebufferRenderbuffer(GR_GL_FRAMEBUFFER, |
| 111 | GR_GL_STENCIL_ATTACHMENT, |
| 112 | GR_GL_RENDERBUFFER, 0)); |
| 113 | GR_GL_CALL(interface, FramebufferRenderbuffer(GR_GL_FRAMEBUFFER, |
| 114 | GR_GL_DEPTH_ATTACHMENT, |
| 115 | GR_GL_RENDERBUFFER, 0)); |
egdaniel | ec00d94 | 2015-09-14 12:56:10 -0700 | [diff] [blame] | 116 | #ifdef SK_DEBUG |
robertphillips | fa7ff47 | 2016-04-21 11:27:43 -0700 | [diff] [blame] | 117 | if (kChromium_GrGLDriver != gpu->glContext().driver()) { |
| 118 | // This check can cause problems in Chromium if the context has been asynchronously |
| 119 | // abandoned (see skbug.com/5200) |
| 120 | GrGLenum status; |
| 121 | GR_GL_CALL_RET(interface, status, CheckFramebufferStatus(GR_GL_FRAMEBUFFER)); |
| 122 | SkASSERT(GR_GL_FRAMEBUFFER_COMPLETE == status); |
| 123 | } |
egdaniel | ec00d94 | 2015-09-14 12:56:10 -0700 | [diff] [blame] | 124 | #endif |
egdaniel | ec00d94 | 2015-09-14 12:56:10 -0700 | [diff] [blame] | 125 | return true; |
| 126 | } else { |
| 127 | const GrGLStencilAttachment* glStencil = static_cast<const GrGLStencilAttachment*>(stencil); |
| 128 | GrGLuint rb = glStencil->renderbufferID(); |
| 129 | |
| 130 | gpu->invalidateBoundRenderTarget(); |
| 131 | gpu->stats()->incRenderTargetBinds(); |
| 132 | GR_GL_CALL(interface, BindFramebuffer(GR_GL_FRAMEBUFFER, this->renderFBOID())); |
| 133 | GR_GL_CALL(interface, FramebufferRenderbuffer(GR_GL_FRAMEBUFFER, |
| 134 | GR_GL_STENCIL_ATTACHMENT, |
| 135 | GR_GL_RENDERBUFFER, rb)); |
| 136 | if (glStencil->format().fPacked) { |
| 137 | GR_GL_CALL(interface, FramebufferRenderbuffer(GR_GL_FRAMEBUFFER, |
| 138 | GR_GL_DEPTH_ATTACHMENT, |
| 139 | GR_GL_RENDERBUFFER, rb)); |
| 140 | } else { |
| 141 | GR_GL_CALL(interface, FramebufferRenderbuffer(GR_GL_FRAMEBUFFER, |
| 142 | GR_GL_DEPTH_ATTACHMENT, |
| 143 | GR_GL_RENDERBUFFER, 0)); |
| 144 | } |
| 145 | |
Adrienne Walker | 3ed3399 | 2018-05-15 11:44:34 -0700 | [diff] [blame^] | 146 | gpu->didBindFramebuffer(); |
| 147 | |
egdaniel | ec00d94 | 2015-09-14 12:56:10 -0700 | [diff] [blame] | 148 | #ifdef SK_DEBUG |
robertphillips | fa7ff47 | 2016-04-21 11:27:43 -0700 | [diff] [blame] | 149 | if (kChromium_GrGLDriver != gpu->glContext().driver()) { |
| 150 | // This check can cause problems in Chromium if the context has been asynchronously |
| 151 | // abandoned (see skbug.com/5200) |
| 152 | GrGLenum status; |
| 153 | GR_GL_CALL_RET(interface, status, CheckFramebufferStatus(GR_GL_FRAMEBUFFER)); |
| 154 | SkASSERT(GR_GL_FRAMEBUFFER_COMPLETE == status); |
| 155 | } |
egdaniel | ec00d94 | 2015-09-14 12:56:10 -0700 | [diff] [blame] | 156 | #endif |
| 157 | return true; |
| 158 | } |
| 159 | } |
| 160 | |
bsalomon@google.com | aa5b673 | 2011-07-29 15:13:20 +0000 | [diff] [blame] | 161 | void GrGLRenderTarget::onRelease() { |
kkinnunen | 2e6055b | 2016-04-22 01:48:29 -0700 | [diff] [blame] | 162 | if (GrBackendObjectOwnership::kBorrowed != fRTFBOOwnership) { |
egdaniel | d803f27 | 2015-03-18 13:01:52 -0700 | [diff] [blame] | 163 | if (fTexFBOID) { |
| 164 | GL_CALL(DeleteFramebuffers(1, &fTexFBOID)); |
bsalomon@google.com | aa5b673 | 2011-07-29 15:13:20 +0000 | [diff] [blame] | 165 | } |
egdaniel | d803f27 | 2015-03-18 13:01:52 -0700 | [diff] [blame] | 166 | if (fRTFBOID && fRTFBOID != fTexFBOID) { |
| 167 | GL_CALL(DeleteFramebuffers(1, &fRTFBOID)); |
bsalomon@google.com | aa5b673 | 2011-07-29 15:13:20 +0000 | [diff] [blame] | 168 | } |
bsalomon@google.com | aa5b673 | 2011-07-29 15:13:20 +0000 | [diff] [blame] | 169 | if (fMSColorRenderbufferID) { |
bsalomon@google.com | 0b77d68 | 2011-08-19 13:28:54 +0000 | [diff] [blame] | 170 | GL_CALL(DeleteRenderbuffers(1, &fMSColorRenderbufferID)); |
bsalomon@google.com | aa5b673 | 2011-07-29 15:13:20 +0000 | [diff] [blame] | 171 | } |
| 172 | } |
egdaniel | d803f27 | 2015-03-18 13:01:52 -0700 | [diff] [blame] | 173 | fRTFBOID = 0; |
| 174 | fTexFBOID = 0; |
| 175 | fMSColorRenderbufferID = 0; |
robertphillips@google.com | d6bbbf8 | 2012-09-05 15:46:34 +0000 | [diff] [blame] | 176 | INHERITED::onRelease(); |
bsalomon@google.com | aa5b673 | 2011-07-29 15:13:20 +0000 | [diff] [blame] | 177 | } |
| 178 | |
| 179 | void GrGLRenderTarget::onAbandon() { |
egdaniel | d803f27 | 2015-03-18 13:01:52 -0700 | [diff] [blame] | 180 | fRTFBOID = 0; |
| 181 | fTexFBOID = 0; |
bsalomon@google.com | aa5b673 | 2011-07-29 15:13:20 +0000 | [diff] [blame] | 182 | fMSColorRenderbufferID = 0; |
robertphillips@google.com | d6bbbf8 | 2012-09-05 15:46:34 +0000 | [diff] [blame] | 183 | INHERITED::onAbandon(); |
bsalomon@google.com | aa5b673 | 2011-07-29 15:13:20 +0000 | [diff] [blame] | 184 | } |
egdaniel | ec00d94 | 2015-09-14 12:56:10 -0700 | [diff] [blame] | 185 | |
| 186 | GrGLGpu* GrGLRenderTarget::getGLGpu() const { |
| 187 | SkASSERT(!this->wasDestroyed()); |
| 188 | return static_cast<GrGLGpu*>(this->getGpu()); |
| 189 | } |
| 190 | |
kkinnunen | 2e6055b | 2016-04-22 01:48:29 -0700 | [diff] [blame] | 191 | bool GrGLRenderTarget::canAttemptStencilAttachment() const { |
Brian Salomon | c7fe0f7 | 2018-05-11 10:14:21 -0400 | [diff] [blame] | 192 | if (this->getGpu()->getContext()->contextPriv().caps()->avoidStencilBuffers()) { |
Eric Karl | 5c77975 | 2017-05-08 12:02:07 -0700 | [diff] [blame] | 193 | return false; |
| 194 | } |
| 195 | |
ericrk | c402518 | 2016-05-04 12:01:58 -0700 | [diff] [blame] | 196 | // Only modify the FBO's attachments if we have created the FBO. Public APIs do not currently |
| 197 | // allow for borrowed FBO ownership, so we can safely assume that if an object is owned, |
| 198 | // Skia created it. |
| 199 | return this->fRTFBOOwnership == GrBackendObjectOwnership::kOwned; |
kkinnunen | 2e6055b | 2016-04-22 01:48:29 -0700 | [diff] [blame] | 200 | } |
| 201 | |
ericrk | 0a5fa48 | 2015-09-15 14:16:10 -0700 | [diff] [blame] | 202 | void GrGLRenderTarget::dumpMemoryStatistics(SkTraceMemoryDump* traceMemoryDump) const { |
Eric Karl | af77002 | 2018-03-19 13:04:03 -0700 | [diff] [blame] | 203 | // Don't check this->fRefsWrappedObjects, as we might be the base of a GrGLTextureRenderTarget |
| 204 | // which is multiply inherited from both ourselves and a texture. In these cases, one part |
| 205 | // (texture, rt) may be wrapped, while the other is owned by Skia. |
| 206 | bool refsWrappedRenderTargetObjects = |
| 207 | this->fRTFBOOwnership == GrBackendObjectOwnership::kBorrowed; |
| 208 | if (refsWrappedRenderTargetObjects && !traceMemoryDump->shouldDumpWrappedObjects()) { |
| 209 | return; |
| 210 | } |
ericrk | 0a5fa48 | 2015-09-15 14:16:10 -0700 | [diff] [blame] | 211 | |
Eric Karl | af77002 | 2018-03-19 13:04:03 -0700 | [diff] [blame] | 212 | // Don't log the framebuffer, as the framebuffer itself doesn't contribute to meaningful |
| 213 | // memory usage. It is always a wrapper around either: |
| 214 | // - a texture, which is owned elsewhere, and will be dumped there |
| 215 | // - a renderbuffer, which will be dumped below. |
| 216 | |
| 217 | // Log any renderbuffer's contribution to memory. |
ericrk | 0a5fa48 | 2015-09-15 14:16:10 -0700 | [diff] [blame] | 218 | if (fMSColorRenderbufferID) { |
Brian Salomon | bb5711a | 2017-05-17 13:49:59 -0400 | [diff] [blame] | 219 | size_t size = GrSurface::ComputeSize(this->config(), this->width(), this->height(), |
Greg Daniel | e252f08 | 2017-10-23 16:05:23 -0400 | [diff] [blame] | 220 | this->msaaSamples(), GrMipMapped::kNo); |
ericrk | 0a5fa48 | 2015-09-15 14:16:10 -0700 | [diff] [blame] | 221 | |
| 222 | // Due to this resource having both a texture and a renderbuffer component, dump as |
| 223 | // skia/gpu_resources/resource_#/renderbuffer |
Derek Sollenberger | cf6da8c | 2018-03-29 13:40:02 -0400 | [diff] [blame] | 224 | SkString resourceName = this->getResourceName(); |
| 225 | resourceName.append("/renderbuffer"); |
ericrk | 0a5fa48 | 2015-09-15 14:16:10 -0700 | [diff] [blame] | 226 | |
Derek Sollenberger | cf6da8c | 2018-03-29 13:40:02 -0400 | [diff] [blame] | 227 | this->dumpMemoryStatisticsPriv(traceMemoryDump, resourceName, "RenderTarget", size); |
ericrk | 0a5fa48 | 2015-09-15 14:16:10 -0700 | [diff] [blame] | 228 | |
| 229 | SkString renderbuffer_id; |
| 230 | renderbuffer_id.appendU32(fMSColorRenderbufferID); |
Derek Sollenberger | cf6da8c | 2018-03-29 13:40:02 -0400 | [diff] [blame] | 231 | traceMemoryDump->setMemoryBacking(resourceName.c_str(), "gl_renderbuffer", |
ericrk | 0a5fa48 | 2015-09-15 14:16:10 -0700 | [diff] [blame] | 232 | renderbuffer_id.c_str()); |
| 233 | } |
| 234 | } |
| 235 | |
ericrk | 0a5fa48 | 2015-09-15 14:16:10 -0700 | [diff] [blame] | 236 | int GrGLRenderTarget::msaaSamples() const { |
| 237 | if (fTexFBOID == kUnresolvableFBOID || fTexFBOID != fRTFBOID) { |
| 238 | // If the render target's FBO is external (fTexFBOID == kUnresolvableFBOID), or if we own |
| 239 | // the render target's FBO (fTexFBOID == fRTFBOID) then we use the provided sample count. |
Brian Salomon | bdecacf | 2018-02-02 20:32:49 -0500 | [diff] [blame] | 240 | return this->numStencilSamples(); |
ericrk | 0a5fa48 | 2015-09-15 14:16:10 -0700 | [diff] [blame] | 241 | } |
| 242 | |
| 243 | // When fTexFBOID == fRTFBOID, we either are not using MSAA, or MSAA is auto resolving, so use |
| 244 | // 0 for the sample count. |
| 245 | return 0; |
| 246 | } |
| 247 | |
| 248 | int GrGLRenderTarget::totalSamples() const { |
| 249 | int total_samples = this->msaaSamples(); |
| 250 | |
| 251 | if (fTexFBOID != kUnresolvableFBOID) { |
| 252 | // If we own the resolve buffer then that is one more sample per pixel. |
| 253 | total_samples += 1; |
| 254 | } |
| 255 | |
| 256 | return total_samples; |
| 257 | } |