| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #include "GrVkRenderTarget.h" | 8 #include "GrVkRenderTarget.h" |
| 9 | 9 |
| 10 #include "GrRenderTargetPriv.h" | 10 #include "GrRenderTargetPriv.h" |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 SkASSERT(info); | 209 SkASSERT(info); |
| 210 // We can wrap a rendertarget without its allocation, as long as we don't ta
ke ownership | 210 // We can wrap a rendertarget without its allocation, as long as we don't ta
ke ownership |
| 211 SkASSERT(VK_NULL_HANDLE != info->fImage); | 211 SkASSERT(VK_NULL_HANDLE != info->fImage); |
| 212 SkASSERT(VK_NULL_HANDLE != info->fAlloc || kAdopted_LifeCycle != lifeCycle); | 212 SkASSERT(VK_NULL_HANDLE != info->fAlloc || kAdopted_LifeCycle != lifeCycle); |
| 213 | 213 |
| 214 GrVkImage::Resource::Flags flags = (VK_IMAGE_TILING_LINEAR == info->fImageTi
ling) | 214 GrVkImage::Resource::Flags flags = (VK_IMAGE_TILING_LINEAR == info->fImageTi
ling) |
| 215 ? Resource::kLinearTiling_Flag : Resource::
kNo_Flags; | 215 ? Resource::kLinearTiling_Flag : Resource::
kNo_Flags; |
| 216 | 216 |
| 217 const GrVkImage::Resource* imageResource; | 217 const GrVkImage::Resource* imageResource; |
| 218 if (kBorrowed_LifeCycle == lifeCycle) { | 218 if (kBorrowed_LifeCycle == lifeCycle) { |
| 219 imageResource = new GrVkImage::BorrowedResource(info->fImage, info->fAll
oc, flags); | 219 imageResource = new GrVkImage::BorrowedResource(info->fImage, |
| 220 info->fAlloc, |
| 221 flags, |
| 222 info->fFormat); |
| 220 } else { | 223 } else { |
| 221 imageResource = new GrVkImage::Resource(info->fImage, info->fAlloc, flag
s); | 224 imageResource = new GrVkImage::Resource(info->fImage, info->fAlloc, flag
s, info->fFormat); |
| 222 } | 225 } |
| 223 if (!imageResource) { | 226 if (!imageResource) { |
| 224 return nullptr; | 227 return nullptr; |
| 225 } | 228 } |
| 226 | 229 |
| 227 GrVkRenderTarget* rt = GrVkRenderTarget::Create(gpu, desc, lifeCycle, imageR
esource); | 230 GrVkRenderTarget* rt = GrVkRenderTarget::Create(gpu, desc, lifeCycle, imageR
esource); |
| 228 if (rt) { | 231 if (rt) { |
| 229 rt->fCurrentLayout = info->fImageLayout; | 232 rt->fCurrentLayout = info->fImageLayout; |
| 230 } | 233 } |
| 231 // Create() will increment the refCount of the image resource if it succeeds | 234 // Create() will increment the refCount of the image resource if it succeeds |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 403 } | 406 } |
| 404 | 407 |
| 405 return nullptr; | 408 return nullptr; |
| 406 } | 409 } |
| 407 | 410 |
| 408 | 411 |
| 409 GrVkGpu* GrVkRenderTarget::getVkGpu() const { | 412 GrVkGpu* GrVkRenderTarget::getVkGpu() const { |
| 410 SkASSERT(!this->wasDestroyed()); | 413 SkASSERT(!this->wasDestroyed()); |
| 411 return static_cast<GrVkGpu*>(this->getGpu()); | 414 return static_cast<GrVkGpu*>(this->getGpu()); |
| 412 } | 415 } |
| OLD | NEW |