1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/gfx/skia/trunk/src/gpu/GrDrawTargetCaps.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,87 @@ 1.4 + 1.5 +/* 1.6 + * Copyright 2013 Google Inc. 1.7 + * 1.8 + * Use of this source code is governed by a BSD-style license that can be 1.9 + * found in the LICENSE file. 1.10 + */ 1.11 +#ifndef GrDrawTargetCaps_DEFINED 1.12 +#define GrDrawTargetCaps_DEFINED 1.13 + 1.14 +#include "GrTypes.h" 1.15 +#include "SkRefCnt.h" 1.16 +#include "SkString.h" 1.17 + 1.18 +/** 1.19 + * Represents the draw target capabilities. 1.20 + */ 1.21 +class GrDrawTargetCaps : public SkRefCnt { 1.22 +public: 1.23 + SK_DECLARE_INST_COUNT(Caps) 1.24 + 1.25 + GrDrawTargetCaps() { this->reset(); } 1.26 + GrDrawTargetCaps(const GrDrawTargetCaps& other) : INHERITED() { *this = other; } 1.27 + GrDrawTargetCaps& operator= (const GrDrawTargetCaps&); 1.28 + 1.29 + virtual void reset(); 1.30 + virtual SkString dump() const; 1.31 + 1.32 + bool eightBitPaletteSupport() const { return f8BitPaletteSupport; } 1.33 + bool npotTextureTileSupport() const { return fNPOTTextureTileSupport; } 1.34 + /** To avoid as-yet-unnecessary complexity we don't allow any partial support of MIP Maps (e.g. 1.35 + only for POT textures) */ 1.36 + bool mipMapSupport() const { return fMipMapSupport; } 1.37 + bool twoSidedStencilSupport() const { return fTwoSidedStencilSupport; } 1.38 + bool stencilWrapOpsSupport() const { return fStencilWrapOpsSupport; } 1.39 + bool hwAALineSupport() const { return fHWAALineSupport; } 1.40 + bool shaderDerivativeSupport() const { return fShaderDerivativeSupport; } 1.41 + bool geometryShaderSupport() const { return fGeometryShaderSupport; } 1.42 + bool dualSourceBlendingSupport() const { return fDualSourceBlendingSupport; } 1.43 + bool bufferLockSupport() const { return fBufferLockSupport; } 1.44 + bool pathRenderingSupport() const { return fPathRenderingSupport; } 1.45 + bool dstReadInShaderSupport() const { return fDstReadInShaderSupport; } 1.46 + bool gpuTracingSupport() const { return fGpuTracingSupport; } 1.47 + 1.48 + // Scratch textures not being reused means that those scratch textures 1.49 + // that we upload to (i.e., don't have a render target) will not be 1.50 + // recycled in the texture cache. This is to prevent ghosting by drivers 1.51 + // (in particular for deferred architectures). 1.52 + bool reuseScratchTextures() const { return fReuseScratchTextures; } 1.53 + 1.54 + int maxRenderTargetSize() const { return fMaxRenderTargetSize; } 1.55 + int maxTextureSize() const { return fMaxTextureSize; } 1.56 + // Will be 0 if MSAA is not supported 1.57 + int maxSampleCount() const { return fMaxSampleCount; } 1.58 + 1.59 + bool isConfigRenderable(GrPixelConfig config, bool withMSAA) const { 1.60 + SkASSERT(kGrPixelConfigCnt > config); 1.61 + return fConfigRenderSupport[config][withMSAA]; 1.62 + } 1.63 + 1.64 +protected: 1.65 + bool f8BitPaletteSupport : 1; 1.66 + bool fNPOTTextureTileSupport : 1; 1.67 + bool fMipMapSupport : 1; 1.68 + bool fTwoSidedStencilSupport : 1; 1.69 + bool fStencilWrapOpsSupport : 1; 1.70 + bool fHWAALineSupport : 1; 1.71 + bool fShaderDerivativeSupport : 1; 1.72 + bool fGeometryShaderSupport : 1; 1.73 + bool fDualSourceBlendingSupport : 1; 1.74 + bool fBufferLockSupport : 1; 1.75 + bool fPathRenderingSupport : 1; 1.76 + bool fDstReadInShaderSupport : 1; 1.77 + bool fReuseScratchTextures : 1; 1.78 + bool fGpuTracingSupport : 1; 1.79 + 1.80 + int fMaxRenderTargetSize; 1.81 + int fMaxTextureSize; 1.82 + int fMaxSampleCount; 1.83 + 1.84 + // The first entry for each config is without msaa and the second is with. 1.85 + bool fConfigRenderSupport[kGrPixelConfigCnt][2]; 1.86 + 1.87 + typedef SkRefCnt INHERITED; 1.88 +}; 1.89 + 1.90 +#endif