Revert: Remove uses of ReleaseOwnership from vulkan backend (flutter/engine#5484)

This commit is contained in:
Zachary Anderson
2018-06-07 10:42:48 -07:00
committed by GitHub
parent 2c11514bd2
commit 18f4c34c51
5 changed files with 17 additions and 0 deletions

View File

@@ -129,6 +129,10 @@ const VulkanHandle<VkInstance>& VulkanApplication::GetInstance() const {
return instance_;
}
void VulkanApplication::ReleaseInstanceOwnership() {
instance_.ReleaseOwnership();
}
std::vector<VkPhysicalDevice> VulkanApplication::GetPhysicalDevices() const {
if (!IsValid()) {
return {};

View File

@@ -38,6 +38,8 @@ class VulkanApplication {
const VulkanHandle<VkInstance>& GetInstance() const;
void ReleaseInstanceOwnership();
std::unique_ptr<VulkanDevice> AcquireFirstCompatibleLogicalDevice() const;
private:

View File

@@ -153,6 +153,10 @@ const VulkanHandle<VkDevice>& VulkanDevice::GetHandle() const {
return device_;
}
void VulkanDevice::ReleaseDeviceOwnership() {
device_.ReleaseOwnership();
}
const VulkanHandle<VkPhysicalDevice>& VulkanDevice::GetPhysicalDeviceHandle()
const {
return physical_device_;

View File

@@ -35,6 +35,8 @@ class VulkanDevice {
uint32_t GetGraphicsQueueIndex() const;
void ReleaseDeviceOwnership();
FXL_WARN_UNUSED_RESULT
bool GetSurfaceCapabilities(const VulkanSurface& surface,
VkSurfaceCapabilitiesKHR* capabilities) const;

View File

@@ -50,6 +50,11 @@ class VulkanHandle {
operator Handle() const { return handle_; }
/// Relinquish responsibility of collecting the underlying handle when this
/// object is collected. It is the responsibility of the caller to ensure that
/// the lifetime of the handle extends past the lifetime of this object.
void ReleaseOwnership() { disposer_ = nullptr; }
void Reset() { DisposeIfNecessary(); }
private: