bsalomon@google.com | c26d94f | 2013-03-25 18:19:00 +0000 | [diff] [blame] | 1 | |
| 2 | /* |
| 3 | * Copyright 2013 Google Inc. |
| 4 | * |
| 5 | * Use of this source code is governed by a BSD-style license that can be |
| 6 | * found in the LICENSE file. |
| 7 | */ |
| 8 | |
| 9 | #include "SkRefCnt.h" |
commit-bot@chromium.org | 7388051 | 2013-10-14 15:33:45 +0000 | [diff] [blame] | 10 | #include "GrTypes.h" |
bsalomon@google.com | c26d94f | 2013-03-25 18:19:00 +0000 | [diff] [blame] | 11 | |
| 12 | #ifndef GrDrawTargetCaps_DEFINED |
| 13 | #define GrDrawTargetCaps_DEFINED |
| 14 | |
| 15 | /** |
| 16 | * Represents the draw target capabilities. |
| 17 | */ |
| 18 | class GrDrawTargetCaps : public SkRefCnt { |
| 19 | public: |
| 20 | SK_DECLARE_INST_COUNT(Caps) |
| 21 | |
| 22 | GrDrawTargetCaps() { this->reset(); } |
commit-bot@chromium.org | faa5ae4 | 2013-07-23 11:13:56 +0000 | [diff] [blame] | 23 | GrDrawTargetCaps(const GrDrawTargetCaps& other) : INHERITED() { *this = other; } |
bsalomon@google.com | c26d94f | 2013-03-25 18:19:00 +0000 | [diff] [blame] | 24 | GrDrawTargetCaps& operator= (const GrDrawTargetCaps&); |
| 25 | |
| 26 | virtual void reset(); |
| 27 | virtual void print() const; |
| 28 | |
| 29 | bool eightBitPaletteSupport() const { return f8BitPaletteSupport; } |
| 30 | bool npotTextureTileSupport() const { return fNPOTTextureTileSupport; } |
| 31 | bool twoSidedStencilSupport() const { return fTwoSidedStencilSupport; } |
| 32 | bool stencilWrapOpsSupport() const { return fStencilWrapOpsSupport; } |
| 33 | bool hwAALineSupport() const { return fHWAALineSupport; } |
| 34 | bool shaderDerivativeSupport() const { return fShaderDerivativeSupport; } |
| 35 | bool geometryShaderSupport() const { return fGeometryShaderSupport; } |
| 36 | bool dualSourceBlendingSupport() const { return fDualSourceBlendingSupport; } |
| 37 | bool bufferLockSupport() const { return fBufferLockSupport; } |
commit-bot@chromium.org | c4dc0ad | 2013-10-09 14:11:33 +0000 | [diff] [blame] | 38 | bool pathRenderingSupport() const { return fPathRenderingSupport; } |
bsalomon@google.com | 6b0cf02 | 2013-05-03 13:35:14 +0000 | [diff] [blame] | 39 | bool dstReadInShaderSupport() const { return fDstReadInShaderSupport; } |
robertphillips@google.com | 2d2e5c4 | 2013-10-30 21:30:43 +0000 | [diff] [blame^] | 40 | |
| 41 | // Scratch textures not being reused means that those scratch textures |
| 42 | // that we upload to (i.e., don't have a render target) will not be |
| 43 | // recycled in the texture cache. This is to prevent ghosting by drivers |
| 44 | // (in particular for deferred architectures). |
commit-bot@chromium.org | b835652 | 2013-07-18 22:26:39 +0000 | [diff] [blame] | 45 | bool reuseScratchTextures() const { return fReuseScratchTextures; } |
bsalomon@google.com | c26d94f | 2013-03-25 18:19:00 +0000 | [diff] [blame] | 46 | |
| 47 | int maxRenderTargetSize() const { return fMaxRenderTargetSize; } |
| 48 | int maxTextureSize() const { return fMaxTextureSize; } |
| 49 | // Will be 0 if MSAA is not supported |
| 50 | int maxSampleCount() const { return fMaxSampleCount; } |
| 51 | |
commit-bot@chromium.org | 6b7938f | 2013-10-15 14:18:16 +0000 | [diff] [blame] | 52 | bool isConfigRenderable(GrPixelConfig config, bool withMSAA) const { |
commit-bot@chromium.org | 7388051 | 2013-10-14 15:33:45 +0000 | [diff] [blame] | 53 | SkASSERT(kGrPixelConfigCnt > config); |
commit-bot@chromium.org | 6b7938f | 2013-10-15 14:18:16 +0000 | [diff] [blame] | 54 | return fConfigRenderSupport[config][withMSAA]; |
commit-bot@chromium.org | 7388051 | 2013-10-14 15:33:45 +0000 | [diff] [blame] | 55 | } |
| 56 | |
bsalomon@google.com | c26d94f | 2013-03-25 18:19:00 +0000 | [diff] [blame] | 57 | protected: |
| 58 | bool f8BitPaletteSupport : 1; |
| 59 | bool fNPOTTextureTileSupport : 1; |
| 60 | bool fTwoSidedStencilSupport : 1; |
| 61 | bool fStencilWrapOpsSupport : 1; |
| 62 | bool fHWAALineSupport : 1; |
| 63 | bool fShaderDerivativeSupport : 1; |
| 64 | bool fGeometryShaderSupport : 1; |
| 65 | bool fDualSourceBlendingSupport : 1; |
| 66 | bool fBufferLockSupport : 1; |
commit-bot@chromium.org | c4dc0ad | 2013-10-09 14:11:33 +0000 | [diff] [blame] | 67 | bool fPathRenderingSupport : 1; |
bsalomon@google.com | 6b0cf02 | 2013-05-03 13:35:14 +0000 | [diff] [blame] | 68 | bool fDstReadInShaderSupport : 1; |
commit-bot@chromium.org | b835652 | 2013-07-18 22:26:39 +0000 | [diff] [blame] | 69 | bool fReuseScratchTextures : 1; |
bsalomon@google.com | c26d94f | 2013-03-25 18:19:00 +0000 | [diff] [blame] | 70 | |
| 71 | int fMaxRenderTargetSize; |
| 72 | int fMaxTextureSize; |
| 73 | int fMaxSampleCount; |
| 74 | |
commit-bot@chromium.org | 6b7938f | 2013-10-15 14:18:16 +0000 | [diff] [blame] | 75 | // The first entry for each config is without msaa and the second is with. |
| 76 | bool fConfigRenderSupport[kGrPixelConfigCnt][2]; |
commit-bot@chromium.org | 7388051 | 2013-10-14 15:33:45 +0000 | [diff] [blame] | 77 | |
bsalomon@google.com | c26d94f | 2013-03-25 18:19:00 +0000 | [diff] [blame] | 78 | typedef SkRefCnt INHERITED; |
| 79 | }; |
| 80 | |
| 81 | #endif |