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" |
11 #include "GrVkImageView.h" | 11 #include "GrVkImageView.h" |
12 #include "GrVkUtil.h" | 12 #include "GrVkUtil.h" |
13 | 13 |
14 #define VK_CALL(GPU, X) GR_VK_CALL(GPU->vkInterface(), X) | 14 #define VK_CALL(GPU, X) GR_VK_CALL(GPU->vkInterface(), X) |
15 | 15 |
16 GrVkStencilAttachment::GrVkStencilAttachment(GrVkGpu* gpu, | 16 GrVkStencilAttachment::GrVkStencilAttachment(GrVkGpu* gpu, |
17 const Format& format, | 17 const Format& format, |
18 const GrVkImage::ImageDesc& desc, | 18 const GrVkImage::ImageDesc& desc, |
19 const GrVkImageInfo& info, | 19 const GrVkImageInfo& info, |
20 const GrVkImageView* stencilView) | 20 const GrVkImageView* stencilView) |
21 : GrStencilAttachment(gpu, desc.fWidth, desc.fHeight, | 21 : GrStencilAttachment(gpu, desc.fWidth, desc.fHeight, format.fStencilBits, d
esc.fSamples) |
22 format.fStencilBits, desc.fSamples) | |
23 , GrVkImage(info, GrVkImage::kNot_Wrapped) | 22 , GrVkImage(info, GrVkImage::kNot_Wrapped) |
24 , fFormat(format) | 23 , fFormat(format) |
25 , fStencilView(stencilView) { | 24 , fStencilView(stencilView) { |
26 this->registerWithCache(SkBudgeted::kYes); | 25 this->registerWithCache(SkBudgeted::kYes); |
27 stencilView->ref(); | 26 stencilView->ref(); |
28 } | 27 } |
29 | 28 |
30 GrVkStencilAttachment* GrVkStencilAttachment::Create(GrVkGpu* gpu, | 29 GrVkStencilAttachment* GrVkStencilAttachment::Create(GrVkGpu* gpu, |
31 int width, | 30 int width, |
32 int height, | 31 int height, |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 this->abandonImage(); | 90 this->abandonImage(); |
92 fStencilView->unrefAndAbandon(); | 91 fStencilView->unrefAndAbandon(); |
93 fStencilView = nullptr; | 92 fStencilView = nullptr; |
94 GrStencilAttachment::onAbandon(); | 93 GrStencilAttachment::onAbandon(); |
95 } | 94 } |
96 | 95 |
97 GrVkGpu* GrVkStencilAttachment::getVkGpu() const { | 96 GrVkGpu* GrVkStencilAttachment::getVkGpu() const { |
98 SkASSERT(!this->wasDestroyed()); | 97 SkASSERT(!this->wasDestroyed()); |
99 return static_cast<GrVkGpu*>(this->getGpu()); | 98 return static_cast<GrVkGpu*>(this->getGpu()); |
100 } | 99 } |
OLD | NEW |