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 "GrVkTextureRenderTarget.h" | 8 #include "GrVkTextureRenderTarget.h" |
9 | 9 |
10 #include "GrRenderTargetPriv.h" | 10 #include "GrRenderTargetPriv.h" |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 // Wrapped textures require both image and allocation (because they can be m
apped) | 152 // Wrapped textures require both image and allocation (because they can be m
apped) |
153 SkASSERT(VK_NULL_HANDLE != info->fImage && VK_NULL_HANDLE != info->fAlloc); | 153 SkASSERT(VK_NULL_HANDLE != info->fImage && VK_NULL_HANDLE != info->fAlloc); |
154 | 154 |
155 GrVkImage::Resource::Flags flags = (VK_IMAGE_TILING_LINEAR == info->fImageTi
ling) | 155 GrVkImage::Resource::Flags flags = (VK_IMAGE_TILING_LINEAR == info->fImageTi
ling) |
156 ? Resource::kLinearTiling_Flag : Resource::
kNo_Flags; | 156 ? Resource::kLinearTiling_Flag : Resource::
kNo_Flags; |
157 | 157 |
158 const GrVkImage::Resource* imageResource; | 158 const GrVkImage::Resource* imageResource; |
159 if (kBorrow_GrWrapOwnership == ownership) { | 159 if (kBorrow_GrWrapOwnership == ownership) { |
160 imageResource = new GrVkImage::BorrowedResource(info->fImage, | 160 imageResource = new GrVkImage::BorrowedResource(info->fImage, |
161 info->fAlloc, | 161 info->fAlloc, |
162 flags, | 162 info->fFormat, |
163 info->fFormat); | 163 info->fLevelCount, |
| 164 flags); |
164 } else { | 165 } else { |
165 imageResource = new GrVkImage::Resource(info->fImage, info->fAlloc, flag
s, info->fFormat); | 166 imageResource = new GrVkImage::Resource(info->fImage, info->fAlloc, info
->fFormat, |
| 167 info->fLevelCount, flags); |
166 } | 168 } |
167 if (!imageResource) { | 169 if (!imageResource) { |
168 return nullptr; | 170 return nullptr; |
169 } | 171 } |
170 GrVkTextureRenderTarget* trt = Create(gpu, kWrapped, desc, format, imageReso
urce); | 172 GrVkTextureRenderTarget* trt = Create(gpu, kWrapped, desc, format, imageReso
urce); |
171 if (trt) { | 173 if (trt) { |
172 trt->fCurrentLayout = info->fImageLayout; | 174 trt->fCurrentLayout = info->fImageLayout; |
173 } | 175 } |
174 // Create() will increment the refCount of the image resource if it succeeds | 176 // Create() will increment the refCount of the image resource if it succeeds |
175 imageResource->unref(gpu); | 177 imageResource->unref(gpu); |
176 | 178 |
177 return trt; | 179 return trt; |
178 } | 180 } |
OLD | NEW |