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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 | 46 |
47 GrVkImageInfo info; | 47 GrVkImageInfo info; |
48 if (!GrVkImage::InitImageInfo(gpu, imageDesc, &info)) { | 48 if (!GrVkImage::InitImageInfo(gpu, imageDesc, &info)) { |
49 return nullptr; | 49 return nullptr; |
50 } | 50 } |
51 | 51 |
52 const GrVkImageView* imageView = GrVkImageView::Create(gpu, info.fImage, | 52 const GrVkImageView* imageView = GrVkImageView::Create(gpu, info.fImage, |
53 format.fInternalForma
t, | 53 format.fInternalForma
t, |
54 GrVkImageView::kStenc
il_Type, 1); | 54 GrVkImageView::kStenc
il_Type, 1); |
55 if (!imageView) { | 55 if (!imageView) { |
56 VK_CALL(gpu, DestroyImage(gpu->device(), info.fImage, nullptr)); | 56 GrVkImage::DestroyImageInfo(gpu, &info); |
57 VK_CALL(gpu, FreeMemory(gpu->device(), info.fAlloc, nullptr)); | |
58 return nullptr; | 57 return nullptr; |
59 } | 58 } |
60 | 59 |
61 GrVkStencilAttachment* stencil = new GrVkStencilAttachment(gpu, format, imag
eDesc, | 60 GrVkStencilAttachment* stencil = new GrVkStencilAttachment(gpu, format, imag
eDesc, |
62 info, imageView); | 61 info, imageView); |
63 imageView->unref(gpu); | 62 imageView->unref(gpu); |
64 | 63 |
65 return stencil; | 64 return stencil; |
66 } | 65 } |
67 | 66 |
(...skipping 24 matching lines...) Expand all Loading... |
92 this->abandonImage(); | 91 this->abandonImage(); |
93 fStencilView->unrefAndAbandon(); | 92 fStencilView->unrefAndAbandon(); |
94 fStencilView = nullptr; | 93 fStencilView = nullptr; |
95 GrStencilAttachment::onAbandon(); | 94 GrStencilAttachment::onAbandon(); |
96 } | 95 } |
97 | 96 |
98 GrVkGpu* GrVkStencilAttachment::getVkGpu() const { | 97 GrVkGpu* GrVkStencilAttachment::getVkGpu() const { |
99 SkASSERT(!this->wasDestroyed()); | 98 SkASSERT(!this->wasDestroyed()); |
100 return static_cast<GrVkGpu*>(this->getGpu()); | 99 return static_cast<GrVkGpu*>(this->getGpu()); |
101 } | 100 } |
OLD | NEW |