Flutter Impeller
shader_function_vk.cc
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 
6 
7 namespace impeller {
8 
9 ShaderFunctionVK::ShaderFunctionVK(
10  const std::weak_ptr<DeviceHolderVK>& device_holder,
11  UniqueID parent_library_id,
12  std::string name,
13  ShaderStage stage,
14  vk::UniqueShaderModule module)
15  : ShaderFunction(parent_library_id, std::move(name), stage),
16  module_(std::move(module)),
17  device_holder_(device_holder) {}
18 
19 ShaderFunctionVK::~ShaderFunctionVK() {
20  std::shared_ptr<DeviceHolderVK> device_holder = device_holder_.lock();
21  if (device_holder) {
22  module_.reset();
23  } else {
24  module_.release();
25  }
26 }
27 
28 const vk::ShaderModule& ShaderFunctionVK::GetModule() const {
29  return module_.get();
30 }
31 
32 } // namespace impeller
Definition: comparable.h:95