Flutter Engine
The Flutter Engine
GrGLTextureRenderTarget.cpp
Go to the documentation of this file.
1/*
2 * Copyright 2015 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
9
15
17 skgpu::Budgeted budgeted,
18 int sampleCount,
19 const GrGLTexture::Desc& texDesc,
20 const GrGLRenderTarget::IDs& rtIDs,
21 GrMipmapStatus mipmapStatus,
22 std::string_view label)
23 : GrSurface(gpu, texDesc.fSize, texDesc.fIsProtected, label)
24 , GrGLTexture(gpu, texDesc, nullptr, mipmapStatus, label)
25 , GrGLRenderTarget(gpu, texDesc.fSize, texDesc.fFormat, sampleCount, rtIDs,
26 texDesc.fIsProtected, label) {
27 this->registerWithCache(budgeted);
28}
29
31 int sampleCount,
32 const GrGLTexture::Desc& texDesc,
34 const GrGLRenderTarget::IDs& rtIDs,
35 GrWrapCacheable cacheable,
36 GrMipmapStatus mipmapStatus,
37 std::string_view label)
38 : GrSurface(gpu, texDesc.fSize, texDesc.fIsProtected, label)
39 , GrGLTexture(gpu, texDesc, std::move(parameters), mipmapStatus, label)
40 , GrGLRenderTarget(gpu, texDesc.fSize, texDesc.fFormat, sampleCount, rtIDs,
41 texDesc.fIsProtected, label) {
42 this->registerWithCacheWrapped(cacheable);
43}
44
46 SkTraceMemoryDump* traceMemoryDump) const {
47#ifndef SK_BUILD_FOR_ANDROID_FRAMEWORK
48 // Delegate to the base classes
50 GrGLTexture::dumpMemoryStatistics(traceMemoryDump);
51#else
52 SkString resourceName = this->getResourceName();
53 resourceName.append("/texture_renderbuffer");
54 this->dumpMemoryStatisticsPriv(traceMemoryDump, resourceName, "RenderTarget",
55 this->gpuMemorySize());
56#endif
57}
58
59bool GrGLTextureRenderTarget::canAttemptStencilAttachment(bool useMultisampleFBO) const {
60 // This cap should have been handled at a higher level.
61 SkASSERT(!this->getGpu()->getContext()->priv().caps()->avoidStencilBuffers());
62 // The RT FBO of GrGLTextureRenderTarget is never created from a wrapped FBO.
63 return true;
64}
65
67 GrGLGpu* gpu,
68 int sampleCount,
69 const GrGLTexture::Desc& texDesc,
71 const GrGLRenderTarget::IDs& rtIDs,
72 GrWrapCacheable cacheable,
73 GrMipmapStatus mipmapStatus,
74 std::string_view label) {
77 sampleCount,
78 texDesc,
79 std::move(parameters),
80 rtIDs,
81 cacheable,
83 label));
84}
85
86size_t GrGLTextureRenderTarget::onGpuMemorySize() const {
87 return GrSurface::ComputeSize(this->backendFormat(), this->dimensions(),
88 this->totalMemorySamplesPerPixel(), this->mipmapped());
89}
90
91void GrGLTextureRenderTarget::onSetLabel() {
93}
GrWrapCacheable
Definition: GrTypesPriv.h:85
GrMipmapStatus
Definition: GrTypesPriv.h:523
#define SkASSERT(cond)
Definition: SkAssert.h:116
int totalMemorySamplesPerPixel() const
void dumpMemoryStatistics(SkTraceMemoryDump *traceMemoryDump) const override
static sk_sp< GrGLTextureRenderTarget > MakeWrapped(GrGLGpu *gpu, int sampleCount, const GrGLTexture::Desc &, sk_sp< GrGLTextureParameters >, const GrGLRenderTarget::IDs &, GrWrapCacheable, GrMipmapStatus, std::string_view label)
void dumpMemoryStatistics(SkTraceMemoryDump *traceMemoryDump) const override
GrGLTextureRenderTarget(GrGLGpu *gpu, skgpu::Budgeted budgeted, int sampleCount, const GrGLTexture::Desc &texDesc, const GrGLRenderTarget::IDs &, GrMipmapStatus, std::string_view label)
bool canAttemptStencilAttachment(bool useMultisampleFBO) const override
GrBackendFormat backendFormat() const override
GrGLTextureParameters * parameters()
Definition: GrGLTexture.h:44
void onSetLabel() override
void dumpMemoryStatistics(SkTraceMemoryDump *traceMemoryDump) const override
size_t gpuMemorySize() const
GrGpu * getGpu() const
void dumpMemoryStatisticsPriv(SkTraceMemoryDump *traceMemoryDump, const SkString &resourceName, const char *type, size_t size) const
const GrDirectContext * getContext() const
SkString getResourceName() const
void registerWithCacheWrapped(GrWrapCacheable)
void registerWithCache(skgpu::Budgeted)
SkISize dimensions() const
Definition: GrSurface.h:27
static size_t ComputeSize(const GrBackendFormat &, SkISize dimensions, int colorSamplesPerPixel, skgpu::Mipmapped, bool binSize=false)
Definition: GrSurface.cpp:21
skgpu::Mipmapped mipmapped() const
Definition: GrTexture.h:62
GrMipmapStatus mipmapStatus() const
Definition: GrTexture.h:66
void append(const char text[])
Definition: SkString.h:203
FlPixelBufferTexturePrivate * priv
Budgeted
Definition: GpuTypes.h:35
Definition: ref_ptr.h:256