| 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 "GrVkStencilAttachment.h" | 8 #include "GrVkStencilAttachment.h" |
| 9 #include "GrVkGpu.h" | 9 #include "GrVkGpu.h" |
| 10 #include "GrVkImage.h" | 10 #include "GrVkImage.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 int sampleCnt, | 35 int sampleCnt, |
| 36 const Format& format) { | 36 const Format& format) { |
| 37 GrVkImage::ImageDesc imageDesc; | 37 GrVkImage::ImageDesc imageDesc; |
| 38 imageDesc.fImageType = VK_IMAGE_TYPE_2D; | 38 imageDesc.fImageType = VK_IMAGE_TYPE_2D; |
| 39 imageDesc.fFormat = format.fInternalFormat; | 39 imageDesc.fFormat = format.fInternalFormat; |
| 40 imageDesc.fWidth = width; | 40 imageDesc.fWidth = width; |
| 41 imageDesc.fHeight = height; | 41 imageDesc.fHeight = height; |
| 42 imageDesc.fLevels = 1; | 42 imageDesc.fLevels = 1; |
| 43 imageDesc.fSamples = sampleCnt; | 43 imageDesc.fSamples = sampleCnt; |
| 44 imageDesc.fImageTiling = VK_IMAGE_TILING_OPTIMAL; | 44 imageDesc.fImageTiling = VK_IMAGE_TILING_OPTIMAL; |
| 45 imageDesc.fUsageFlags = VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT; | 45 imageDesc.fUsageFlags = VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT | |
| 46 VK_IMAGE_USAGE_TRANSFER_DST_BIT; |
| 46 imageDesc.fMemProps = VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT; | 47 imageDesc.fMemProps = VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT; |
| 47 | 48 |
| 48 const GrVkImage::Resource* imageResource = GrVkImage::CreateResource(gpu, im
ageDesc); | 49 const GrVkImage::Resource* imageResource = GrVkImage::CreateResource(gpu, im
ageDesc); |
| 49 if (!imageResource) { | 50 if (!imageResource) { |
| 50 return nullptr; | 51 return nullptr; |
| 51 } | 52 } |
| 52 | 53 |
| 53 const GrVkImageView* imageView = GrVkImageView::Create(gpu, imageResource->f
Image, | 54 const GrVkImageView* imageView = GrVkImageView::Create(gpu, imageResource->f
Image, |
| 54 format.fInternalForma
t, | 55 format.fInternalForma
t, |
| 55 GrVkImageView::kStenc
il_Type); | 56 GrVkImageView::kStenc
il_Type); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 this->abandonImage(); | 94 this->abandonImage(); |
| 94 fStencilView->unrefAndAbandon(); | 95 fStencilView->unrefAndAbandon(); |
| 95 fStencilView = nullptr; | 96 fStencilView = nullptr; |
| 96 GrStencilAttachment::onAbandon(); | 97 GrStencilAttachment::onAbandon(); |
| 97 } | 98 } |
| 98 | 99 |
| 99 GrVkGpu* GrVkStencilAttachment::getVkGpu() const { | 100 GrVkGpu* GrVkStencilAttachment::getVkGpu() const { |
| 100 SkASSERT(!this->wasDestroyed()); | 101 SkASSERT(!this->wasDestroyed()); |
| 101 return static_cast<GrVkGpu*>(this->getGpu()); | 102 return static_cast<GrVkGpu*>(this->getGpu()); |
| 102 } | 103 } |
| OLD | NEW |