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

Side by Side Diff: src/gpu/vk/GrVkRenderTarget.cpp

Issue 1943933002: Apply setImageLayout() to all of a VkImage's subresources. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Address comments Created 4 years, 7 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 unified diff | Download patch
OLDNEW
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 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 SkASSERT(VK_NULL_HANDLE != info->fImage); 207 SkASSERT(VK_NULL_HANDLE != info->fImage);
208 SkASSERT(VK_NULL_HANDLE != info->fAlloc || kAdopt_GrWrapOwnership != ownersh ip); 208 SkASSERT(VK_NULL_HANDLE != info->fAlloc || kAdopt_GrWrapOwnership != ownersh ip);
209 209
210 GrVkImage::Resource::Flags flags = (VK_IMAGE_TILING_LINEAR == info->fImageTi ling) 210 GrVkImage::Resource::Flags flags = (VK_IMAGE_TILING_LINEAR == info->fImageTi ling)
211 ? Resource::kLinearTiling_Flag : Resource:: kNo_Flags; 211 ? Resource::kLinearTiling_Flag : Resource:: kNo_Flags;
212 212
213 const GrVkImage::Resource* imageResource; 213 const GrVkImage::Resource* imageResource;
214 if (kBorrow_GrWrapOwnership == ownership) { 214 if (kBorrow_GrWrapOwnership == ownership) {
215 imageResource = new GrVkImage::BorrowedResource(info->fImage, 215 imageResource = new GrVkImage::BorrowedResource(info->fImage,
216 info->fAlloc, 216 info->fAlloc,
217 flags, 217 info->fFormat,
218 info->fFormat); 218 info->fLevelCount,
219 flags);
219 } else { 220 } else {
220 imageResource = new GrVkImage::Resource(info->fImage, info->fAlloc, flag s, info->fFormat); 221 imageResource = new GrVkImage::Resource(info->fImage, info->fAlloc, info ->fFormat,
222 info->fLevelCount, flags);
221 } 223 }
222 if (!imageResource) { 224 if (!imageResource) {
223 return nullptr; 225 return nullptr;
224 } 226 }
225 227
226 GrVkRenderTarget* rt = GrVkRenderTarget::Create(gpu, SkBudgeted::kNo, desc, imageResource); 228 GrVkRenderTarget* rt = GrVkRenderTarget::Create(gpu, SkBudgeted::kNo, desc, imageResource);
227 if (rt) { 229 if (rt) {
228 rt->fCurrentLayout = info->fImageLayout; 230 rt->fCurrentLayout = info->fImageLayout;
229 } 231 }
230 // Create() will increment the refCount of the image resource if it succeeds 232 // Create() will increment the refCount of the image resource if it succeeds
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 } 399 }
398 400
399 return nullptr; 401 return nullptr;
400 } 402 }
401 403
402 404
403 GrVkGpu* GrVkRenderTarget::getVkGpu() const { 405 GrVkGpu* GrVkRenderTarget::getVkGpu() const {
404 SkASSERT(!this->wasDestroyed()); 406 SkASSERT(!this->wasDestroyed());
405 return static_cast<GrVkGpu*>(this->getGpu()); 407 return static_cast<GrVkGpu*>(this->getGpu());
406 } 408 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698