| Flutter Impeller |

surface_context_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 #pragma once
6
7 #include <memory>
8
9 #include "impeller/base/backend_cast.h"
10 #include "impeller/renderer/backend/vulkan/vk.h"
11 #include "impeller/renderer/context.h"
12
13 namespace impeller {
14
15 class ContextVK;
16 class Surface;
17 class SwapchainVK;
18
19 class SurfaceContextVK : public Context,
20 public BackendCast<SurfaceContextVK, Context> {
21 public:
22 explicit SurfaceContextVK(const std::shared_ptr<ContextVK>& parent);
23
24 // |Context|
25 ~SurfaceContextVK() override;
26
27 // |Context|
28 BackendType GetBackendType() const override;
29
30 // |Context|
31 std::string DescribeGpuModel() const override;
32
33 // |Context|
34 bool IsValid() const override;
35
36 // |Context|
37 std::shared_ptr<Allocator> GetResourceAllocator() const override;
38
39 // |Context|
40 std::shared_ptr<ShaderLibrary> GetShaderLibrary() const override;
41
42 // |Context|
43 std::shared_ptr<SamplerLibrary> GetSamplerLibrary() const override;
44
45 // |Context|
46 std::shared_ptr<PipelineLibrary> GetPipelineLibrary() const override;
47
48 // |Context|
49 std::shared_ptr<CommandBuffer> CreateCommandBuffer() const override;
50
51 // |Context|
52 const std::shared_ptr<const Capabilities>& GetCapabilities() const override;
53
54 // |Context|
55 void Shutdown() override;
56
57 // |Context|
58 void SetSyncPresentation(bool value) override;
59
60 [[nodiscard]] bool SetWindowSurface(vk::UniqueSurfaceKHR surface);
61
62 std::unique_ptr<Surface> AcquireNextSurface();
63
64 #ifdef FML_OS_ANDROID
65 vk::UniqueSurfaceKHR CreateAndroidSurface(ANativeWindow* window) const;
66 #endif // FML_OS_ANDROID
67
68 private:
69 std::shared_ptr<ContextVK> parent_;
70 std::shared_ptr<SwapchainVK> swapchain_;
71 };
72
73 } // namespace impeller
impeller::Context::BackendType
BackendType
Definition: context.h:49
impeller::SurfaceContextVK::AcquireNextSurface
std::unique_ptr< Surface > AcquireNextSurface()
Definition: surface_context_vk.cc:70
impeller::SurfaceContextVK::GetSamplerLibrary
std::shared_ptr< SamplerLibrary > GetSamplerLibrary() const override
Returns the library of combined image samplers used in shaders.
Definition: surface_context_vk.cc:39
impeller::SurfaceContextVK::~SurfaceContextVK
~SurfaceContextVK() override
impeller::SurfaceContextVK::GetBackendType
BackendType GetBackendType() const override
Get the graphics backend of an Impeller context.
Definition: surface_context_vk.cc:19
impeller::SurfaceContextVK::CreateCommandBuffer
std::shared_ptr< CommandBuffer > CreateCommandBuffer() const override
Create a new command buffer. Command buffers can be used to encode graphics, blit,...
Definition: surface_context_vk.cc:47
impeller::SurfaceContextVK::GetShaderLibrary
std::shared_ptr< ShaderLibrary > GetShaderLibrary() const override
Returns the library of shaders used to specify the programmable stages of a pipeline.
Definition: surface_context_vk.cc:35
vk.h
impeller::SurfaceContextVK
Definition: surface_context_vk.h:19
impeller::SurfaceContextVK::SetWindowSurface
bool SetWindowSurface(vk::UniqueSurfaceKHR surface)
Definition: surface_context_vk.cc:60
impeller::SurfaceContextVK::GetCapabilities
const std::shared_ptr< const Capabilities > & GetCapabilities() const override
Get the capabilities of Impeller context. All optionally supported feature of the platform,...
Definition: surface_context_vk.cc:51
impeller::SurfaceContextVK::SurfaceContextVK
SurfaceContextVK(const std::shared_ptr< ContextVK > &parent)
Definition: surface_context_vk.cc:14
backend_cast.h
impeller::SurfaceContextVK::DescribeGpuModel
std::string DescribeGpuModel() const override
Definition: surface_context_vk.cc:23
impeller::Context
To do anything rendering related with Impeller, you need a context.
Definition: context.h:47
impeller::BackendCast
Definition: backend_cast.h:12
impeller::SurfaceContextVK::SetSyncPresentation
void SetSyncPresentation(bool value) override
Force the Vulkan presentation (submitKHR) to be performed on the raster task runner.
Definition: surface_context_vk.cc:87
impeller::SurfaceContextVK::GetResourceAllocator
std::shared_ptr< Allocator > GetResourceAllocator() const override
Returns the allocator used to create textures and buffers on the device.
Definition: surface_context_vk.cc:31
context.h
impeller::SurfaceContextVK::GetPipelineLibrary
std::shared_ptr< PipelineLibrary > GetPipelineLibrary() const override
Returns the library of pipelines used by render or compute commands.
Definition: surface_context_vk.cc:43
impeller::SurfaceContextVK::IsValid
bool IsValid() const override
Determines if a context is valid. If the caller ever receives an invalid context, they must discard i...
Definition: surface_context_vk.cc:27
impeller
Definition: aiks_context.cc:10
impeller::SurfaceContextVK::Shutdown
void Shutdown() override
Force all pending asynchronous work to finish. This is achieved by deleting all owned concurrent mess...
Definition: surface_context_vk.cc:56