Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
shader_library_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_SHADER_LIBRARY_VK_H_
6#define FLUTTER_IMPELLER_RENDERER_BACKEND_VULKAN_SHADER_LIBRARY_VK_H_
7
8#include "flutter/fml/macros.h"
15
16namespace impeller {
17
18class ShaderLibraryVK final : public ShaderLibrary {
19 public:
20 // |ShaderLibrary|
21 ~ShaderLibraryVK() override;
22
23 // |ShaderLibrary|
24 bool IsValid() const override;
25
26 private:
27 friend class ContextVK;
28 std::weak_ptr<DeviceHolderVK> device_holder_;
29 const UniqueID library_id_;
30 mutable RWMutex functions_mutex_;
31 ShaderFunctionMap functions_ IPLR_GUARDED_BY(functions_mutex_);
32 bool is_valid_ = false;
33
35 std::weak_ptr<DeviceHolderVK> device_holder,
36 const std::vector<std::shared_ptr<fml::Mapping>>& shader_libraries_data);
37
38 // |ShaderLibrary|
39 std::shared_ptr<const ShaderFunction> GetFunction(std::string_view name,
40 ShaderStage stage) override;
41
42 // |ShaderLibrary|
43 void RegisterFunction(std::string name,
44 ShaderStage stage,
45 std::shared_ptr<fml::Mapping> code,
47
48 bool RegisterFunction(const std::string& name,
49 ShaderStage stage,
50 const std::shared_ptr<fml::Mapping>& code);
51
52 // |ShaderLibrary|
53 void UnregisterFunction(std::string name, ShaderStage stage) override;
54
55 ShaderLibraryVK(const ShaderLibraryVK&) = delete;
56
57 ShaderLibraryVK& operator=(const ShaderLibraryVK&) = delete;
58};
59
60} // namespace impeller
61
62#endif // FLUTTER_IMPELLER_RENDERER_BACKEND_VULKAN_SHADER_LIBRARY_VK_H_
void RegisterFunction(std::string name, ShaderStage stage, std::shared_ptr< fml::Mapping > code, RegistrationCallback callback) override
std::shared_ptr< const ShaderFunction > GetFunction(std::string_view name, ShaderStage stage) override
bool IsValid() const override
void UnregisterFunction(std::string name, ShaderStage stage) override
std::function< void(bool)> RegistrationCallback
FlKeyEvent uint64_t FlKeyResponderAsyncCallback callback
const char * name
Definition fuchsia.cc:50
std::unordered_map< ShaderKey, std::shared_ptr< const ShaderFunction >, ShaderKey::Hash, ShaderKey::Equal > ShaderFunctionMap
Definition shader_key.h:44
#define IPLR_GUARDED_BY(x)