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 11 matching lines...) Expand all Loading... |
22 GrVkTextureRenderTarget* GrVkTextureRenderTarget::Create(GrVkGpu* gpu, | 22 GrVkTextureRenderTarget* GrVkTextureRenderTarget::Create(GrVkGpu* gpu, |
23 ResourceType resourceTy
pe, | 23 ResourceType resourceTy
pe, |
24 const GrSurfaceDesc& de
sc, | 24 const GrSurfaceDesc& de
sc, |
25 VkFormat format, | 25 VkFormat format, |
26 const GrVkImage::Resour
ce* imageResource) { | 26 const GrVkImage::Resour
ce* imageResource) { |
27 VkImage image = imageResource->fImage; | 27 VkImage image = imageResource->fImage; |
28 // Create the texture ImageView | 28 // Create the texture ImageView |
29 uint32_t mipLevels = 1; | 29 uint32_t mipLevels = 1; |
30 //TODO: does a mipmapped textureRenderTarget make sense? | 30 //TODO: does a mipmapped textureRenderTarget make sense? |
31 //if (desc.fIsMipMapped) { | 31 //if (desc.fIsMipMapped) { |
32 // mipLevels = SkMipMap::ComputeLevelCount(this->width(), this->height())
; | 32 // mipLevels = SkMipMap::ComputeLevelCount(this->width(), this->height())
+ 1; |
33 //} | 33 //} |
34 const GrVkImageView* imageView = GrVkImageView::Create(gpu, image, format, | 34 const GrVkImageView* imageView = GrVkImageView::Create(gpu, image, format, |
35 GrVkImageView::kColor
_Type, mipLevels); | 35 GrVkImageView::kColor
_Type, mipLevels); |
36 if (!imageView) { | 36 if (!imageView) { |
37 return nullptr; | 37 return nullptr; |
38 } | 38 } |
39 | 39 |
40 VkFormat pixelFormat; | 40 VkFormat pixelFormat; |
41 GrPixelConfigToVkFormat(desc.fConfig, &pixelFormat); | 41 GrPixelConfigToVkFormat(desc.fConfig, &pixelFormat); |
42 | 42 |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 } | 171 } |
172 GrVkTextureRenderTarget* trt = Create(gpu, kWrapped, desc, format, imageReso
urce); | 172 GrVkTextureRenderTarget* trt = Create(gpu, kWrapped, desc, format, imageReso
urce); |
173 if (trt) { | 173 if (trt) { |
174 trt->fCurrentLayout = info->fImageLayout; | 174 trt->fCurrentLayout = info->fImageLayout; |
175 } | 175 } |
176 // 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 |
177 imageResource->unref(gpu); | 177 imageResource->unref(gpu); |
178 | 178 |
179 return trt; | 179 return trt; |
180 } | 180 } |
OLD | NEW |