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 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 } | 194 } |
195 | 195 |
196 GrVkRenderTarget* rt = GrVkRenderTarget::Create(gpu, budgeted, desc, info, | 196 GrVkRenderTarget* rt = GrVkRenderTarget::Create(gpu, budgeted, desc, info, |
197 GrVkImage::kNot_Wrapped); | 197 GrVkImage::kNot_Wrapped); |
198 if (!rt) { | 198 if (!rt) { |
199 GrVkImage::DestroyImageInfo(gpu, &info); | 199 GrVkImage::DestroyImageInfo(gpu, &info); |
200 } | 200 } |
201 return rt; | 201 return rt; |
202 } | 202 } |
203 | 203 |
204 GrVkRenderTarget* | 204 sk_sp<GrVkRenderTarget> |
205 GrVkRenderTarget::CreateWrappedRenderTarget(GrVkGpu* gpu, | 205 GrVkRenderTarget::MakeWrappedRenderTarget(GrVkGpu* gpu, |
206 const GrSurfaceDesc& desc, | 206 const GrSurfaceDesc& desc, |
207 GrWrapOwnership ownership, | 207 GrWrapOwnership ownership, |
208 const GrVkImageInfo* info) { | 208 const GrVkImageInfo* info) { |
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.fMemory || kAdopt_GrWrapOwnership !=
ownership); | 212 SkASSERT(VK_NULL_HANDLE != info->fAlloc.fMemory || kAdopt_GrWrapOwnership !=
ownership); |
213 | 213 |
214 GrVkImage::Wrapped wrapped = kBorrow_GrWrapOwnership == ownership ? GrVkImag
e::kBorrowed_Wrapped | 214 GrVkImage::Wrapped wrapped = kBorrow_GrWrapOwnership == ownership ? GrVkImag
e::kBorrowed_Wrapped |
215 : GrVkImag
e::kAdopted_Wrapped; | 215 : GrVkImag
e::kAdopted_Wrapped; |
216 | 216 |
217 GrVkRenderTarget* rt = GrVkRenderTarget::Create(gpu, SkBudgeted::kNo, desc,
*info, wrapped); | 217 return sk_sp<GrVkRenderTarget>( |
218 | 218 GrVkRenderTarget::Create(gpu, SkBudgeted::kNo, desc, *info, wrapped)); |
219 return rt; | |
220 } | 219 } |
221 | 220 |
222 bool GrVkRenderTarget::completeStencilAttachment() { | 221 bool GrVkRenderTarget::completeStencilAttachment() { |
223 this->createFramebuffer(this->getVkGpu()); | 222 this->createFramebuffer(this->getVkGpu()); |
224 return true; | 223 return true; |
225 } | 224 } |
226 | 225 |
227 void GrVkRenderTarget::createFramebuffer(GrVkGpu* gpu) { | 226 void GrVkRenderTarget::createFramebuffer(GrVkGpu* gpu) { |
228 if (fFramebuffer) { | 227 if (fFramebuffer) { |
229 fFramebuffer->unref(gpu); | 228 fFramebuffer->unref(gpu); |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
377 } | 376 } |
378 | 377 |
379 return nullptr; | 378 return nullptr; |
380 } | 379 } |
381 | 380 |
382 | 381 |
383 GrVkGpu* GrVkRenderTarget::getVkGpu() const { | 382 GrVkGpu* GrVkRenderTarget::getVkGpu() const { |
384 SkASSERT(!this->wasDestroyed()); | 383 SkASSERT(!this->wasDestroyed()); |
385 return static_cast<GrVkGpu*>(this->getGpu()); | 384 return static_cast<GrVkGpu*>(this->getGpu()); |
386 } | 385 } |
OLD | NEW |