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
17
18namespace impeller {
19
20class TextureVK final : public Texture, public BackendCast<TextureVK, Texture> {
21 public:
22 TextureVK(std::weak_ptr<Context> context,
23 std::shared_ptr<TextureSourceVK> source);
24
25 // |Texture|
26 ~TextureVK() override;
27
28 vk::Image GetImage() const;
29
30 vk::ImageView GetImageView() const;
31
32 vk::ImageView GetRenderTargetView() const;
33
34 bool SetLayout(const BarrierVK& barrier) const;
35
36 vk::ImageLayout SetLayoutWithoutEncoding(vk::ImageLayout layout) const;
37
38 vk::ImageLayout GetLayout() const;
39
40 std::shared_ptr<const TextureSourceVK> GetTextureSource() const;
41
42 // |Texture|
43 ISize GetSize() const override;
44
45 void SetMipMapGenerated();
46
47 bool IsSwapchainImage() const;
48
49 std::shared_ptr<SamplerVK> GetImmutableSamplerVariant(
50 const SamplerVK& sampler) const;
51
52 /// Store the last framebuffer and render pass object used with this texture.
53 ///
54 /// This method is only called if this texture is used as the resolve texture
55 /// of a render pass. By construction, this framebuffer should be compatible
56 /// with any future render passes.
58 SampleCount sample_count);
59
60 /// Retrieve the last framebuffer and render pass object used with this
61 /// texture.
62 ///
63 /// An empty FramebufferAndRenderPass is returned if there is no cached data
64 /// for a particular sample count.
66 SampleCount sample_count) const;
67
68 private:
69 std::weak_ptr<Context> context_;
70 std::shared_ptr<TextureSourceVK> source_;
71 bool has_validation_layers_ = false;
72
73 // |Texture|
74 void SetLabel(std::string_view label) override;
75
76 // |Texture|
77 void SetLabel(std::string_view label, std::string_view trailing) override;
78
79 // |Texture|
80 bool OnSetContents(const uint8_t* contents,
81 size_t length,
82 size_t slice) override;
83
84 // |Texture|
85 bool OnSetContents(std::shared_ptr<const fml::Mapping> mapping,
86 size_t slice) override;
87
88 // |Texture|
89 bool IsValid() const override;
90
91 TextureVK(const TextureVK&) = delete;
92
93 TextureVK& operator=(const TextureVK&) = delete;
94};
95
96} // namespace impeller
97
98#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
const FramebufferAndRenderPass & GetCachedFrameData(SampleCount sample_count) const
vk::ImageLayout SetLayoutWithoutEncoding(vk::ImageLayout layout) const
std::shared_ptr< SamplerVK > GetImmutableSamplerVariant(const SamplerVK &sampler) const
ISize GetSize() const override
bool SetLayout(const BarrierVK &barrier) const
vk::ImageLayout GetLayout() const
~TextureVK() override
vk::Image GetImage() const
void SetCachedFrameData(const FramebufferAndRenderPass &data, SampleCount sample_count)
size_t length
Defines an operations and memory access barrier on a resource.
Definition barrier_vk.h:27
std::shared_ptr< const fml::Mapping > data