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 GrVkTextureInfo; |
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*, const GrSurfaceDesc&, | 21 static GrVkTexture* CreateNewTexture(GrVkGpu*, SkBudgeted budgeted, const Gr
SurfaceDesc&, |
22 GrGpuResource::LifeCycle, | |
23 const GrVkImage::ImageDesc&); | 22 const GrVkImage::ImageDesc&); |
24 | 23 |
25 static GrVkTexture* CreateWrappedTexture(GrVkGpu*, const GrSurfaceDesc&, | 24 static GrVkTexture* CreateWrappedTexture(GrVkGpu*, const GrSurfaceDesc&, |
26 GrGpuResource::LifeCycle, | 25 GrWrapOwnership, |
27 VkFormat, const GrVkTextureInfo*); | 26 VkFormat, const GrVkTextureInfo*); |
28 | 27 |
29 ~GrVkTexture() override; | 28 ~GrVkTexture() override; |
30 | 29 |
31 GrBackendObject getTextureHandle() const override; | 30 GrBackendObject getTextureHandle() const override; |
32 | 31 |
33 void textureParamsModified() override {} | 32 void textureParamsModified() override {} |
34 | 33 |
35 const GrVkImageView* textureView() const { return fTextureView; } | 34 const GrVkImageView* textureView() const { return fTextureView; } |
36 | 35 |
37 protected: | 36 protected: |
38 enum Derived { kDerived }; | 37 GrVkTexture(GrVkGpu*, const GrSurfaceDesc&, |
39 | |
40 GrVkTexture(GrVkGpu*, const GrSurfaceDesc&, GrGpuResource::LifeCycle, | |
41 const GrVkImage::Resource*, const GrVkImageView* imageView); | 38 const GrVkImage::Resource*, const GrVkImageView* imageView); |
42 | 39 |
43 GrVkTexture(GrVkGpu*, const GrSurfaceDesc&, GrGpuResource::LifeCycle, | 40 template<typename ResourceType> |
44 const GrVkImage::Resource*, const GrVkImageView* imageView, Deri
ved); | 41 static GrVkTexture* Create(GrVkGpu*, ResourceType, const GrSurfaceDesc&, VkF
ormat, |
45 | |
46 static GrVkTexture* Create(GrVkGpu*, const GrSurfaceDesc&, | |
47 GrGpuResource::LifeCycle, VkFormat, | |
48 const GrVkImage::Resource* texImpl); | 42 const GrVkImage::Resource* texImpl); |
49 | 43 |
50 GrVkGpu* getVkGpu() const; | 44 GrVkGpu* getVkGpu() const; |
51 | 45 |
52 void onAbandon() override; | 46 void onAbandon() override; |
53 void onRelease() override; | 47 void onRelease() override; |
54 | 48 |
55 private: | 49 private: |
| 50 enum Wrapped { kWrapped }; |
| 51 GrVkTexture(GrVkGpu*, SkBudgeted, const GrSurfaceDesc&, |
| 52 const GrVkImage::Resource*, const GrVkImageView* imageView); |
| 53 GrVkTexture(GrVkGpu*, Wrapped, const GrSurfaceDesc&, |
| 54 const GrVkImage::Resource*, const GrVkImageView* imageView); |
| 55 |
| 56 |
56 const GrVkImageView* fTextureView; | 57 const GrVkImageView* fTextureView; |
57 | 58 |
58 typedef GrTexture INHERITED; | 59 typedef GrTexture INHERITED; |
59 }; | 60 }; |
60 | 61 |
61 #endif | 62 #endif |
OLD | NEW |