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 "GrVkTexture.h" | 8 #include "GrVkTexture.h" |
9 #include "GrVkGpu.h" | 9 #include "GrVkGpu.h" |
10 #include "GrVkImageView.h" | 10 #include "GrVkImageView.h" |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 | 76 |
77 return new GrVkTexture(gpu, budgeted, desc, info, imageView); | 77 return new GrVkTexture(gpu, budgeted, desc, info, imageView); |
78 } | 78 } |
79 | 79 |
80 GrVkTexture* GrVkTexture::CreateWrappedTexture(GrVkGpu* gpu, | 80 GrVkTexture* GrVkTexture::CreateWrappedTexture(GrVkGpu* gpu, |
81 const GrSurfaceDesc& desc, | 81 const GrSurfaceDesc& desc, |
82 GrWrapOwnership ownership, | 82 GrWrapOwnership ownership, |
83 const GrVkImageInfo* info) { | 83 const GrVkImageInfo* info) { |
84 SkASSERT(info); | 84 SkASSERT(info); |
85 // Wrapped textures require both image and allocation (because they can be m
apped) | 85 // Wrapped textures require both image and allocation (because they can be m
apped) |
86 SkASSERT(VK_NULL_HANDLE != info->fImage && VK_NULL_HANDLE != info->fAlloc); | 86 SkASSERT(VK_NULL_HANDLE != info->fImage && VK_NULL_HANDLE != info->fAlloc.fM
emory); |
87 | 87 |
88 const GrVkImageView* imageView = GrVkImageView::Create(gpu, info->fImage, in
fo->fFormat, | 88 const GrVkImageView* imageView = GrVkImageView::Create(gpu, info->fImage, in
fo->fFormat, |
89 GrVkImageView::kColor
_Type, | 89 GrVkImageView::kColor
_Type, |
90 info->fLevelCount); | 90 info->fLevelCount); |
91 if (!imageView) { | 91 if (!imageView) { |
92 return nullptr; | 92 return nullptr; |
93 } | 93 } |
94 | 94 |
95 GrVkImage::Wrapped wrapped = kBorrow_GrWrapOwnership == ownership ? GrVkImag
e::kBorrowed_Wrapped | 95 GrVkImage::Wrapped wrapped = kBorrow_GrWrapOwnership == ownership ? GrVkImag
e::kBorrowed_Wrapped |
96 : GrVkImag
e::kAdopted_Wrapped; | 96 : GrVkImag
e::kAdopted_Wrapped; |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 fLinearTextureView = nullptr; | 216 fLinearTextureView = nullptr; |
217 } | 217 } |
218 | 218 |
219 this->setNewResource(info.fImage, info.fAlloc); | 219 this->setNewResource(info.fImage, info.fAlloc); |
220 fTextureView = textureView; | 220 fTextureView = textureView; |
221 fInfo = info; | 221 fInfo = info; |
222 this->texturePriv().setMaxMipMapLevel(mipLevels); | 222 this->texturePriv().setMaxMipMapLevel(mipLevels); |
223 | 223 |
224 return true; | 224 return true; |
225 } | 225 } |
OLD | NEW |