GrDrawTargetCaps.h revision 7388051d745590d7759e7ed49c233caec6bea0f7
1c26d94fd7dc0b00cd6d0e42d28285f4a38aff021bsalomon@google.com 2c26d94fd7dc0b00cd6d0e42d28285f4a38aff021bsalomon@google.com/* 3c26d94fd7dc0b00cd6d0e42d28285f4a38aff021bsalomon@google.com * Copyright 2013 Google Inc. 4c26d94fd7dc0b00cd6d0e42d28285f4a38aff021bsalomon@google.com * 5c26d94fd7dc0b00cd6d0e42d28285f4a38aff021bsalomon@google.com * Use of this source code is governed by a BSD-style license that can be 6c26d94fd7dc0b00cd6d0e42d28285f4a38aff021bsalomon@google.com * found in the LICENSE file. 7c26d94fd7dc0b00cd6d0e42d28285f4a38aff021bsalomon@google.com */ 8c26d94fd7dc0b00cd6d0e42d28285f4a38aff021bsalomon@google.com 9c26d94fd7dc0b00cd6d0e42d28285f4a38aff021bsalomon@google.com#include "SkRefCnt.h" 107388051d745590d7759e7ed49c233caec6bea0f7commit-bot@chromium.org#include "GrTypes.h" 11c26d94fd7dc0b00cd6d0e42d28285f4a38aff021bsalomon@google.com 12c26d94fd7dc0b00cd6d0e42d28285f4a38aff021bsalomon@google.com#ifndef GrDrawTargetCaps_DEFINED 13c26d94fd7dc0b00cd6d0e42d28285f4a38aff021bsalomon@google.com#define GrDrawTargetCaps_DEFINED 14c26d94fd7dc0b00cd6d0e42d28285f4a38aff021bsalomon@google.com 15c26d94fd7dc0b00cd6d0e42d28285f4a38aff021bsalomon@google.com/** 16c26d94fd7dc0b00cd6d0e42d28285f4a38aff021bsalomon@google.com * Represents the draw target capabilities. 17c26d94fd7dc0b00cd6d0e42d28285f4a38aff021bsalomon@google.com */ 18c26d94fd7dc0b00cd6d0e42d28285f4a38aff021bsalomon@google.comclass GrDrawTargetCaps : public SkRefCnt { 19c26d94fd7dc0b00cd6d0e42d28285f4a38aff021bsalomon@google.compublic: 20c26d94fd7dc0b00cd6d0e42d28285f4a38aff021bsalomon@google.com SK_DECLARE_INST_COUNT(Caps) 21c26d94fd7dc0b00cd6d0e42d28285f4a38aff021bsalomon@google.com 22c26d94fd7dc0b00cd6d0e42d28285f4a38aff021bsalomon@google.com GrDrawTargetCaps() { this->reset(); } 23faa5ae456d184202993a5dbe782a3a95acc25326commit-bot@chromium.org GrDrawTargetCaps(const GrDrawTargetCaps& other) : INHERITED() { *this = other; } 24c26d94fd7dc0b00cd6d0e42d28285f4a38aff021bsalomon@google.com GrDrawTargetCaps& operator= (const GrDrawTargetCaps&); 25c26d94fd7dc0b00cd6d0e42d28285f4a38aff021bsalomon@google.com 26c26d94fd7dc0b00cd6d0e42d28285f4a38aff021bsalomon@google.com virtual void reset(); 27c26d94fd7dc0b00cd6d0e42d28285f4a38aff021bsalomon@google.com virtual void print() const; 28c26d94fd7dc0b00cd6d0e42d28285f4a38aff021bsalomon@google.com 29c26d94fd7dc0b00cd6d0e42d28285f4a38aff021bsalomon@google.com bool eightBitPaletteSupport() const { return f8BitPaletteSupport; } 30c26d94fd7dc0b00cd6d0e42d28285f4a38aff021bsalomon@google.com bool npotTextureTileSupport() const { return fNPOTTextureTileSupport; } 31c26d94fd7dc0b00cd6d0e42d28285f4a38aff021bsalomon@google.com bool twoSidedStencilSupport() const { return fTwoSidedStencilSupport; } 32c26d94fd7dc0b00cd6d0e42d28285f4a38aff021bsalomon@google.com bool stencilWrapOpsSupport() const { return fStencilWrapOpsSupport; } 33c26d94fd7dc0b00cd6d0e42d28285f4a38aff021bsalomon@google.com bool hwAALineSupport() const { return fHWAALineSupport; } 34c26d94fd7dc0b00cd6d0e42d28285f4a38aff021bsalomon@google.com bool shaderDerivativeSupport() const { return fShaderDerivativeSupport; } 35c26d94fd7dc0b00cd6d0e42d28285f4a38aff021bsalomon@google.com bool geometryShaderSupport() const { return fGeometryShaderSupport; } 36c26d94fd7dc0b00cd6d0e42d28285f4a38aff021bsalomon@google.com bool dualSourceBlendingSupport() const { return fDualSourceBlendingSupport; } 37c26d94fd7dc0b00cd6d0e42d28285f4a38aff021bsalomon@google.com bool bufferLockSupport() const { return fBufferLockSupport; } 38c4dc0ad8e252a7e30d19b47d3d0d9f2c69faf854commit-bot@chromium.org bool pathRenderingSupport() const { return fPathRenderingSupport; } 396b0cf0273fdffbbdf69235b57b5b5a311e7f1ca6bsalomon@google.com bool dstReadInShaderSupport() const { return fDstReadInShaderSupport; } 40b835652599356556401b68ac26b57044160a7289commit-bot@chromium.org bool reuseScratchTextures() const { return fReuseScratchTextures; } 41c26d94fd7dc0b00cd6d0e42d28285f4a38aff021bsalomon@google.com 42c26d94fd7dc0b00cd6d0e42d28285f4a38aff021bsalomon@google.com int maxRenderTargetSize() const { return fMaxRenderTargetSize; } 43c26d94fd7dc0b00cd6d0e42d28285f4a38aff021bsalomon@google.com int maxTextureSize() const { return fMaxTextureSize; } 44c26d94fd7dc0b00cd6d0e42d28285f4a38aff021bsalomon@google.com // Will be 0 if MSAA is not supported 45c26d94fd7dc0b00cd6d0e42d28285f4a38aff021bsalomon@google.com int maxSampleCount() const { return fMaxSampleCount; } 46c26d94fd7dc0b00cd6d0e42d28285f4a38aff021bsalomon@google.com 477388051d745590d7759e7ed49c233caec6bea0f7commit-bot@chromium.org /** 487388051d745590d7759e7ed49c233caec6bea0f7commit-bot@chromium.org * Can the provided configuration act as a render target? 497388051d745590d7759e7ed49c233caec6bea0f7commit-bot@chromium.org */ 507388051d745590d7759e7ed49c233caec6bea0f7commit-bot@chromium.org bool isConfigRenderable(GrPixelConfig config) const { 517388051d745590d7759e7ed49c233caec6bea0f7commit-bot@chromium.org SkASSERT(kGrPixelConfigCnt > config); 527388051d745590d7759e7ed49c233caec6bea0f7commit-bot@chromium.org return fConfigRenderSupport[config]; 537388051d745590d7759e7ed49c233caec6bea0f7commit-bot@chromium.org } 547388051d745590d7759e7ed49c233caec6bea0f7commit-bot@chromium.org 55c26d94fd7dc0b00cd6d0e42d28285f4a38aff021bsalomon@google.comprotected: 56c26d94fd7dc0b00cd6d0e42d28285f4a38aff021bsalomon@google.com bool f8BitPaletteSupport : 1; 57c26d94fd7dc0b00cd6d0e42d28285f4a38aff021bsalomon@google.com bool fNPOTTextureTileSupport : 1; 58c26d94fd7dc0b00cd6d0e42d28285f4a38aff021bsalomon@google.com bool fTwoSidedStencilSupport : 1; 59c26d94fd7dc0b00cd6d0e42d28285f4a38aff021bsalomon@google.com bool fStencilWrapOpsSupport : 1; 60c26d94fd7dc0b00cd6d0e42d28285f4a38aff021bsalomon@google.com bool fHWAALineSupport : 1; 61c26d94fd7dc0b00cd6d0e42d28285f4a38aff021bsalomon@google.com bool fShaderDerivativeSupport : 1; 62c26d94fd7dc0b00cd6d0e42d28285f4a38aff021bsalomon@google.com bool fGeometryShaderSupport : 1; 63c26d94fd7dc0b00cd6d0e42d28285f4a38aff021bsalomon@google.com bool fDualSourceBlendingSupport : 1; 64c26d94fd7dc0b00cd6d0e42d28285f4a38aff021bsalomon@google.com bool fBufferLockSupport : 1; 65c4dc0ad8e252a7e30d19b47d3d0d9f2c69faf854commit-bot@chromium.org bool fPathRenderingSupport : 1; 666b0cf0273fdffbbdf69235b57b5b5a311e7f1ca6bsalomon@google.com bool fDstReadInShaderSupport : 1; 67b835652599356556401b68ac26b57044160a7289commit-bot@chromium.org bool fReuseScratchTextures : 1; 68c26d94fd7dc0b00cd6d0e42d28285f4a38aff021bsalomon@google.com 69c26d94fd7dc0b00cd6d0e42d28285f4a38aff021bsalomon@google.com int fMaxRenderTargetSize; 70c26d94fd7dc0b00cd6d0e42d28285f4a38aff021bsalomon@google.com int fMaxTextureSize; 71c26d94fd7dc0b00cd6d0e42d28285f4a38aff021bsalomon@google.com int fMaxSampleCount; 72c26d94fd7dc0b00cd6d0e42d28285f4a38aff021bsalomon@google.com 737388051d745590d7759e7ed49c233caec6bea0f7commit-bot@chromium.org bool fConfigRenderSupport[kGrPixelConfigCnt]; 747388051d745590d7759e7ed49c233caec6bea0f7commit-bot@chromium.org 75c26d94fd7dc0b00cd6d0e42d28285f4a38aff021bsalomon@google.com typedef SkRefCnt INHERITED; 76c26d94fd7dc0b00cd6d0e42d28285f4a38aff021bsalomon@google.com}; 77c26d94fd7dc0b00cd6d0e42d28285f4a38aff021bsalomon@google.com 78c26d94fd7dc0b00cd6d0e42d28285f4a38aff021bsalomon@google.com#endif 79