소스 검색

vk_resource_manager: Minor VKFenceWatch changes

ReinUsesLisp 7 년 전
부모
커밋
281a8bf259
2개의 변경된 파일7개의 추가작업 그리고 7개의 파일을 삭제
  1. 6 6
      src/video_core/renderer_vulkan/vk_resource_manager.cpp
  2. 1 1
      src/video_core/renderer_vulkan/vk_resource_manager.h

+ 6 - 6
src/video_core/renderer_vulkan/vk_resource_manager.cpp

@@ -125,11 +125,12 @@ void VKFence::Protect(VKResource* resource) {
     protected_resources.push_back(resource);
 }
 
-void VKFence::Unprotect(const VKResource* resource) {
+void VKFence::Unprotect(VKResource* resource) {
     const auto it = std::find(protected_resources.begin(), protected_resources.end(), resource);
-    if (it != protected_resources.end()) {
-        protected_resources.erase(it);
-    }
+    ASSERT(it != protected_resources.end());
+
+    resource->OnFenceRemoval(this);
+    protected_resources.erase(it);
 }
 
 VKFenceWatch::VKFenceWatch() = default;
@@ -141,12 +142,11 @@ VKFenceWatch::~VKFenceWatch() {
 }
 
 void VKFenceWatch::Wait() {
-    if (!fence) {
+    if (fence == nullptr) {
         return;
     }
     fence->Wait();
     fence->Unprotect(this);
-    fence = nullptr;
 }
 
 void VKFenceWatch::Watch(VKFence& new_fence) {

+ 1 - 1
src/video_core/renderer_vulkan/vk_resource_manager.h

@@ -63,7 +63,7 @@ public:
     void Protect(VKResource* resource);
 
     /// Removes protection for a resource.
-    void Unprotect(const VKResource* resource);
+    void Unprotect(VKResource* resource);
 
     /// Retreives the fence.
     operator vk::Fence() const {