Flutter Engine
The Flutter Engine
Public Member Functions | List of all members
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.

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_ = VulkanHandle<VkSurfaceKHR>{
34 surface, [this](VkSurfaceKHR surface) {
35 vk.DestroySurfaceKHR(application_.GetInstance(), surface, nullptr);
36 }};
37
38 valid_ = true;
39}
const VulkanHandle< VkInstance > & GetInstance() const
VkSurfaceKHR surface
Definition: main.cc:49
#define FML_DLOG(severity)
Definition: logging.h:102
#define VK_NULL_HANDLE
Definition: vulkan_core.h:46

◆ ~VulkanSurface()

vulkan::VulkanSurface::~VulkanSurface ( )
default

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.

55 {
56 return valid_ ? native_surface_->GetSize() : SkISize::Make(0, 0);
57}
static constexpr SkISize Make(int32_t w, int32_t h)
Definition: SkSize.h:20

◆ Handle()

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

Definition at line 47 of file vulkan_surface.cc.

47 {
48 return surface_;
49}

◆ IsValid()

bool vulkan::VulkanSurface::IsValid ( ) const

Definition at line 43 of file vulkan_surface.cc.

43 {
44 return valid_;
45}

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