michael@0: michael@0: /* michael@0: * Copyright 2013 Google Inc. michael@0: * michael@0: * Use of this source code is governed by a BSD-style license that can be michael@0: * found in the LICENSE file. michael@0: */ michael@0: #ifndef GrDrawTargetCaps_DEFINED michael@0: #define GrDrawTargetCaps_DEFINED michael@0: michael@0: #include "GrTypes.h" michael@0: #include "SkRefCnt.h" michael@0: #include "SkString.h" michael@0: michael@0: /** michael@0: * Represents the draw target capabilities. michael@0: */ michael@0: class GrDrawTargetCaps : public SkRefCnt { michael@0: public: michael@0: SK_DECLARE_INST_COUNT(Caps) michael@0: michael@0: GrDrawTargetCaps() { this->reset(); } michael@0: GrDrawTargetCaps(const GrDrawTargetCaps& other) : INHERITED() { *this = other; } michael@0: GrDrawTargetCaps& operator= (const GrDrawTargetCaps&); michael@0: michael@0: virtual void reset(); michael@0: virtual SkString dump() const; michael@0: michael@0: bool eightBitPaletteSupport() const { return f8BitPaletteSupport; } michael@0: bool npotTextureTileSupport() const { return fNPOTTextureTileSupport; } michael@0: /** To avoid as-yet-unnecessary complexity we don't allow any partial support of MIP Maps (e.g. michael@0: only for POT textures) */ michael@0: bool mipMapSupport() const { return fMipMapSupport; } michael@0: bool twoSidedStencilSupport() const { return fTwoSidedStencilSupport; } michael@0: bool stencilWrapOpsSupport() const { return fStencilWrapOpsSupport; } michael@0: bool hwAALineSupport() const { return fHWAALineSupport; } michael@0: bool shaderDerivativeSupport() const { return fShaderDerivativeSupport; } michael@0: bool geometryShaderSupport() const { return fGeometryShaderSupport; } michael@0: bool dualSourceBlendingSupport() const { return fDualSourceBlendingSupport; } michael@0: bool bufferLockSupport() const { return fBufferLockSupport; } michael@0: bool pathRenderingSupport() const { return fPathRenderingSupport; } michael@0: bool dstReadInShaderSupport() const { return fDstReadInShaderSupport; } michael@0: bool gpuTracingSupport() const { return fGpuTracingSupport; } michael@0: michael@0: // Scratch textures not being reused means that those scratch textures michael@0: // that we upload to (i.e., don't have a render target) will not be michael@0: // recycled in the texture cache. This is to prevent ghosting by drivers michael@0: // (in particular for deferred architectures). michael@0: bool reuseScratchTextures() const { return fReuseScratchTextures; } michael@0: michael@0: int maxRenderTargetSize() const { return fMaxRenderTargetSize; } michael@0: int maxTextureSize() const { return fMaxTextureSize; } michael@0: // Will be 0 if MSAA is not supported michael@0: int maxSampleCount() const { return fMaxSampleCount; } michael@0: michael@0: bool isConfigRenderable(GrPixelConfig config, bool withMSAA) const { michael@0: SkASSERT(kGrPixelConfigCnt > config); michael@0: return fConfigRenderSupport[config][withMSAA]; michael@0: } michael@0: michael@0: protected: michael@0: bool f8BitPaletteSupport : 1; michael@0: bool fNPOTTextureTileSupport : 1; michael@0: bool fMipMapSupport : 1; michael@0: bool fTwoSidedStencilSupport : 1; michael@0: bool fStencilWrapOpsSupport : 1; michael@0: bool fHWAALineSupport : 1; michael@0: bool fShaderDerivativeSupport : 1; michael@0: bool fGeometryShaderSupport : 1; michael@0: bool fDualSourceBlendingSupport : 1; michael@0: bool fBufferLockSupport : 1; michael@0: bool fPathRenderingSupport : 1; michael@0: bool fDstReadInShaderSupport : 1; michael@0: bool fReuseScratchTextures : 1; michael@0: bool fGpuTracingSupport : 1; michael@0: michael@0: int fMaxRenderTargetSize; michael@0: int fMaxTextureSize; michael@0: int fMaxSampleCount; michael@0: michael@0: // The first entry for each config is without msaa and the second is with. michael@0: bool fConfigRenderSupport[kGrPixelConfigCnt][2]; michael@0: michael@0: typedef SkRefCnt INHERITED; michael@0: }; michael@0: michael@0: #endif