| 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(Caps) | 20 SK_DECLARE_INST_COUNT(Caps) |
| 21 | 21 |
| 22 GrDrawTargetCaps() { this->reset(); } | 22 GrDrawTargetCaps() { this->reset(); } |
| 23 GrDrawTargetCaps(const GrDrawTargetCaps& other) : INHERITED() { *this = othe
r; } | 23 GrDrawTargetCaps(const GrDrawTargetCaps& other) : INHERITED() { *this = othe
r; } |
| 24 GrDrawTargetCaps& operator= (const GrDrawTargetCaps&); | 24 GrDrawTargetCaps& operator= (const GrDrawTargetCaps&); |
| 25 | 25 |
| 26 virtual void reset(); | 26 virtual void reset(); |
| 27 virtual SkString dump() const; | 27 virtual SkString dump() const; |
| 28 | 28 |
| 29 bool eightBitPaletteSupport() const { return f8BitPaletteSupport; } | |
| 30 bool npotTextureTileSupport() const { return fNPOTTextureTileSupport; } | 29 bool npotTextureTileSupport() const { return fNPOTTextureTileSupport; } |
| 31 /** To avoid as-yet-unnecessary complexity we don't allow any partial suppor
t of MIP Maps (e.g. | 30 /** To avoid as-yet-unnecessary complexity we don't allow any partial suppor
t of MIP Maps (e.g. |
| 32 only for POT textures) */ | 31 only for POT textures) */ |
| 33 bool mipMapSupport() const { return fMipMapSupport; } | 32 bool mipMapSupport() const { return fMipMapSupport; } |
| 34 bool twoSidedStencilSupport() const { return fTwoSidedStencilSupport; } | 33 bool twoSidedStencilSupport() const { return fTwoSidedStencilSupport; } |
| 35 bool stencilWrapOpsSupport() const { return fStencilWrapOpsSupport; } | 34 bool stencilWrapOpsSupport() const { return fStencilWrapOpsSupport; } |
| 36 bool hwAALineSupport() const { return fHWAALineSupport; } | 35 bool hwAALineSupport() const { return fHWAALineSupport; } |
| 37 bool shaderDerivativeSupport() const { return fShaderDerivativeSupport; } | 36 bool shaderDerivativeSupport() const { return fShaderDerivativeSupport; } |
| 38 bool geometryShaderSupport() const { return fGeometryShaderSupport; } | 37 bool geometryShaderSupport() const { return fGeometryShaderSupport; } |
| 39 bool dualSourceBlendingSupport() const { return fDualSourceBlendingSupport;
} | 38 bool dualSourceBlendingSupport() const { return fDualSourceBlendingSupport;
} |
| (...skipping 25 matching lines...) Expand all Loading... |
| 65 int maxRenderTargetSize() const { return fMaxRenderTargetSize; } | 64 int maxRenderTargetSize() const { return fMaxRenderTargetSize; } |
| 66 int maxTextureSize() const { return fMaxTextureSize; } | 65 int maxTextureSize() const { return fMaxTextureSize; } |
| 67 // Will be 0 if MSAA is not supported | 66 // Will be 0 if MSAA is not supported |
| 68 int maxSampleCount() const { return fMaxSampleCount; } | 67 int maxSampleCount() const { return fMaxSampleCount; } |
| 69 | 68 |
| 70 bool isConfigRenderable(GrPixelConfig config, bool withMSAA) const { | 69 bool isConfigRenderable(GrPixelConfig config, bool withMSAA) const { |
| 71 SkASSERT(kGrPixelConfigCnt > config); | 70 SkASSERT(kGrPixelConfigCnt > config); |
| 72 return fConfigRenderSupport[config][withMSAA]; | 71 return fConfigRenderSupport[config][withMSAA]; |
| 73 } | 72 } |
| 74 | 73 |
| 75 bool compressedTextureSupport(GrCompressedFormat format) const { | 74 bool isConfigTexturable(GrPixelConfig config) const { |
| 76 SkASSERT(kGrCompressedFormatCount > format); | 75 SkASSERT(kGrPixelConfigCnt > config); |
| 77 return fCompressedFormatSupport[format]; | 76 return fConfigTextureSupport[config]; |
| 78 } | 77 } |
| 79 | 78 |
| 80 protected: | 79 protected: |
| 81 bool f8BitPaletteSupport : 1; | |
| 82 bool fNPOTTextureTileSupport : 1; | 80 bool fNPOTTextureTileSupport : 1; |
| 83 bool fMipMapSupport : 1; | 81 bool fMipMapSupport : 1; |
| 84 bool fTwoSidedStencilSupport : 1; | 82 bool fTwoSidedStencilSupport : 1; |
| 85 bool fStencilWrapOpsSupport : 1; | 83 bool fStencilWrapOpsSupport : 1; |
| 86 bool fHWAALineSupport : 1; | 84 bool fHWAALineSupport : 1; |
| 87 bool fShaderDerivativeSupport : 1; | 85 bool fShaderDerivativeSupport : 1; |
| 88 bool fGeometryShaderSupport : 1; | 86 bool fGeometryShaderSupport : 1; |
| 89 bool fDualSourceBlendingSupport : 1; | 87 bool fDualSourceBlendingSupport : 1; |
| 90 bool fPathRenderingSupport : 1; | 88 bool fPathRenderingSupport : 1; |
| 91 bool fDstReadInShaderSupport : 1; | 89 bool fDstReadInShaderSupport : 1; |
| 92 bool fDiscardRenderTargetSupport: 1; | 90 bool fDiscardRenderTargetSupport: 1; |
| 93 bool fReuseScratchTextures : 1; | 91 bool fReuseScratchTextures : 1; |
| 94 bool fGpuTracingSupport : 1; | 92 bool fGpuTracingSupport : 1; |
| 95 | 93 |
| 96 uint32_t fMapBufferFlags; | 94 uint32_t fMapBufferFlags; |
| 97 | 95 |
| 98 int fMaxRenderTargetSize; | 96 int fMaxRenderTargetSize; |
| 99 int fMaxTextureSize; | 97 int fMaxTextureSize; |
| 100 int fMaxSampleCount; | 98 int fMaxSampleCount; |
| 101 | 99 |
| 102 // The first entry for each config is without msaa and the second is with. | 100 // The first entry for each config is without msaa and the second is with. |
| 103 bool fConfigRenderSupport[kGrPixelConfigCnt][2]; | 101 bool fConfigRenderSupport[kGrPixelConfigCnt][2]; |
| 104 | 102 bool fConfigTextureSupport[kGrPixelConfigCnt]; |
| 105 bool fCompressedFormatSupport[kGrCompressedFormatCount]; | |
| 106 | 103 |
| 107 typedef SkRefCnt INHERITED; | 104 typedef SkRefCnt INHERITED; |
| 108 }; | 105 }; |
| 109 | 106 |
| 110 #endif | 107 #endif |
| OLD | NEW |