Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(149)

Unified Diff: src/gpu/vk/GrVkRenderTarget.cpp

Issue 1824123002: Fix borrowed GrVkImage::Resource. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/vk/GrVkImage.cpp ('k') | src/gpu/vk/GrVkTexture.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/vk/GrVkRenderTarget.cpp
diff --git a/src/gpu/vk/GrVkRenderTarget.cpp b/src/gpu/vk/GrVkRenderTarget.cpp
index 7ff7f26d42e929afd1911c3dd96a17b739f08ef0..c04cca3d69c86b30ecd3cfc19848cb7bbaf62ca6 100644
--- a/src/gpu/vk/GrVkRenderTarget.cpp
+++ b/src/gpu/vk/GrVkRenderTarget.cpp
@@ -214,9 +214,12 @@ GrVkRenderTarget::CreateWrappedRenderTarget(GrVkGpu* gpu,
GrVkImage::Resource::Flags flags = (VK_IMAGE_TILING_LINEAR == info->fImageTiling)
? Resource::kLinearTiling_Flag : Resource::kNo_Flags;
- const GrVkImage::Resource* imageResource = new GrVkImage::Resource(info->fImage,
- info->fAlloc,
- flags);
+ const GrVkImage::Resource* imageResource;
+ if (kBorrowed_LifeCycle == lifeCycle) {
+ imageResource = new GrVkImage::BorrowedResource(info->fImage, info->fAlloc, flags);
+ } else {
+ imageResource = new GrVkImage::Resource(info->fImage, info->fAlloc, flags);
+ }
if (!imageResource) {
return nullptr;
}
@@ -227,6 +230,7 @@ GrVkRenderTarget::CreateWrappedRenderTarget(GrVkGpu* gpu,
}
// Create() will increment the refCount of the image resource if it succeeds
imageResource->unref(gpu);
+
return rt;
}
« no previous file with comments | « src/gpu/vk/GrVkImage.cpp ('k') | src/gpu/vk/GrVkTexture.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698