未验证 提交 6cd1ee15 编写于 作者: Z Zachary Anderson 提交者: GitHub

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

上级 11d36001
...@@ -129,6 +129,10 @@ const VulkanHandle<VkInstance>& VulkanApplication::GetInstance() const { ...@@ -129,6 +129,10 @@ const VulkanHandle<VkInstance>& VulkanApplication::GetInstance() const {
return instance_; return instance_;
} }
void VulkanApplication::ReleaseInstanceOwnership() {
instance_.ReleaseOwnership();
}
std::vector<VkPhysicalDevice> VulkanApplication::GetPhysicalDevices() const { std::vector<VkPhysicalDevice> VulkanApplication::GetPhysicalDevices() const {
if (!IsValid()) { if (!IsValid()) {
return {}; return {};
......
...@@ -38,6 +38,8 @@ class VulkanApplication { ...@@ -38,6 +38,8 @@ class VulkanApplication {
const VulkanHandle<VkInstance>& GetInstance() const; const VulkanHandle<VkInstance>& GetInstance() const;
void ReleaseInstanceOwnership();
std::unique_ptr<VulkanDevice> AcquireFirstCompatibleLogicalDevice() const; std::unique_ptr<VulkanDevice> AcquireFirstCompatibleLogicalDevice() const;
private: private:
......
...@@ -153,6 +153,10 @@ const VulkanHandle<VkDevice>& VulkanDevice::GetHandle() const { ...@@ -153,6 +153,10 @@ const VulkanHandle<VkDevice>& VulkanDevice::GetHandle() const {
return device_; return device_;
} }
void VulkanDevice::ReleaseDeviceOwnership() {
device_.ReleaseOwnership();
}
const VulkanHandle<VkPhysicalDevice>& VulkanDevice::GetPhysicalDeviceHandle() const VulkanHandle<VkPhysicalDevice>& VulkanDevice::GetPhysicalDeviceHandle()
const { const {
return physical_device_; return physical_device_;
......
...@@ -35,6 +35,8 @@ class VulkanDevice { ...@@ -35,6 +35,8 @@ class VulkanDevice {
uint32_t GetGraphicsQueueIndex() const; uint32_t GetGraphicsQueueIndex() const;
void ReleaseDeviceOwnership();
FXL_WARN_UNUSED_RESULT FXL_WARN_UNUSED_RESULT
bool GetSurfaceCapabilities(const VulkanSurface& surface, bool GetSurfaceCapabilities(const VulkanSurface& surface,
VkSurfaceCapabilitiesKHR* capabilities) const; VkSurfaceCapabilitiesKHR* capabilities) const;
......
...@@ -50,6 +50,11 @@ class VulkanHandle { ...@@ -50,6 +50,11 @@ class VulkanHandle {
operator Handle() const { return handle_; } 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(); } void Reset() { DisposeIfNecessary(); }
private: private:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册