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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 VK_IMAGE_USAGE_TRANSFER_DST_BIT; | 44 VK_IMAGE_USAGE_TRANSFER_DST_BIT; |
45 imageDesc.fMemProps = VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT; | 45 imageDesc.fMemProps = VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT; |
46 | 46 |
47 const GrVkImage::Resource* imageResource = GrVkImage::CreateResource(gpu, im
ageDesc); | 47 const GrVkImage::Resource* imageResource = GrVkImage::CreateResource(gpu, im
ageDesc); |
48 if (!imageResource) { | 48 if (!imageResource) { |
49 return nullptr; | 49 return nullptr; |
50 } | 50 } |
51 | 51 |
52 const GrVkImageView* imageView = GrVkImageView::Create(gpu, imageResource->f
Image, | 52 const GrVkImageView* imageView = GrVkImageView::Create(gpu, imageResource->f
Image, |
53 format.fInternalForma
t, | 53 format.fInternalForma
t, |
54 GrVkImageView::kStenc
il_Type); | 54 GrVkImageView::kStenc
il_Type, 1); |
55 if (!imageView) { | 55 if (!imageView) { |
56 imageResource->unref(gpu); | 56 imageResource->unref(gpu); |
57 return nullptr; | 57 return nullptr; |
58 } | 58 } |
59 | 59 |
60 GrVkStencilAttachment* stencil = new GrVkStencilAttachment(gpu, format, imag
eDesc, | 60 GrVkStencilAttachment* stencil = new GrVkStencilAttachment(gpu, format, imag
eDesc, |
61 imageResource, im
ageView); | 61 imageResource, im
ageView); |
62 imageResource->unref(gpu); | 62 imageResource->unref(gpu); |
63 imageView->unref(gpu); | 63 imageView->unref(gpu); |
64 | 64 |
(...skipping 27 matching lines...) Expand all Loading... |
92 this->abandonImage(); | 92 this->abandonImage(); |
93 fStencilView->unrefAndAbandon(); | 93 fStencilView->unrefAndAbandon(); |
94 fStencilView = nullptr; | 94 fStencilView = nullptr; |
95 GrStencilAttachment::onAbandon(); | 95 GrStencilAttachment::onAbandon(); |
96 } | 96 } |
97 | 97 |
98 GrVkGpu* GrVkStencilAttachment::getVkGpu() const { | 98 GrVkGpu* GrVkStencilAttachment::getVkGpu() const { |
99 SkASSERT(!this->wasDestroyed()); | 99 SkASSERT(!this->wasDestroyed()); |
100 return static_cast<GrVkGpu*>(this->getGpu()); | 100 return static_cast<GrVkGpu*>(this->getGpu()); |
101 } | 101 } |
OLD | NEW |