2013-03-25 18:19:00 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Copyright 2013 Google Inc.
|
|
|
|
*
|
|
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
|
|
* found in the LICENSE file.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "SkRefCnt.h"
|
2013-10-14 15:33:45 +00:00
|
|
|
#include "GrTypes.h"
|
2013-03-25 18:19:00 +00:00
|
|
|
|
|
|
|
#ifndef GrDrawTargetCaps_DEFINED
|
|
|
|
#define GrDrawTargetCaps_DEFINED
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Represents the draw target capabilities.
|
|
|
|
*/
|
|
|
|
class GrDrawTargetCaps : public SkRefCnt {
|
|
|
|
public:
|
|
|
|
SK_DECLARE_INST_COUNT(Caps)
|
|
|
|
|
|
|
|
GrDrawTargetCaps() { this->reset(); }
|
2013-07-23 11:13:56 +00:00
|
|
|
GrDrawTargetCaps(const GrDrawTargetCaps& other) : INHERITED() { *this = other; }
|
2013-03-25 18:19:00 +00:00
|
|
|
GrDrawTargetCaps& operator= (const GrDrawTargetCaps&);
|
|
|
|
|
|
|
|
virtual void reset();
|
|
|
|
virtual void print() const;
|
|
|
|
|
|
|
|
bool eightBitPaletteSupport() const { return f8BitPaletteSupport; }
|
|
|
|
bool npotTextureTileSupport() const { return fNPOTTextureTileSupport; }
|
|
|
|
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 bufferLockSupport() const { return fBufferLockSupport; }
|
2013-10-09 14:11:33 +00:00
|
|
|
bool pathRenderingSupport() const { return fPathRenderingSupport; }
|
2013-05-03 13:35:14 +00:00
|
|
|
bool dstReadInShaderSupport() const { return fDstReadInShaderSupport; }
|
2013-10-30 21:30:43 +00:00
|
|
|
|
|
|
|
// Scratch textures not being reused means that those scratch textures
|
|
|
|
// that we upload to (i.e., don't have a render target) will not be
|
|
|
|
// recycled in the texture cache. This is to prevent ghosting by drivers
|
|
|
|
// (in particular for deferred architectures).
|
2013-07-18 22:26:39 +00:00
|
|
|
bool reuseScratchTextures() const { return fReuseScratchTextures; }
|
2013-03-25 18:19:00 +00:00
|
|
|
|
|
|
|
int maxRenderTargetSize() const { return fMaxRenderTargetSize; }
|
|
|
|
int maxTextureSize() const { return fMaxTextureSize; }
|
|
|
|
// Will be 0 if MSAA is not supported
|
|
|
|
int maxSampleCount() const { return fMaxSampleCount; }
|
|
|
|
|
2013-10-15 14:18:16 +00:00
|
|
|
bool isConfigRenderable(GrPixelConfig config, bool withMSAA) const {
|
2013-10-14 15:33:45 +00:00
|
|
|
SkASSERT(kGrPixelConfigCnt > config);
|
2013-10-15 14:18:16 +00:00
|
|
|
return fConfigRenderSupport[config][withMSAA];
|
2013-10-14 15:33:45 +00:00
|
|
|
}
|
|
|
|
|
2013-03-25 18:19:00 +00:00
|
|
|
protected:
|
|
|
|
bool f8BitPaletteSupport : 1;
|
|
|
|
bool fNPOTTextureTileSupport : 1;
|
|
|
|
bool fTwoSidedStencilSupport : 1;
|
|
|
|
bool fStencilWrapOpsSupport : 1;
|
|
|
|
bool fHWAALineSupport : 1;
|
|
|
|
bool fShaderDerivativeSupport : 1;
|
|
|
|
bool fGeometryShaderSupport : 1;
|
|
|
|
bool fDualSourceBlendingSupport : 1;
|
|
|
|
bool fBufferLockSupport : 1;
|
2013-10-09 14:11:33 +00:00
|
|
|
bool fPathRenderingSupport : 1;
|
2013-05-03 13:35:14 +00:00
|
|
|
bool fDstReadInShaderSupport : 1;
|
2013-07-18 22:26:39 +00:00
|
|
|
bool fReuseScratchTextures : 1;
|
2013-03-25 18:19:00 +00:00
|
|
|
|
|
|
|
int fMaxRenderTargetSize;
|
|
|
|
int fMaxTextureSize;
|
|
|
|
int fMaxSampleCount;
|
|
|
|
|
2013-10-15 14:18:16 +00:00
|
|
|
// The first entry for each config is without msaa and the second is with.
|
|
|
|
bool fConfigRenderSupport[kGrPixelConfigCnt][2];
|
2013-10-14 15:33:45 +00:00
|
|
|
|
2013-03-25 18:19:00 +00:00
|
|
|
typedef SkRefCnt INHERITED;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|