Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
texture_vk.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_VULKAN_TEXTURE_VK_H_
6#define FLUTTER_IMPELLER_RENDERER_BACKEND_VULKAN_TEXTURE_VK_H_
7
16
17namespace impeller {
18
19class TextureVK final : public Texture, public BackendCast<TextureVK, Texture> {
20 public:
21 TextureVK(std::weak_ptr<Context> context,
22 std::shared_ptr<TextureSourceVK> source);
23
24 // |Texture|
25 ~TextureVK() override;
26
27 vk::Image GetImage() const;
28
29 vk::ImageView GetImageView() const;
30
31 vk::ImageView GetRenderTargetView() const;
32
33 bool SetLayout(const BarrierVK& barrier) const;
34
35 vk::ImageLayout SetLayoutWithoutEncoding(vk::ImageLayout layout) const;
36
37 vk::ImageLayout GetLayout() const;
38
39 std::shared_ptr<const TextureSourceVK> GetTextureSource() const;
40
41 // |Texture|
42 ISize GetSize() const override;
43
44 void SetMipMapGenerated();
45
46 bool IsSwapchainImage() const;
47
48 std::shared_ptr<SamplerVK> GetImmutableSamplerVariant(
49 const SamplerVK& sampler) const;
50
51 // These methods should only be used by render_pass_vk.h
52
53 /// Store the last framebuffer object used with this texture.
54 ///
55 /// This field is only set if this texture is used as the resolve texture
56 /// of a render pass. By construction, this framebuffer should be compatible
57 /// with any future render passes.
59
60 /// Store the last render pass object used with this texture.
61 ///
62 /// This field is only set if this texture is used as the resolve texture
63 /// of a render pass. By construction, this framebuffer should be compatible
64 /// with any future render passes.
66
67 /// Retrieve the last framebuffer object used with this texture.
68 ///
69 /// May be nullptr if no previous framebuffer existed.
71
72 /// Retrieve the last render pass object used with this texture.
73 ///
74 /// May be nullptr if no previous render pass existed.
76
77 private:
78 std::weak_ptr<Context> context_;
79 std::shared_ptr<TextureSourceVK> source_;
80
81 // |Texture|
82 void SetLabel(std::string_view label) override;
83
84 // |Texture|
85 bool OnSetContents(const uint8_t* contents,
86 size_t length,
87 size_t slice) override;
88
89 // |Texture|
90 bool OnSetContents(std::shared_ptr<const fml::Mapping> mapping,
91 size_t slice) override;
92
93 // |Texture|
94 bool IsValid() const override;
95
96 TextureVK(const TextureVK&) = delete;
97
98 TextureVK& operator=(const TextureVK&) = delete;
99};
100
101} // namespace impeller
102
103#endif // FLUTTER_IMPELLER_RENDERER_BACKEND_VULKAN_TEXTURE_VK_H_
vk::ImageView GetImageView() const
std::shared_ptr< const TextureSourceVK > GetTextureSource() const
bool IsSwapchainImage() const
vk::ImageView GetRenderTargetView() const
void SetCachedFramebuffer(const SharedHandleVK< vk::Framebuffer > &framebuffer)
bool IsValid() const override
SharedHandleVK< vk::RenderPass > GetCachedRenderPass() const
vk::ImageLayout SetLayoutWithoutEncoding(vk::ImageLayout layout) const
std::shared_ptr< SamplerVK > GetImmutableSamplerVariant(const SamplerVK &sampler) const
ISize GetSize() const override
void SetLabel(std::string_view label) override
Definition texture_vk.cc:22
SharedHandleVK< vk::Framebuffer > GetCachedFramebuffer() const
bool SetLayout(const BarrierVK &barrier) const
bool OnSetContents(const uint8_t *contents, size_t length, size_t slice) override
Definition texture_vk.cc:32
vk::ImageLayout GetLayout() const
void SetCachedRenderPass(const SharedHandleVK< vk::RenderPass > &render_pass)
~TextureVK() override
vk::Image GetImage() const
SkBitmap source
Definition examples.cpp:28
size_t length
std::shared_ptr< SharedObjectVKT< T > > SharedHandleVK
Defines an operations and memory access barrier on a resource.
Definition barrier_vk.h:28