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 GrVkTexture_DEFINED | 8 #ifndef GrVkTexture_DEFINED |
9 #define GrVkTexture_DEFINED | 9 #define GrVkTexture_DEFINED |
10 | 10 |
11 #include "GrGpu.h" | 11 #include "GrGpu.h" |
12 #include "GrTexture.h" | 12 #include "GrTexture.h" |
13 #include "GrVkImage.h" | 13 #include "GrVkImage.h" |
14 | 14 |
15 class GrVkGpu; | 15 class GrVkGpu; |
16 class GrVkImageView; | 16 class GrVkImageView; |
17 struct GrVkTextureInfo; | 17 struct GrVkImageInfo; |
18 | 18 |
19 class GrVkTexture : public GrTexture, public virtual GrVkImage { | 19 class GrVkTexture : public GrTexture, public virtual GrVkImage { |
20 public: | 20 public: |
21 static GrVkTexture* CreateNewTexture(GrVkGpu*, SkBudgeted budgeted, const Gr
SurfaceDesc&, | 21 static GrVkTexture* CreateNewTexture(GrVkGpu*, SkBudgeted budgeted, const Gr
SurfaceDesc&, |
22 const GrVkImage::ImageDesc&); | 22 const GrVkImage::ImageDesc&); |
23 | 23 |
24 static GrVkTexture* CreateWrappedTexture(GrVkGpu*, const GrSurfaceDesc&, | 24 static GrVkTexture* CreateWrappedTexture(GrVkGpu*, const GrSurfaceDesc&, |
25 GrWrapOwnership, | 25 GrWrapOwnership, const GrVkImageInf
o*); |
26 VkFormat, const GrVkTextureInfo*); | |
27 | 26 |
28 ~GrVkTexture() override; | 27 ~GrVkTexture() override; |
29 | 28 |
30 GrBackendObject getTextureHandle() const override; | 29 GrBackendObject getTextureHandle() const override; |
31 | 30 |
32 void textureParamsModified() override {} | 31 void textureParamsModified() override {} |
33 | 32 |
34 const GrVkImageView* textureView(bool allowSRGB); | 33 const GrVkImageView* textureView(bool allowSRGB); |
35 | 34 |
36 bool reallocForMipmap(const GrVkGpu* gpu, uint32_t mipLevels); | 35 bool reallocForMipmap(const GrVkGpu* gpu, uint32_t mipLevels); |
37 | 36 |
38 protected: | 37 protected: |
39 GrVkTexture(GrVkGpu*, const GrSurfaceDesc&, | 38 GrVkTexture(GrVkGpu*, const GrSurfaceDesc&, const GrVkImageInfo&, const GrVk
ImageView*, |
40 const GrVkImage::Resource*, const GrVkImageView* imageView); | 39 GrVkImage::Wrapped wrapped); |
41 | |
42 template<typename ResourceType> | |
43 static GrVkTexture* Create(GrVkGpu*, ResourceType, const GrSurfaceDesc&, VkF
ormat, | |
44 const GrVkImage::Resource* texImpl); | |
45 | 40 |
46 GrVkGpu* getVkGpu() const; | 41 GrVkGpu* getVkGpu() const; |
47 | 42 |
48 void onAbandon() override; | 43 void onAbandon() override; |
49 void onRelease() override; | 44 void onRelease() override; |
50 | 45 |
51 private: | 46 private: |
52 enum Wrapped { kWrapped }; | 47 enum Wrapped { kWrapped }; |
53 GrVkTexture(GrVkGpu*, SkBudgeted, const GrSurfaceDesc&, | 48 GrVkTexture(GrVkGpu*, SkBudgeted, const GrSurfaceDesc&, |
54 const GrVkImage::Resource*, const GrVkImageView* imageView); | 49 const GrVkImageInfo&, const GrVkImageView* imageView); |
55 GrVkTexture(GrVkGpu*, Wrapped, const GrSurfaceDesc&, | 50 GrVkTexture(GrVkGpu*, Wrapped, const GrSurfaceDesc&, |
56 const GrVkImage::Resource*, const GrVkImageView* imageView); | 51 const GrVkImageInfo&, const GrVkImageView* imageView, GrVkImage:
:Wrapped wrapped); |
57 | 52 |
58 const GrVkImageView* fTextureView; | 53 const GrVkImageView* fTextureView; |
59 const GrVkImageView* fLinearTextureView; | 54 const GrVkImageView* fLinearTextureView; |
60 | 55 |
61 typedef GrTexture INHERITED; | 56 typedef GrTexture INHERITED; |
62 }; | 57 }; |
63 | 58 |
64 #endif | 59 #endif |
OLD | NEW |