Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
GrGLTexture.h
Go to the documentation of this file.
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
8
9#ifndef GrGLTexture_DEFINED
10#define GrGLTexture_DEFINED
11
17
18class GrGLGpu;
19
20class GrGLTexture : public GrTexture {
21public:
30
31 static GrTextureType TextureTypeFromTarget(GrGLenum textureTarget);
32
33 GrGLTexture(GrGLGpu*, skgpu::Budgeted, const Desc&, GrMipmapStatus, std::string_view label);
34
35 ~GrGLTexture() override {}
36
37 GrBackendTexture getBackendTexture() const override;
38
39 GrBackendFormat backendFormat() const override;
40
41 // TODO: Remove once clients are no longer calling this.
42 void textureParamsModified() override { fParameters->invalidate(); }
43
44 GrGLTextureParameters* parameters() { return fParameters.get(); }
45
46 GrGLuint textureID() const { return fID; }
47
48 GrGLenum target() const;
49
50 GrGLFormat format() const { return fFormat; }
51
52 bool hasBaseLevelBeenBoundToFBO() const { return fBaseLevelHasBeenBoundToFBO; }
53 void baseLevelWasBoundToFBO() { fBaseLevelHasBeenBoundToFBO = true; }
54
57 const Desc&,
60 std::string_view label);
61
62 void dumpMemoryStatistics(SkTraceMemoryDump* traceMemoryDump) const override;
63
64protected:
65 // Constructor for subclasses.
67 const Desc&,
70 std::string_view label);
71
72 // Constructor for instances wrapping backend objects.
74 const Desc&,
79 std::string_view label);
80
81 void init(const Desc&);
82
83 void onAbandon() override;
84 void onRelease() override;
85
87
88 void onSetLabel() override;
89
90private:
92 GrGLuint fID;
93 GrGLFormat fFormat;
94 GrBackendObjectOwnership fTextureIDOwnership;
95 bool fBaseLevelHasBeenBoundToFBO = false;
96
97 using INHERITED = GrTexture;
98};
99
100#endif
GrGLFormat
Definition GrGLTypes.h:59
unsigned int GrGLuint
Definition GrGLTypes.h:113
unsigned int GrGLenum
Definition GrGLTypes.h:102
GrWrapCacheable
Definition GrTypesPriv.h:84
GrIOType
GrMipmapStatus
GrTextureType
GrBackendObjectOwnership
GrBackendFormat backendFormat() const override
void textureParamsModified() override
Definition GrGLTexture.h:42
void init(const Desc &)
GrGLenum target() const
~GrGLTexture() override
Definition GrGLTexture.h:35
GrGLuint textureID() const
Definition GrGLTexture.h:46
GrGLTextureParameters * parameters()
Definition GrGLTexture.h:44
void onRelease() override
void onSetLabel() override
bool hasBaseLevelBeenBoundToFBO() const
Definition GrGLTexture.h:52
void dumpMemoryStatistics(SkTraceMemoryDump *traceMemoryDump) const override
GrBackendTexture getBackendTexture() const override
static GrTextureType TextureTypeFromTarget(GrGLenum textureTarget)
void onAbandon() override
GrGLFormat format() const
Definition GrGLTexture.h:50
static sk_sp< GrGLTexture > MakeWrapped(GrGLGpu *, GrMipmapStatus, const Desc &, sk_sp< GrGLTextureParameters >, GrWrapCacheable, GrIOType, std::string_view label)
bool onStealBackendTexture(GrBackendTexture *, SkImages::BackendTextureReleaseProc *) override
void baseLevelWasBoundToFBO()
Definition GrGLTexture.h:53
T * get() const
Definition SkRefCnt.h:303
std::function< void(GrBackendTexture)> BackendTextureReleaseProc
Budgeted
Definition GpuTypes.h:35
Protected
Definition GpuTypes.h:61
skgpu::Protected fIsProtected
Definition GrGLTexture.h:28
GrBackendObjectOwnership fOwnership
Definition GrGLTexture.h:27
GrGLFormat fFormat
Definition GrGLTexture.h:26