| Flutter Impeller |

pipeline_cache_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_PIPELINE_CACHE_VK_H_
6 #define FLUTTER_IMPELLER_RENDERER_BACKEND_VULKAN_PIPELINE_CACHE_VK_H_
7
8 #include "flutter/fml/file.h"
9 #include "impeller/base/thread.h"
10 #include "impeller/renderer/backend/vulkan/capabilities_vk.h"
11 #include "impeller/renderer/backend/vulkan/device_holder_vk.h"
12
13 namespace impeller {
14
15 class PipelineCacheVK {
16 public:
17 // The [device] is passed in directly so that it can be used in the
18 // constructor directly. The [device_holder] isn't guaranteed to be valid
19 // at the time of executing `PipelineCacheVK` because of how `ContextVK` does
20 // initialization.
21 explicit PipelineCacheVK(std::shared_ptr<const Capabilities> caps,
22 std::shared_ptr<DeviceHolderVK> device_holder,
23 fml::UniqueFD cache_directory);
24
25 ~PipelineCacheVK();
26
27 bool IsValid() const;
28
29 vk::UniquePipeline CreatePipeline(const vk::GraphicsPipelineCreateInfo& info);
30
31 vk::UniquePipeline CreatePipeline(const vk::ComputePipelineCreateInfo& info);
32
33 const CapabilitiesVK* GetCapabilities() const;
34
35 void PersistCacheToDisk();
36
37 private:
38 const std::shared_ptr<const Capabilities> caps_;
39 std::weak_ptr<DeviceHolderVK> device_holder_;
40 const fml::UniqueFD cache_directory_;
41 vk::UniquePipelineCache cache_;
42 bool is_valid_ = false;
43 Mutex persist_mutex_;
44
45 PipelineCacheVK(const PipelineCacheVK&) = delete;
46
47 PipelineCacheVK& operator=(const PipelineCacheVK&) = delete;
48 };
49
50 } // namespace impeller
51
52 #endif // FLUTTER_IMPELLER_RENDERER_BACKEND_VULKAN_PIPELINE_CACHE_VK_H_
capabilities_vk.h
impeller::CapabilitiesVK
The Vulkan layers and extensions wrangler.
Definition: capabilities_vk.h:181
impeller::PipelineCacheVK
Definition: pipeline_cache_vk.h:15
impeller::PipelineCacheVK::PersistCacheToDisk
void PersistCacheToDisk()
Definition: pipeline_cache_vk.cc:110
impeller::PipelineCacheVK::PipelineCacheVK
PipelineCacheVK(std::shared_ptr< const Capabilities > caps, std::shared_ptr< DeviceHolderVK > device_holder, fml::UniqueFD cache_directory)
Definition: pipeline_cache_vk.cc:18
impeller::PipelineCacheVK::IsValid
bool IsValid() const
Definition: pipeline_cache_vk.cc:74
impeller::PipelineCacheVK::CreatePipeline
vk::UniquePipeline CreatePipeline(const vk::GraphicsPipelineCreateInfo &info)
Definition: pipeline_cache_vk.cc:78
impeller::PipelineCacheVK::~PipelineCacheVK
~PipelineCacheVK()
Definition: pipeline_cache_vk.cc:65
impeller::PipelineCacheVK::GetCapabilities
const CapabilitiesVK * GetCapabilities() const
Definition: pipeline_cache_vk.cc:125
device_holder_vk.h
impeller
Definition: allocation.cc:12
thread.h