Chromium Code Reviews| Index: src/gpu/vk/GrVkTexture.cpp |
| diff --git a/src/gpu/vk/GrVkTexture.cpp b/src/gpu/vk/GrVkTexture.cpp |
| index 91852da0a5834aafa4b41aba494bd264f35193c3..c9de63992fcbe5240291e635b7e6de99a71a9bf8 100644 |
| --- a/src/gpu/vk/GrVkTexture.cpp |
| +++ b/src/gpu/vk/GrVkTexture.cpp |
| @@ -55,13 +55,13 @@ template<typename ResourceType> |
| GrVkTexture* GrVkTexture::Create(GrVkGpu* gpu, |
| ResourceType type, |
| const GrSurfaceDesc& desc, |
| - VkFormat format, uint32_t levels, |
| + VkFormat format, |
| const GrVkImage::Resource* imageResource) { |
| VkImage image = imageResource->fImage; |
| const GrVkImageView* imageView = GrVkImageView::Create(gpu, image, format, |
| GrVkImageView::kColor_Type, |
| - levels); |
| + imageResource->fLevelCount); |
| if (!imageView) { |
| return nullptr; |
| } |
| @@ -79,8 +79,7 @@ GrVkTexture* GrVkTexture::CreateNewTexture(GrVkGpu* gpu, SkBudgeted budgeted, |
| return nullptr; |
| } |
| - GrVkTexture* texture = Create(gpu, budgeted, desc, imageDesc.fFormat, imageDesc.fLevels, |
| - imageResource); |
| + GrVkTexture* texture = Create(gpu, budgeted, desc, imageDesc.fFormat, imageResource); |
| // Create() will increment the refCount of the image resource if it succeeds |
| imageResource->unref(gpu); |
| @@ -100,20 +99,22 @@ GrVkTexture* GrVkTexture::CreateWrappedTexture(GrVkGpu* gpu, |
| ? Resource::kLinearTiling_Flag : Resource::kNo_Flags; |
| const GrVkImage::Resource* imageResource; |
| + // We have no other information so we have to assume that wrapped textures have only one level |
|
egdaniel
2016/05/03 16:01:00
so what is info->fLevelCount then?
jvanverth1
2016/05/03 16:32:28
Done.
|
| if (kBorrow_GrWrapOwnership == ownership) { |
| imageResource = new GrVkImage::BorrowedResource(info->fImage, |
| info->fAlloc, |
| - flags, |
| - info->fFormat); |
| + info->fFormat, |
| + info->fLevelCount, |
| + flags); |
| } else { |
| - imageResource = new GrVkImage::Resource(info->fImage, info->fAlloc, flags, info->fFormat); |
| + imageResource = new GrVkImage::Resource(info->fImage, info->fAlloc, info->fFormat, |
| + info->fLevelCount, flags); |
| } |
| if (!imageResource) { |
| return nullptr; |
| } |
| - // We have no other information so we have to assume that wrapped textures have only one level |
| - GrVkTexture* texture = Create(gpu, kWrapped, desc, format, 1, imageResource); |
| + GrVkTexture* texture = Create(gpu, kWrapped, desc, format, imageResource); |
| if (texture) { |
| texture->fCurrentLayout = info->fImageLayout; |
| } |