Flutter Engine Uber Docs
Docs for the entire Flutter Engine repo.
 
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(uint32_t mip_level = 0,
33 uint32_t array_layer = 0) const;
34
35 bool SetLayout(const BarrierVK& barrier) const;
36
37 vk::ImageLayout SetLayoutWithoutEncoding(vk::ImageLayout layout) const;
38
39 vk::ImageLayout GetLayout() const;
40
41 std::shared_ptr<const TextureSourceVK> GetTextureSource() const;
42
43 // |Texture|
44 ISize GetSize() const override;
45
46 void SetMipMapGenerated();
47
48 bool IsSwapchainImage() const;
49
50 std::shared_ptr<SamplerVK> GetImmutableSamplerVariant(
51 const SamplerVK& sampler) const;
52
53 /// Store the framebuffer and render pass last used to render into the
54 /// `(sample_count, mip_level, slice)` subresource of this texture.
55 ///
56 /// Only called when this texture is being used as the resolve (or
57 /// non-MSAA color) target of a render pass.
59 SampleCount sample_count,
60 uint32_t mip_level = 0u,
61 uint32_t slice = 0u);
62
63 /// Retrieve the cached framebuffer and render pass for the given
64 /// `(sample_count, mip_level, slice)` subresource. Returns an empty
65 /// `FramebufferAndRenderPass` if no entry exists.
67 uint32_t mip_level = 0u,
68 uint32_t slice = 0u) const;
69
70 private:
71 std::weak_ptr<Context> context_;
72 std::shared_ptr<TextureSourceVK> source_;
73 bool has_validation_layers_ = false;
74
75 // |Texture|
76 void SetLabel(std::string_view label) override;
77
78 // |Texture|
79 void SetLabel(std::string_view label, std::string_view trailing) override;
80
81 // |Texture|
82 bool OnSetContents(const uint8_t* contents,
83 size_t length,
84 size_t slice) override;
85
86 // |Texture|
87 bool OnSetContents(std::shared_ptr<const fml::Mapping> mapping,
88 size_t slice) override;
89
90 // |Texture|
91 bool IsValid() const override;
92
93 TextureVK(const TextureVK&) = delete;
94
95 TextureVK& operator=(const TextureVK&) = delete;
96};
97
98} // namespace impeller
99
100#endif // FLUTTER_IMPELLER_RENDERER_BACKEND_VULKAN_TEXTURE_VK_H_
vk::ImageView GetImageView() const
std::shared_ptr< const TextureSourceVK > GetTextureSource() const
bool IsSwapchainImage() const
vk::ImageLayout SetLayoutWithoutEncoding(vk::ImageLayout layout) const
std::shared_ptr< SamplerVK > GetImmutableSamplerVariant(const SamplerVK &sampler) const
vk::ImageView GetRenderTargetView(uint32_t mip_level=0, uint32_t array_layer=0) const
ISize GetSize() const override
FramebufferAndRenderPass GetCachedFrameData(SampleCount sample_count, uint32_t mip_level=0u, uint32_t slice=0u) const
bool SetLayout(const BarrierVK &barrier) const
void SetCachedFrameData(const FramebufferAndRenderPass &data, SampleCount sample_count, uint32_t mip_level=0u, uint32_t slice=0u)
vk::ImageLayout GetLayout() const
~TextureVK() override
vk::Image GetImage() const
size_t length
std::shared_ptr< ContextGLES > context
Defines an operations and memory access barrier on a resource.
Definition barrier_vk.h:27