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 #ifndef GrVkStencil_DEFINED | 8 #ifndef GrVkStencil_DEFINED |
9 #define GrVkStencil_DEFINED | 9 #define GrVkStencil_DEFINED |
10 | 10 |
11 #include "GrStencilAttachment.h" | 11 #include "GrStencilAttachment.h" |
12 #include "GrVkImage.h" | 12 #include "GrVkImage.h" |
13 #include "vk/GrVkDefines.h" | 13 #include "vk/GrVkDefines.h" |
14 | 14 |
15 class GrVkImageView; | 15 class GrVkImageView; |
16 class GrVkGpu; | 16 class GrVkGpu; |
17 | 17 |
18 class GrVkStencilAttachment : public GrStencilAttachment, public GrVkImage { | 18 class GrVkStencilAttachment : public GrStencilAttachment, public GrVkImage { |
19 public: | 19 public: |
20 struct Format { | 20 struct Format { |
21 VkFormat fInternalFormat; | 21 VkFormat fInternalFormat; |
22 int fStencilBits; | 22 int fStencilBits; |
23 int fTotalBits; | 23 int fTotalBits; |
24 bool fPacked; | 24 bool fPacked; |
25 }; | 25 }; |
26 | 26 |
27 static GrVkStencilAttachment* Create(GrVkGpu* gpu, GrGpuResource::LifeCycle
lifeCycle, | 27 static GrVkStencilAttachment* Create(GrVkGpu* gpu, int width, int height, |
28 int width, int height, | |
29 int sampleCnt, const Format& format); | 28 int sampleCnt, const Format& format); |
30 | 29 |
31 ~GrVkStencilAttachment() override; | 30 ~GrVkStencilAttachment() override; |
32 | 31 |
33 const GrVkImage::Resource* imageResource() const { return this->resource();
} | 32 const GrVkImage::Resource* imageResource() const { return this->resource();
} |
34 const GrVkImageView* stencilView() const { return fStencilView; } | 33 const GrVkImageView* stencilView() const { return fStencilView; } |
35 | 34 |
36 VkFormat vkFormat() const { return fFormat.fInternalFormat; } | 35 VkFormat vkFormat() const { return fFormat.fInternalFormat; } |
37 | 36 |
38 protected: | 37 protected: |
39 void onRelease() override; | 38 void onRelease() override; |
40 void onAbandon() override; | 39 void onAbandon() override; |
41 | 40 |
42 private: | 41 private: |
43 size_t onGpuMemorySize() const override; | 42 size_t onGpuMemorySize() const override; |
44 | 43 |
45 GrVkStencilAttachment(GrVkGpu* gpu, | 44 GrVkStencilAttachment(GrVkGpu* gpu, |
46 GrGpuResource::LifeCycle lifeCycle, | |
47 const Format& format, | 45 const Format& format, |
48 const GrVkImage::ImageDesc&, | 46 const GrVkImage::ImageDesc&, |
49 const GrVkImage::Resource*, | 47 const GrVkImage::Resource*, |
50 const GrVkImageView* stencilView); | 48 const GrVkImageView* stencilView); |
51 | 49 |
52 GrVkGpu* getVkGpu() const; | 50 GrVkGpu* getVkGpu() const; |
53 | 51 |
54 Format fFormat; | 52 Format fFormat; |
55 | 53 |
56 const GrVkImageView* fStencilView; | 54 const GrVkImageView* fStencilView; |
57 }; | 55 }; |
58 | 56 |
59 #endif | 57 #endif |
OLD | NEW |