Flutter Engine
vulkan::VulkanSurface Class Reference

#include <vulkan_surface.h>

Public Member Functions

 VulkanSurface (VulkanProcTable &vk, VulkanApplication &application, std::unique_ptr< VulkanNativeSurface > native_surface)
 
 ~VulkanSurface ()
 
bool IsValid () const
 
SkISize GetSize () const
 Returns the current size of the surface or (0, 0) if invalid. More...
 
const VulkanHandle< VkSurfaceKHR > & Handle () const
 
const VulkanNativeSurfaceGetNativeSurface () const
 

Detailed Description

Definition at line 18 of file vulkan_surface.h.

Constructor & Destructor Documentation

◆ VulkanSurface()

vulkan::VulkanSurface::VulkanSurface ( VulkanProcTable vk,
VulkanApplication application,
std::unique_ptr< VulkanNativeSurface native_surface 
)

Definition at line 12 of file vulkan_surface.cc.

References FML_DLOG, vulkan::VulkanApplication::GetInstance(), and ~VulkanSurface().

16  : vk(p_vk),
17  application_(application),
18  native_surface_(std::move(native_surface)),
19  valid_(false) {
20  if (native_surface_ == nullptr || !native_surface_->IsValid()) {
21  FML_DLOG(INFO) << "Native surface was invalid.";
22  return;
23  }
24 
25  VkSurfaceKHR surface =
26  native_surface_->CreateSurfaceHandle(vk, application.GetInstance());
27 
28  if (surface == VK_NULL_HANDLE) {
29  FML_DLOG(INFO) << "Could not create the surface handle.";
30  return;
31  }
32 
33  surface_ = {surface, [this](VkSurfaceKHR surface) {
34  vk.DestroySurfaceKHR(application_.GetInstance(), surface,
35  nullptr);
36  }};
37 
38  valid_ = true;
39 }
#define FML_DLOG(severity)
Definition: logging.h:85
const VulkanHandle< VkInstance > & GetInstance() const

◆ ~VulkanSurface()

vulkan::VulkanSurface::~VulkanSurface ( )
default

Referenced by VulkanSurface().

Member Function Documentation

◆ GetNativeSurface()

const VulkanNativeSurface & vulkan::VulkanSurface::GetNativeSurface ( ) const

Definition at line 51 of file vulkan_surface.cc.

51  {
52  return *native_surface_;
53 }

◆ GetSize()

SkISize vulkan::VulkanSurface::GetSize ( ) const

Returns the current size of the surface or (0, 0) if invalid.

Definition at line 55 of file vulkan_surface.cc.

Referenced by vulkan::VulkanDevice::GetSurfaceCapabilities().

55  {
56  return valid_ ? native_surface_->GetSize() : SkISize::Make(0, 0);
57 }

◆ Handle()

const VulkanHandle< VkSurfaceKHR > & vulkan::VulkanSurface::Handle ( ) const

◆ IsValid()

bool vulkan::VulkanSurface::IsValid ( ) const

The documentation for this class was generated from the following files: