| Flutter Impeller |

swapchain_transients_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_SWAPCHAIN_SWAPCHAIN_TRANSIENTS_VK_H_
6 #define FLUTTER_IMPELLER_RENDERER_BACKEND_VULKAN_SWAPCHAIN_SWAPCHAIN_TRANSIENTS_VK_H_
7
8 #include "impeller/core/texture.h"
9 #include "impeller/core/texture_descriptor.h"
10 #include "impeller/renderer/context.h"
11
12 namespace impeller {
13
14 //------------------------------------------------------------------------------
15 /// @brief Resources, meant to be memoized by the texture descriptor of the
16 /// wrapped swapchain images, that are intuitively cheap to create
17 /// but have been observed to be time consuming to construct on some
18 /// Vulkan drivers. This includes the device-transient MSAA and
19 /// depth-stencil textures.
20 ///
21 /// The same textures are used for all swapchain images.
22 ///
23 class SwapchainTransientsVK {
24 public:
25 explicit SwapchainTransientsVK(std::weak_ptr<Context> context,
26 TextureDescriptor desc,
27 bool enable_msaa);
28
29 ~SwapchainTransientsVK();
30
31 SwapchainTransientsVK(const SwapchainTransientsVK&) = delete;
32
33 SwapchainTransientsVK& operator=(const SwapchainTransientsVK&) = delete;
34
35 const std::weak_ptr<Context>& GetContext() const;
36
37 bool IsMSAAEnabled() const;
38
39 const std::shared_ptr<Texture>& GetMSAATexture();
40
41 const std::shared_ptr<Texture>& GetDepthStencilTexture();
42
43 private:
44 std::weak_ptr<Context> context_;
45 const TextureDescriptor desc_;
46 const bool enable_msaa_;
47 std::shared_ptr<Texture> cached_msaa_texture_;
48 std::shared_ptr<Texture> cached_depth_stencil_;
49
50 std::shared_ptr<Texture> CreateMSAATexture() const;
51
52 std::shared_ptr<Texture> CreateDepthStencilTexture() const;
53 };
54
55 } // namespace impeller
56
57 #endif // FLUTTER_IMPELLER_RENDERER_BACKEND_VULKAN_SWAPCHAIN_SWAPCHAIN_TRANSIENTS_VK_H_
impeller::SwapchainTransientsVK
Resources, meant to be memoized by the texture descriptor of the wrapped swapchain images,...
Definition: swapchain_transients_vk.h:23
impeller::SwapchainTransientsVK::IsMSAAEnabled
bool IsMSAAEnabled() const
Definition: swapchain_transients_vk.cc:90
impeller::SwapchainTransientsVK::GetContext
const std::weak_ptr< Context > & GetContext() const
Definition: swapchain_transients_vk.cc:94
impeller::SwapchainTransientsVK::GetMSAATexture
const std::shared_ptr< Texture > & GetMSAATexture()
Definition: swapchain_transients_vk.cc:18
impeller::SwapchainTransientsVK::operator=
SwapchainTransientsVK & operator=(const SwapchainTransientsVK &)=delete
impeller::SwapchainTransientsVK::SwapchainTransientsVK
SwapchainTransientsVK(const SwapchainTransientsVK &)=delete
impeller::SwapchainTransientsVK::~SwapchainTransientsVK
~SwapchainTransientsVK()
impeller::SwapchainTransientsVK::GetDepthStencilTexture
const std::shared_ptr< Texture > & GetDepthStencilTexture()
Definition: swapchain_transients_vk.cc:27
impeller::SwapchainTransientsVK::SwapchainTransientsVK
SwapchainTransientsVK(std::weak_ptr< Context > context, TextureDescriptor desc, bool enable_msaa)
Definition: swapchain_transients_vk.cc:11
texture.h
impeller
Definition: allocation.cc:12
context.h
impeller::TextureDescriptor
A lightweight object that describes the attributes of a texture that can then used an allocator to cr...
Definition: texture_descriptor.h:38
texture_descriptor.h