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 | */ |
bsalomon@google.com | c26d94f | 2013-03-25 18:19:00 +0000 | [diff] [blame] | 8 | #ifndef GrDrawTargetCaps_DEFINED |
| 9 | #define GrDrawTargetCaps_DEFINED |
| 10 | |
commit-bot@chromium.org | 8b656c6 | 2013-11-21 15:23:15 +0000 | [diff] [blame] | 11 | #include "GrTypes.h" |
| 12 | #include "SkRefCnt.h" |
| 13 | #include "SkString.h" |
| 14 | |
bsalomon@google.com | c26d94f | 2013-03-25 18:19:00 +0000 | [diff] [blame] | 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(); |
commit-bot@chromium.org | 8b656c6 | 2013-11-21 15:23:15 +0000 | [diff] [blame] | 27 | virtual SkString dump() const; |
bsalomon@google.com | c26d94f | 2013-03-25 18:19:00 +0000 | [diff] [blame] | 28 | |
| 29 | bool eightBitPaletteSupport() const { return f8BitPaletteSupport; } |
| 30 | bool npotTextureTileSupport() const { return fNPOTTextureTileSupport; } |
commit-bot@chromium.org | 4744231 | 2013-12-19 16:18:01 +0000 | [diff] [blame] | 31 | /** To avoid as-yet-unnecessary complexity we don't allow any partial support of MIP Maps (e.g. |
| 32 | only for POT textures) */ |
| 33 | bool mipMapSupport() const { return fMipMapSupport; } |
bsalomon@google.com | c26d94f | 2013-03-25 18:19:00 +0000 | [diff] [blame] | 34 | bool twoSidedStencilSupport() const { return fTwoSidedStencilSupport; } |
| 35 | bool stencilWrapOpsSupport() const { return fStencilWrapOpsSupport; } |
| 36 | bool hwAALineSupport() const { return fHWAALineSupport; } |
| 37 | bool shaderDerivativeSupport() const { return fShaderDerivativeSupport; } |
| 38 | bool geometryShaderSupport() const { return fGeometryShaderSupport; } |
| 39 | bool dualSourceBlendingSupport() const { return fDualSourceBlendingSupport; } |
| 40 | bool bufferLockSupport() const { return fBufferLockSupport; } |
commit-bot@chromium.org | c4dc0ad | 2013-10-09 14:11:33 +0000 | [diff] [blame] | 41 | bool pathRenderingSupport() const { return fPathRenderingSupport; } |
bsalomon@google.com | 6b0cf02 | 2013-05-03 13:35:14 +0000 | [diff] [blame] | 42 | bool dstReadInShaderSupport() const { return fDstReadInShaderSupport; } |
commit-bot@chromium.org | 28361fa | 2014-03-28 16:08:05 +0000 | [diff] [blame] | 43 | bool discardRenderTargetSupport() const { return fDiscardRenderTargetSupport; } |
commit-bot@chromium.org | a3baf3b | 2014-02-21 18:45:30 +0000 | [diff] [blame] | 44 | bool gpuTracingSupport() const { return fGpuTracingSupport; } |
robertphillips@google.com | 2d2e5c4 | 2013-10-30 21:30:43 +0000 | [diff] [blame] | 45 | |
| 46 | // Scratch textures not being reused means that those scratch textures |
skia.committer@gmail.com | 7ed98df | 2013-10-31 07:01:53 +0000 | [diff] [blame] | 47 | // that we upload to (i.e., don't have a render target) will not be |
robertphillips@google.com | 2d2e5c4 | 2013-10-30 21:30:43 +0000 | [diff] [blame] | 48 | // recycled in the texture cache. This is to prevent ghosting by drivers |
| 49 | // (in particular for deferred architectures). |
commit-bot@chromium.org | b835652 | 2013-07-18 22:26:39 +0000 | [diff] [blame] | 50 | bool reuseScratchTextures() const { return fReuseScratchTextures; } |
bsalomon@google.com | c26d94f | 2013-03-25 18:19:00 +0000 | [diff] [blame] | 51 | |
| 52 | int maxRenderTargetSize() const { return fMaxRenderTargetSize; } |
| 53 | int maxTextureSize() const { return fMaxTextureSize; } |
| 54 | // Will be 0 if MSAA is not supported |
| 55 | int maxSampleCount() const { return fMaxSampleCount; } |
| 56 | |
commit-bot@chromium.org | 6b7938f | 2013-10-15 14:18:16 +0000 | [diff] [blame] | 57 | bool isConfigRenderable(GrPixelConfig config, bool withMSAA) const { |
commit-bot@chromium.org | 7388051 | 2013-10-14 15:33:45 +0000 | [diff] [blame] | 58 | SkASSERT(kGrPixelConfigCnt > config); |
commit-bot@chromium.org | 6b7938f | 2013-10-15 14:18:16 +0000 | [diff] [blame] | 59 | return fConfigRenderSupport[config][withMSAA]; |
commit-bot@chromium.org | 7388051 | 2013-10-14 15:33:45 +0000 | [diff] [blame] | 60 | } |
| 61 | |
bsalomon@google.com | c26d94f | 2013-03-25 18:19:00 +0000 | [diff] [blame] | 62 | protected: |
| 63 | bool f8BitPaletteSupport : 1; |
| 64 | bool fNPOTTextureTileSupport : 1; |
commit-bot@chromium.org | 4744231 | 2013-12-19 16:18:01 +0000 | [diff] [blame] | 65 | bool fMipMapSupport : 1; |
bsalomon@google.com | c26d94f | 2013-03-25 18:19:00 +0000 | [diff] [blame] | 66 | bool fTwoSidedStencilSupport : 1; |
| 67 | bool fStencilWrapOpsSupport : 1; |
| 68 | bool fHWAALineSupport : 1; |
| 69 | bool fShaderDerivativeSupport : 1; |
| 70 | bool fGeometryShaderSupport : 1; |
| 71 | bool fDualSourceBlendingSupport : 1; |
| 72 | bool fBufferLockSupport : 1; |
commit-bot@chromium.org | c4dc0ad | 2013-10-09 14:11:33 +0000 | [diff] [blame] | 73 | bool fPathRenderingSupport : 1; |
bsalomon@google.com | 6b0cf02 | 2013-05-03 13:35:14 +0000 | [diff] [blame] | 74 | bool fDstReadInShaderSupport : 1; |
commit-bot@chromium.org | 28361fa | 2014-03-28 16:08:05 +0000 | [diff] [blame] | 75 | bool fDiscardRenderTargetSupport: 1; |
commit-bot@chromium.org | b835652 | 2013-07-18 22:26:39 +0000 | [diff] [blame] | 76 | bool fReuseScratchTextures : 1; |
commit-bot@chromium.org | a3baf3b | 2014-02-21 18:45:30 +0000 | [diff] [blame] | 77 | bool fGpuTracingSupport : 1; |
bsalomon@google.com | c26d94f | 2013-03-25 18:19:00 +0000 | [diff] [blame] | 78 | |
| 79 | int fMaxRenderTargetSize; |
| 80 | int fMaxTextureSize; |
| 81 | int fMaxSampleCount; |
| 82 | |
commit-bot@chromium.org | 6b7938f | 2013-10-15 14:18:16 +0000 | [diff] [blame] | 83 | // The first entry for each config is without msaa and the second is with. |
| 84 | bool fConfigRenderSupport[kGrPixelConfigCnt][2]; |
commit-bot@chromium.org | 7388051 | 2013-10-14 15:33:45 +0000 | [diff] [blame] | 85 | |
bsalomon@google.com | c26d94f | 2013-03-25 18:19:00 +0000 | [diff] [blame] | 86 | typedef SkRefCnt INHERITED; |
| 87 | }; |
| 88 | |
| 89 | #endif |