Skip to content

Commit

Permalink
Revert: Remove uses of ReleaseOwnership from vulkan backend (flutter#…
Browse files Browse the repository at this point in the history
  • Loading branch information
zanderso authored Jun 7, 2018
1 parent 11d3600 commit 6cd1ee1
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 0 deletions.
4 changes: 4 additions & 0 deletions vulkan/vulkan_application.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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 {};
Expand Down
2 changes: 2 additions & 0 deletions vulkan/vulkan_application.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ class VulkanApplication {

const VulkanHandle<VkInstance>& GetInstance() const;

void ReleaseInstanceOwnership();

std::unique_ptr<VulkanDevice> AcquireFirstCompatibleLogicalDevice() const;

private:
Expand Down
4 changes: 4 additions & 0 deletions vulkan/vulkan_device.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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_;
Expand Down
2 changes: 2 additions & 0 deletions vulkan/vulkan_device.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ class VulkanDevice {

uint32_t GetGraphicsQueueIndex() const;

void ReleaseDeviceOwnership();

FXL_WARN_UNUSED_RESULT
bool GetSurfaceCapabilities(const VulkanSurface& surface,
VkSurfaceCapabilitiesKHR* capabilities) const;
Expand Down
5 changes: 5 additions & 0 deletions vulkan/vulkan_handle.h
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 6cd1ee1

Please sign in to comment.