7#include "flutter/fml/trace_event.h"
21 return parent_->GetBackendType();
25 return parent_->DescribeGpuModel();
29 return parent_->IsValid();
33 return parent_->GetResourceAllocator();
37 return parent_->GetShaderLibrary();
41 return parent_->GetSamplerLibrary();
45 return parent_->GetPipelineLibrary();
49 return parent_->CreateCommandBuffer();
53 return parent_->GetCommandQueue();
58 return parent_->GetCapabilities();
82 auto surface = swapchain_ ? swapchain_->AcquireNextDrawable() :
nullptr;
86 if (
auto pipeline_library = parent_->GetPipelineLibrary()) {
90 parent_->GetCommandPoolRecycler()->Dispose();
91 parent_->GetResourceAllocator()->DebugTraceMemoryStatistics();
96 swapchain_->UpdateSurfaceSize(size);
101vk::UniqueSurfaceKHR SurfaceContextVK::CreateAndroidSurface(
103 if (!parent_->GetInstance()) {
107 auto create_info = vk::AndroidSurfaceCreateInfoKHR().setWindow(
window);
109 parent_->GetInstance().createAndroidSurfaceKHRUnique(create_info);
111 if (surface_res.result != vk::Result::eSuccess) {
113 << vk::to_string(surface_res.result);
117 return std::move(surface_res.value);
123 return parent_->GetDevice();
127 parent_->InitializeCommonlyUsedShadersIfNeeded();
static PipelineLibraryVK & Cast(PipelineLibrary &base)
void DidAcquireSurfaceFrame()
bool SetWindowSurface(vk::UniqueSurfaceKHR surface, const ISize &size)
SurfaceContextVK(const std::shared_ptr< ContextVK > &parent)
std::shared_ptr< PipelineLibrary > GetPipelineLibrary() const override
Returns the library of pipelines used by render or compute commands.
~SurfaceContextVK() override
const std::shared_ptr< const Capabilities > & GetCapabilities() const override
Get the capabilities of Impeller context. All optionally supported feature of the platform,...
BackendType GetBackendType() const override
Get the graphics backend of an Impeller context.
std::string DescribeGpuModel() const override
bool IsValid() const override
Determines if a context is valid. If the caller ever receives an invalid context, they must discard i...
void UpdateSurfaceSize(const ISize &size) const
Mark the current swapchain configuration as dirty, forcing it to be recreated on the next frame.
std::unique_ptr< Surface > AcquireNextSurface()
const vk::Device & GetDevice() const
std::shared_ptr< SamplerLibrary > GetSamplerLibrary() const override
Returns the library of combined image samplers used in shaders.
std::shared_ptr< CommandQueue > GetCommandQueue() const override
Return the graphics queue for submitting command buffers.
void Shutdown() override
Force all pending asynchronous work to finish. This is achieved by deleting all owned concurrent mess...
std::shared_ptr< CommandBuffer > CreateCommandBuffer() const override
Create a new command buffer. Command buffers can be used to encode graphics, blit,...
const ContextVK & GetParent() const
std::shared_ptr< ShaderLibrary > GetShaderLibrary() const override
Returns the library of shaders used to specify the programmable stages of a pipeline.
void InitializeCommonlyUsedShadersIfNeeded() const override
std::shared_ptr< Allocator > GetResourceAllocator() const override
Returns the allocator used to create textures and buffers on the device.
static std::shared_ptr< SwapchainVK > Create(const std::shared_ptr< Context > &context, vk::UniqueSurfaceKHR surface, const ISize &size, bool enable_msaa=true)
#define TRACE_EVENT0(category_group, name)
struct ANativeWindow ANativeWindow