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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 const GrVkTextureInfo*
info) { | 145 const GrVkTextureInfo*
info) { |
146 SkASSERT(info); | 146 SkASSERT(info); |
147 // Wrapped textures require both image and allocation (because they can be m
apped) | 147 // Wrapped textures require both image and allocation (because they can be m
apped) |
148 SkASSERT(VK_NULL_HANDLE != info->fImage && VK_NULL_HANDLE != info->fAlloc); | 148 SkASSERT(VK_NULL_HANDLE != info->fImage && VK_NULL_HANDLE != info->fAlloc); |
149 | 149 |
150 GrVkImage::Resource::Flags flags = (VK_IMAGE_TILING_LINEAR == info->fImageTi
ling) | 150 GrVkImage::Resource::Flags flags = (VK_IMAGE_TILING_LINEAR == info->fImageTi
ling) |
151 ? Resource::kLinearTiling_Flag : Resource::
kNo_Flags; | 151 ? Resource::kLinearTiling_Flag : Resource::
kNo_Flags; |
152 | 152 |
153 const GrVkImage::Resource* imageResource; | 153 const GrVkImage::Resource* imageResource; |
154 if (kBorrowed_LifeCycle == lifeCycle) { | 154 if (kBorrowed_LifeCycle == lifeCycle) { |
155 imageResource = new GrVkImage::BorrowedResource(info->fImage, info->fAll
oc, flags); | 155 imageResource = new GrVkImage::BorrowedResource(info->fImage, |
| 156 info->fAlloc, |
| 157 flags, |
| 158 info->fFormat); |
156 } else { | 159 } else { |
157 imageResource = new GrVkImage::Resource(info->fImage, info->fAlloc, flag
s); | 160 imageResource = new GrVkImage::Resource(info->fImage, info->fAlloc, flag
s, info->fFormat); |
158 } | 161 } |
159 if (!imageResource) { | 162 if (!imageResource) { |
160 return nullptr; | 163 return nullptr; |
161 } | 164 } |
162 | 165 |
163 GrVkTextureRenderTarget* trt = GrVkTextureRenderTarget::Create(gpu, desc, li
feCycle, | 166 GrVkTextureRenderTarget* trt = GrVkTextureRenderTarget::Create(gpu, desc, li
feCycle, |
164 format, image
Resource); | 167 format, image
Resource); |
165 if (trt) { | 168 if (trt) { |
166 trt->fCurrentLayout = info->fImageLayout; | 169 trt->fCurrentLayout = info->fImageLayout; |
167 } | 170 } |
168 // Create() will increment the refCount of the image resource if it succeeds | 171 // Create() will increment the refCount of the image resource if it succeeds |
169 imageResource->unref(gpu); | 172 imageResource->unref(gpu); |
170 | 173 |
171 return trt; | 174 return trt; |
172 } | 175 } |
OLD | NEW |