| 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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 | 69 |
| 70 GrVkTexture* texture = Create(gpu, desc, lifeCycle, imageDesc.fFormat, image
Resource); | 70 GrVkTexture* texture = Create(gpu, desc, lifeCycle, imageDesc.fFormat, image
Resource); |
| 71 // Create() will increment the refCount of the image resource if it succeeds | 71 // Create() will increment the refCount of the image resource if it succeeds |
| 72 imageResource->unref(gpu); | 72 imageResource->unref(gpu); |
| 73 | 73 |
| 74 return texture; | 74 return texture; |
| 75 } | 75 } |
| 76 | 76 |
| 77 GrVkTexture* GrVkTexture::CreateWrappedTexture(GrVkGpu* gpu, const GrSurfaceDesc
& desc, | 77 GrVkTexture* GrVkTexture::CreateWrappedTexture(GrVkGpu* gpu, const GrSurfaceDesc
& desc, |
| 78 GrGpuResource::LifeCycle lifeCycl
e, | 78 GrGpuResource::LifeCycle lifeCycl
e, |
| 79 VkFormat format, | 79 VkFormat format, |
| 80 const GrVkTextureInfo* info) { | 80 const GrVkTextureInfo* info) { |
| 81 SkASSERT(info); | 81 SkASSERT(info); |
| 82 // Wrapped textures require both image and allocation (because they can be m
apped) | 82 // Wrapped textures require both image and allocation (because they can be m
apped) |
| 83 SkASSERT(VK_NULL_HANDLE != info->fImage && VK_NULL_HANDLE != info->fAlloc); | 83 SkASSERT(VK_NULL_HANDLE != info->fImage && VK_NULL_HANDLE != info->fAlloc); |
| 84 | 84 |
| 85 GrVkImage::Resource::Flags flags = (VK_IMAGE_TILING_LINEAR == info->fImageTi
ling) | 85 GrVkImage::Resource::Flags flags = (VK_IMAGE_TILING_LINEAR == info->fImageTi
ling) |
| 86 ? Resource::kLinearTiling_Flag : Resource::
kNo_Flags; | 86 ? Resource::kLinearTiling_Flag : Resource::
kNo_Flags; |
| 87 | 87 |
| 88 const GrVkImage::Resource* imageResource; | 88 const GrVkImage::Resource* imageResource; |
| 89 if (kBorrowed_LifeCycle == lifeCycle) { | 89 if (kBorrowed_LifeCycle == lifeCycle) { |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 | 138 |
| 139 GrBackendObject GrVkTexture::getTextureHandle() const { | 139 GrBackendObject GrVkTexture::getTextureHandle() const { |
| 140 // Currently just passing back the pointer to the Resource as the handle | 140 // Currently just passing back the pointer to the Resource as the handle |
| 141 return (GrBackendObject)&fResource; | 141 return (GrBackendObject)&fResource; |
| 142 } | 142 } |
| 143 | 143 |
| 144 GrVkGpu* GrVkTexture::getVkGpu() const { | 144 GrVkGpu* GrVkTexture::getVkGpu() const { |
| 145 SkASSERT(!this->wasDestroyed()); | 145 SkASSERT(!this->wasDestroyed()); |
| 146 return static_cast<GrVkGpu*>(this->getGpu()); | 146 return static_cast<GrVkGpu*>(this->getGpu()); |
| 147 } | 147 } |
| 148 | |
| OLD | NEW |