blob: 3c7fd6ae8c1cf8c6e7a669f48153c4a152c3c500 [file] [log] [blame]
bsalomon@google.comc26d94f2013-03-25 18:19:00 +00001
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.org73880512013-10-14 15:33:45 +000010#include "GrTypes.h"
bsalomon@google.comc26d94f2013-03-25 18:19:00 +000011
12#ifndef GrDrawTargetCaps_DEFINED
13#define GrDrawTargetCaps_DEFINED
14
15/**
16 * Represents the draw target capabilities.
17 */
18class GrDrawTargetCaps : public SkRefCnt {
19public:
20 SK_DECLARE_INST_COUNT(Caps)
21
22 GrDrawTargetCaps() { this->reset(); }
commit-bot@chromium.orgfaa5ae42013-07-23 11:13:56 +000023 GrDrawTargetCaps(const GrDrawTargetCaps& other) : INHERITED() { *this = other; }
bsalomon@google.comc26d94f2013-03-25 18:19:00 +000024 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.orgc4dc0ad2013-10-09 14:11:33 +000038 bool pathRenderingSupport() const { return fPathRenderingSupport; }
bsalomon@google.com6b0cf022013-05-03 13:35:14 +000039 bool dstReadInShaderSupport() const { return fDstReadInShaderSupport; }
robertphillips@google.com2d2e5c42013-10-30 21:30:43 +000040
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.orgb8356522013-07-18 22:26:39 +000045 bool reuseScratchTextures() const { return fReuseScratchTextures; }
bsalomon@google.comc26d94f2013-03-25 18:19:00 +000046
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.org6b7938f2013-10-15 14:18:16 +000052 bool isConfigRenderable(GrPixelConfig config, bool withMSAA) const {
commit-bot@chromium.org73880512013-10-14 15:33:45 +000053 SkASSERT(kGrPixelConfigCnt > config);
commit-bot@chromium.org6b7938f2013-10-15 14:18:16 +000054 return fConfigRenderSupport[config][withMSAA];
commit-bot@chromium.org73880512013-10-14 15:33:45 +000055 }
56
bsalomon@google.comc26d94f2013-03-25 18:19:00 +000057protected:
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.orgc4dc0ad2013-10-09 14:11:33 +000067 bool fPathRenderingSupport : 1;
bsalomon@google.com6b0cf022013-05-03 13:35:14 +000068 bool fDstReadInShaderSupport : 1;
commit-bot@chromium.orgb8356522013-07-18 22:26:39 +000069 bool fReuseScratchTextures : 1;
bsalomon@google.comc26d94f2013-03-25 18:19:00 +000070
71 int fMaxRenderTargetSize;
72 int fMaxTextureSize;
73 int fMaxSampleCount;
74
commit-bot@chromium.org6b7938f2013-10-15 14:18:16 +000075 // The first entry for each config is without msaa and the second is with.
76 bool fConfigRenderSupport[kGrPixelConfigCnt][2];
commit-bot@chromium.org73880512013-10-14 15:33:45 +000077
bsalomon@google.comc26d94f2013-03-25 18:19:00 +000078 typedef SkRefCnt INHERITED;
79};
80
81#endif