| 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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 } | 128 } |
| 129 | 129 |
| 130 GrVkTextureRenderTarget* trt = Create(gpu, desc, info, budgeted, GrVkImage::
kNot_Wrapped); | 130 GrVkTextureRenderTarget* trt = Create(gpu, desc, info, budgeted, GrVkImage::
kNot_Wrapped); |
| 131 if (!trt) { | 131 if (!trt) { |
| 132 GrVkImage::DestroyImageInfo(gpu, &info); | 132 GrVkImage::DestroyImageInfo(gpu, &info); |
| 133 } | 133 } |
| 134 | 134 |
| 135 return trt; | 135 return trt; |
| 136 } | 136 } |
| 137 | 137 |
| 138 GrVkTextureRenderTarget* | 138 sk_sp<GrVkTextureRenderTarget> |
| 139 GrVkTextureRenderTarget::CreateWrappedTextureRenderTarget(GrVkGpu* gpu, | 139 GrVkTextureRenderTarget::MakeWrappedTextureRenderTarget(GrVkGpu* gpu, |
| 140 const GrSurfaceDesc& d
esc, | 140 const GrSurfaceDesc& des
c, |
| 141 GrWrapOwnership owners
hip, | 141 GrWrapOwnership ownershi
p, |
| 142 const GrVkImageInfo* i
nfo) { | 142 const GrVkImageInfo* inf
o) { |
| 143 SkASSERT(info); | 143 SkASSERT(info); |
| 144 // Wrapped textures require both image and allocation (because they can be m
apped) | 144 // Wrapped textures require both image and allocation (because they can be m
apped) |
| 145 SkASSERT(VK_NULL_HANDLE != info->fImage && VK_NULL_HANDLE != info->fAlloc.fM
emory); | 145 SkASSERT(VK_NULL_HANDLE != info->fImage && VK_NULL_HANDLE != info->fAlloc.fM
emory); |
| 146 | 146 |
| 147 GrVkImage::Wrapped wrapped = kBorrow_GrWrapOwnership == ownership ? GrVkImag
e::kBorrowed_Wrapped | 147 GrVkImage::Wrapped wrapped = kBorrow_GrWrapOwnership == ownership ? GrVkImag
e::kBorrowed_Wrapped |
| 148 : GrVkImag
e::kAdopted_Wrapped; | 148 : GrVkImag
e::kAdopted_Wrapped; |
| 149 | 149 |
| 150 GrVkTextureRenderTarget* trt = Create(gpu, desc, *info, SkBudgeted::kNo, wra
pped); | 150 return sk_sp<GrVkTextureRenderTarget>(Create(gpu, desc, *info, SkBudgeted::k
No, wrapped)); |
| 151 | |
| 152 return trt; | |
| 153 } | 151 } |
| 154 | 152 |
| 155 bool GrVkTextureRenderTarget::updateForMipmap(GrVkGpu* gpu, const GrVkImageInfo&
newInfo) { | 153 bool GrVkTextureRenderTarget::updateForMipmap(GrVkGpu* gpu, const GrVkImageInfo&
newInfo) { |
| 156 VkFormat pixelFormat; | 154 VkFormat pixelFormat; |
| 157 GrPixelConfigToVkFormat(fDesc.fConfig, &pixelFormat); | 155 GrPixelConfigToVkFormat(fDesc.fConfig, &pixelFormat); |
| 158 if (fDesc.fSampleCnt) { | 156 if (fDesc.fSampleCnt) { |
| 159 const GrVkImageView* resolveAttachmentView = | 157 const GrVkImageView* resolveAttachmentView = |
| 160 GrVkImageView::Create(gpu, | 158 GrVkImageView::Create(gpu, |
| 161 newInfo.fImage, | 159 newInfo.fImage, |
| 162 pixelFormat, | 160 pixelFormat, |
| (...skipping 14 matching lines...) Expand all Loading... |
| 177 return false; | 175 return false; |
| 178 } | 176 } |
| 179 fColorAttachmentView->unref(gpu); | 177 fColorAttachmentView->unref(gpu); |
| 180 fColorAttachmentView = colorAttachmentView; | 178 fColorAttachmentView = colorAttachmentView; |
| 181 } | 179 } |
| 182 | 180 |
| 183 this->createFramebuffer(gpu); | 181 this->createFramebuffer(gpu); |
| 184 return true; | 182 return true; |
| 185 } | 183 } |
| 186 | 184 |
| OLD | NEW |