OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2013 Google Inc. | 3 * Copyright 2013 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 #ifndef GrDrawTargetCaps_DEFINED | 8 #ifndef GrDrawTargetCaps_DEFINED |
9 #define GrDrawTargetCaps_DEFINED | 9 #define GrDrawTargetCaps_DEFINED |
10 | 10 |
11 #include "GrTypes.h" | 11 #include "GrTypes.h" |
12 #include "SkRefCnt.h" | 12 #include "SkRefCnt.h" |
13 #include "SkString.h" | 13 #include "SkString.h" |
14 | 14 |
15 /** | 15 /** |
16 * Represents the draw target capabilities. | 16 * Represents the draw target capabilities. |
17 */ | 17 */ |
18 class GrDrawTargetCaps : public SkRefCnt { | 18 class GrDrawTargetCaps : public SkRefCnt { |
19 public: | 19 public: |
20 SK_DECLARE_INST_COUNT(GrDrawTargetCaps) | 20 SK_DECLARE_INST_COUNT(GrDrawTargetCaps) |
21 | 21 |
22 GrDrawTargetCaps() { this->reset(); } | 22 GrDrawTargetCaps() : fUniqueID(CreateUniqueID()) { |
23 GrDrawTargetCaps(const GrDrawTargetCaps& other) : INHERITED() { *this = othe
r; } | 23 this->reset(); |
| 24 } |
| 25 GrDrawTargetCaps(const GrDrawTargetCaps& other) : INHERITED(), fUniqueID(Cre
ateUniqueID()) { |
| 26 *this = other; |
| 27 } |
24 GrDrawTargetCaps& operator= (const GrDrawTargetCaps&); | 28 GrDrawTargetCaps& operator= (const GrDrawTargetCaps&); |
25 | 29 |
26 virtual void reset(); | 30 virtual void reset(); |
27 virtual SkString dump() const; | 31 virtual SkString dump() const; |
28 | 32 |
29 bool npotTextureTileSupport() const { return fNPOTTextureTileSupport; } | 33 bool npotTextureTileSupport() const { return fNPOTTextureTileSupport; } |
30 /** To avoid as-yet-unnecessary complexity we don't allow any partial suppor
t of MIP Maps (e.g. | 34 /** To avoid as-yet-unnecessary complexity we don't allow any partial suppor
t of MIP Maps (e.g. |
31 only for POT textures) */ | 35 only for POT textures) */ |
32 bool mipMapSupport() const { return fMipMapSupport; } | 36 bool mipMapSupport() const { return fMipMapSupport; } |
33 bool twoSidedStencilSupport() const { return fTwoSidedStencilSupport; } | 37 bool twoSidedStencilSupport() const { return fTwoSidedStencilSupport; } |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 bool isConfigRenderable(GrPixelConfig config, bool withMSAA) const { | 74 bool isConfigRenderable(GrPixelConfig config, bool withMSAA) const { |
71 SkASSERT(kGrPixelConfigCnt > config); | 75 SkASSERT(kGrPixelConfigCnt > config); |
72 return fConfigRenderSupport[config][withMSAA]; | 76 return fConfigRenderSupport[config][withMSAA]; |
73 } | 77 } |
74 | 78 |
75 bool isConfigTexturable(GrPixelConfig config) const { | 79 bool isConfigTexturable(GrPixelConfig config) const { |
76 SkASSERT(kGrPixelConfigCnt > config); | 80 SkASSERT(kGrPixelConfigCnt > config); |
77 return fConfigTextureSupport[config]; | 81 return fConfigTextureSupport[config]; |
78 } | 82 } |
79 | 83 |
| 84 /** |
| 85 * Gets an id that is unique for this GrDrawTargetCaps object. It is static
in that it does |
| 86 * not change when the content of the GrDrawTargetCaps object changes. This
will never return |
| 87 * 0. |
| 88 */ |
| 89 uint32_t getUniqueID() const { return fUniqueID; } |
| 90 |
80 protected: | 91 protected: |
81 bool fNPOTTextureTileSupport : 1; | 92 bool fNPOTTextureTileSupport : 1; |
82 bool fMipMapSupport : 1; | 93 bool fMipMapSupport : 1; |
83 bool fTwoSidedStencilSupport : 1; | 94 bool fTwoSidedStencilSupport : 1; |
84 bool fStencilWrapOpsSupport : 1; | 95 bool fStencilWrapOpsSupport : 1; |
85 bool fHWAALineSupport : 1; | 96 bool fHWAALineSupport : 1; |
86 bool fShaderDerivativeSupport : 1; | 97 bool fShaderDerivativeSupport : 1; |
87 bool fGeometryShaderSupport : 1; | 98 bool fGeometryShaderSupport : 1; |
88 bool fDualSourceBlendingSupport : 1; | 99 bool fDualSourceBlendingSupport : 1; |
89 bool fPathRenderingSupport : 1; | 100 bool fPathRenderingSupport : 1; |
90 bool fDstReadInShaderSupport : 1; | 101 bool fDstReadInShaderSupport : 1; |
91 bool fDiscardRenderTargetSupport: 1; | 102 bool fDiscardRenderTargetSupport: 1; |
92 bool fReuseScratchTextures : 1; | 103 bool fReuseScratchTextures : 1; |
93 bool fGpuTracingSupport : 1; | 104 bool fGpuTracingSupport : 1; |
94 bool fCompressedTexSubImageSupport : 1; | 105 bool fCompressedTexSubImageSupport : 1; |
95 | 106 |
96 uint32_t fMapBufferFlags; | 107 uint32_t fMapBufferFlags; |
97 | 108 |
98 int fMaxRenderTargetSize; | 109 int fMaxRenderTargetSize; |
99 int fMaxTextureSize; | 110 int fMaxTextureSize; |
100 int fMaxSampleCount; | 111 int fMaxSampleCount; |
101 | 112 |
102 // The first entry for each config is without msaa and the second is with. | 113 // The first entry for each config is without msaa and the second is with. |
103 bool fConfigRenderSupport[kGrPixelConfigCnt][2]; | 114 bool fConfigRenderSupport[kGrPixelConfigCnt][2]; |
104 bool fConfigTextureSupport[kGrPixelConfigCnt]; | 115 bool fConfigTextureSupport[kGrPixelConfigCnt]; |
105 | 116 |
| 117 private: |
| 118 static uint32_t CreateUniqueID(); |
| 119 |
| 120 const uint32_t fUniqueID; |
| 121 |
106 typedef SkRefCnt INHERITED; | 122 typedef SkRefCnt INHERITED; |
107 }; | 123 }; |
108 | 124 |
109 #endif | 125 #endif |
OLD | NEW |