Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
texture_gles.h
Go to the documentation of this file.
1// Copyright 2013 The Flutter Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef FLUTTER_IMPELLER_RENDERER_BACKEND_GLES_TEXTURE_GLES_H_
6#define FLUTTER_IMPELLER_RENDERER_BACKEND_GLES_TEXTURE_GLES_H_
7
12
13namespace impeller {
14
15class TextureGLES final : public Texture,
16 public BackendCast<TextureGLES, Texture> {
17 public:
24
25 enum class IsWrapped {
27 };
28
30
34
35 static std::shared_ptr<TextureGLES> WrapFBO(ReactorGLES::Ref reactor,
37 GLuint fbo);
38
39 // |Texture|
40 ~TextureGLES() override;
41
42 std::optional<GLuint> GetGLHandle() const;
43
44 [[nodiscard]] bool Bind() const;
45
46 [[nodiscard]] bool GenerateMipmap();
47
48 enum class AttachmentType {
49 kColor0,
50 kDepth,
52 };
53 [[nodiscard]] bool SetAsFramebufferAttachment(
54 GLenum target,
55 AttachmentType attachment_type) const;
56
57 Type GetType() const;
58
59 bool IsWrapped() const { return is_wrapped_; }
60
61 std::optional<GLuint> GetFBO() const { return wrapped_fbo_; }
62
63 private:
64 friend class AllocatorMTL;
65
66 ReactorGLES::Ref reactor_;
67 const Type type_;
69 mutable bool contents_initialized_ = false;
70 const bool is_wrapped_;
71 const std::optional<GLuint> wrapped_fbo_;
72 bool is_valid_ = false;
73
74 TextureGLES(std::shared_ptr<ReactorGLES> reactor,
76 bool is_wrapped,
77 std::optional<GLuint> fbo);
78
79 // |Texture|
80 void SetLabel(std::string_view label) override;
81
82 // |Texture|
83 bool OnSetContents(const uint8_t* contents,
84 size_t length,
85 size_t slice) override;
86
87 // |Texture|
88 bool OnSetContents(std::shared_ptr<const fml::Mapping> mapping,
89 size_t slice) override;
90
91 // |Texture|
92 bool IsValid() const override;
93
94 // |Texture|
95 ISize GetSize() const override;
96
97 // |Texture|
98 Scalar GetYCoordScale() const override;
99
100 void InitializeContentsIfNecessary() const;
101
102 TextureGLES(const TextureGLES&) = delete;
103
104 TextureGLES& operator=(const TextureGLES&) = delete;
105};
106
107} // namespace impeller
108
109#endif // FLUTTER_IMPELLER_RENDERER_BACKEND_GLES_TEXTURE_GLES_H_
static sk_sp< GrTextureProxy > wrapped(skiatest::Reporter *reporter, GrRecordingContext *rContext, GrProxyProvider *proxyProvider, SkBackingFit fit)
std::shared_ptr< ReactorGLES > Ref
bool IsValid() const override
void SetLabel(std::string_view label) override
bool SetAsFramebufferAttachment(GLenum target, AttachmentType attachment_type) const
std::optional< GLuint > GetFBO() const
static std::shared_ptr< TextureGLES > WrapFBO(ReactorGLES::Ref reactor, TextureDescriptor desc, GLuint fbo)
std::optional< GLuint > GetGLHandle() const
bool OnSetContents(const uint8_t *contents, size_t length, size_t slice) override
bool IsWrapped() const
ISize GetSize() const override
Scalar GetYCoordScale() const override
uint32_t * target
size_t length
float Scalar
Definition scalar.h:18
fuchsia::ui::composition::ParentViewportWatcherHandle handle_
A lightweight object that describes the attributes of a texture that can then used an allocator to cr...