5 #ifndef FLUTTER_IMPELLER_RENDERER_BACKEND_VULKAN_CONTEXT_VK_H_
6 #define FLUTTER_IMPELLER_RENDERER_BACKEND_VULKAN_CONTEXT_VK_H_
10 #include "flutter/fml/concurrent_message_loop.h"
11 #include "flutter/fml/mapping.h"
12 #include "flutter/fml/unique_fd.h"
13 #include "fml/thread.h"
31 class CommandEncoderFactoryVK;
32 class CommandEncoderVK;
33 class CommandPoolRecyclerVK;
36 class ResourceManagerVK;
37 class SurfaceContextVK;
39 class DescriptorPoolRecyclerVK;
44 public std::enable_shared_from_this<ContextVK> {
65 uint64_t
GetHash()
const {
return hash_; }
95 const std::shared_ptr<const Capabilities>&
GetCapabilities()
const override;
105 template <
typename T>
110 template <
typename T>
113 std::string_view label) {
119 auto c_handle =
static_cast<typename T::CType
>(handle);
121 vk::DebugUtilsObjectNameInfoEXT info;
122 info.objectType = T::objectType;
123 info.pObjectName = label.data();
124 info.objectHandle =
reinterpret_cast<decltype(info.objectHandle)
>(c_handle);
126 if (device.setDebugUtilsObjectNameEXT(info) != vk::Result::eSuccess) {
135 return device_holder_;
144 const std::shared_ptr<fml::ConcurrentTaskRunner>
172 const vk::Device&
GetDevice()
const override {
return device.get(); }
175 return physical_device;
178 vk::UniqueInstance instance;
179 vk::PhysicalDevice physical_device;
180 vk::UniqueDevice device;
183 std::shared_ptr<DeviceHolderImpl> device_holder_;
184 std::unique_ptr<DriverInfoVK> driver_info_;
185 std::unique_ptr<DebugReportVK> debug_report_;
186 std::shared_ptr<Allocator> allocator_;
187 std::shared_ptr<ShaderLibraryVK> shader_library_;
188 std::shared_ptr<SamplerLibraryVK> sampler_library_;
189 std::shared_ptr<PipelineLibraryVK> pipeline_library_;
190 std::shared_ptr<YUVConversionLibraryVK> yuv_conversion_library_;
192 std::shared_ptr<const Capabilities> device_capabilities_;
193 std::shared_ptr<FenceWaiterVK> fence_waiter_;
194 std::shared_ptr<ResourceManagerVK> resource_manager_;
195 std::shared_ptr<CommandPoolRecyclerVK> command_pool_recycler_;
196 std::string device_name_;
197 std::shared_ptr<fml::ConcurrentMessageLoop> raster_message_loop_;
198 std::shared_ptr<GPUTracerVK> gpu_tracer_;
199 std::shared_ptr<DescriptorPoolRecyclerVK> descriptor_pool_recycler_;
200 std::shared_ptr<CommandQueue> command_queue_vk_;
202 const uint64_t hash_;
204 bool is_valid_ =
false;
208 void Setup(Settings settings);
210 std::unique_ptr<CommandEncoderFactoryVK> CreateGraphicsCommandEncoderFactory()
213 ContextVK(
const ContextVK&) =
delete;
215 ContextVK& operator=(
const ContextVK&) =
delete;
220 #endif // FLUTTER_IMPELLER_RENDERER_BACKEND_VULKAN_CONTEXT_VK_H_