#ifndef GrDrawTargetCaps_DEFINED
#define GrDrawTargetCaps_DEFINED
#include "GrTypes.h"
#include "SkRefCnt.h"
#include "SkString.h"
class GrDrawTargetCaps : public SkRefCnt {
public:
SK_DECLARE_INST_COUNT(Caps)
GrDrawTargetCaps() { this->reset(); }
GrDrawTargetCaps(const GrDrawTargetCaps& other) : INHERITED() { *this = other; }
GrDrawTargetCaps& operator= (const GrDrawTargetCaps&);
virtual void reset();
virtual SkString dump() const;
bool npotTextureTileSupport() const { return fNPOTTextureTileSupport; }
bool mipMapSupport() const { return fMipMapSupport; }
bool twoSidedStencilSupport() const { return fTwoSidedStencilSupport; }
bool stencilWrapOpsSupport() const { return fStencilWrapOpsSupport; }
bool hwAALineSupport() const { return fHWAALineSupport; }
bool shaderDerivativeSupport() const { return fShaderDerivativeSupport; }
bool geometryShaderSupport() const { return fGeometryShaderSupport; }
bool dualSourceBlendingSupport() const { return fDualSourceBlendingSupport; }
bool pathRenderingSupport() const { return fPathRenderingSupport; }
bool dstReadInShaderSupport() const { return fDstReadInShaderSupport; }
bool discardRenderTargetSupport() const { return fDiscardRenderTargetSupport; }
bool gpuTracingSupport() const { return fGpuTracingSupport; }
enum MapFlags {
kNone_MapFlags = 0x0,
kCanMap_MapFlag = 0x1, kSubset_MapFlag = 0x2, };
uint32_t mapBufferFlags() const { return fMapBufferFlags; }
bool reuseScratchTextures() const { return fReuseScratchTextures; }
int maxRenderTargetSize() const { return fMaxRenderTargetSize; }
int maxTextureSize() const { return fMaxTextureSize; }
int maxSampleCount() const { return fMaxSampleCount; }
bool isConfigRenderable(GrPixelConfig config, bool withMSAA) const {
SkASSERT(kGrPixelConfigCnt > config);
return fConfigRenderSupport[config][withMSAA];
}
bool isConfigTexturable(GrPixelConfig config) const {
SkASSERT(kGrPixelConfigCnt > config);
return fConfigTextureSupport[config];
}
protected:
bool fNPOTTextureTileSupport : 1;
bool fMipMapSupport : 1;
bool fTwoSidedStencilSupport : 1;
bool fStencilWrapOpsSupport : 1;
bool fHWAALineSupport : 1;
bool fShaderDerivativeSupport : 1;
bool fGeometryShaderSupport : 1;
bool fDualSourceBlendingSupport : 1;
bool fPathRenderingSupport : 1;
bool fDstReadInShaderSupport : 1;
bool fDiscardRenderTargetSupport: 1;
bool fReuseScratchTextures : 1;
bool fGpuTracingSupport : 1;
uint32_t fMapBufferFlags;
int fMaxRenderTargetSize;
int fMaxTextureSize;
int fMaxSampleCount;
bool fConfigRenderSupport[kGrPixelConfigCnt][2];
bool fConfigTextureSupport[kGrPixelConfigCnt];
typedef SkRefCnt INHERITED;
};
#endif