Fix Vulkan memory leak in MSAA
authorGreg Daniel <egdaniel@google.com>
Mon, 3 Apr 2017 14:29:43 +0000 (10:29 -0400)
committerSkia Commit-Bot <skia-commit-bot@chromium.org>
Mon, 3 Apr 2017 19:01:38 +0000 (19:01 +0000)
BUG=skia:

Change-Id: Ia32bd6654fb3f5371d8109e04464e1932d4bab52
Reviewed-on: https://skia-review.googlesource.com/11120
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>

src/gpu/vk/GrVkRenderTarget.cpp
src/gpu/vk/GrVkRenderTarget.h

index bb2b0664d17fb390b1db8d818d8e096f162d8034..d5719fdd5e578f5d9f3fe4fa84cf9e4bb1412e08 100644 (file)
@@ -281,7 +281,7 @@ void GrVkRenderTarget::releaseInternalObjects() {
 
     if (fMSAAImage) {
         fMSAAImage->releaseImage(gpu);
-        fMSAAImage = nullptr;
+        fMSAAImage.reset();
     }
 
     if (fResolveAttachmentView) {
@@ -305,7 +305,7 @@ void GrVkRenderTarget::releaseInternalObjects() {
 void GrVkRenderTarget::abandonInternalObjects() {
     if (fMSAAImage) {
         fMSAAImage->abandonImage();
-        fMSAAImage = nullptr;
+        fMSAAImage.reset();
     }
 
     if (fResolveAttachmentView) {
index bfecdc9d5ed38d0e63bc725d6e4e230776ab4233..cf425fb0a2de1645a22666a9dc177db85e25c882 100644 (file)
@@ -47,7 +47,7 @@ public:
         }
         return nullptr;
     }
-    GrVkImage* msaaImage() { return fMSAAImage; }
+    GrVkImage* msaaImage() { return fMSAAImage.get(); }
     const GrVkImageView* resolveAttachmentView() const { return fResolveAttachmentView; }
     const GrVkResource* stencilImageResource() const;
     const GrVkImageView* stencilAttachmentView() const;
@@ -106,7 +106,7 @@ protected:
     void createFramebuffer(GrVkGpu* gpu);
 
     const GrVkImageView*       fColorAttachmentView;
-    GrVkImage*                 fMSAAImage;
+    std::unique_ptr<GrVkImage> fMSAAImage;
     const GrVkImageView*       fResolveAttachmentView;
 
 private: