blob: b0a721cd7046a3c308fb0e96f032568c17c399cf [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; }
commit-bot@chromium.orgb8356522013-07-18 22:26:39 +000040 bool reuseScratchTextures() const { return fReuseScratchTextures; }
bsalomon@google.comc26d94f2013-03-25 18:19:00 +000041
42 int maxRenderTargetSize() const { return fMaxRenderTargetSize; }
43 int maxTextureSize() const { return fMaxTextureSize; }
44 // Will be 0 if MSAA is not supported
45 int maxSampleCount() const { return fMaxSampleCount; }
46
commit-bot@chromium.org6b7938f2013-10-15 14:18:16 +000047 bool isConfigRenderable(GrPixelConfig config, bool withMSAA) const {
commit-bot@chromium.org73880512013-10-14 15:33:45 +000048 SkASSERT(kGrPixelConfigCnt > config);
commit-bot@chromium.org6b7938f2013-10-15 14:18:16 +000049 return fConfigRenderSupport[config][withMSAA];
commit-bot@chromium.org73880512013-10-14 15:33:45 +000050 }
51
bsalomon@google.comc26d94f2013-03-25 18:19:00 +000052protected:
53 bool f8BitPaletteSupport : 1;
54 bool fNPOTTextureTileSupport : 1;
55 bool fTwoSidedStencilSupport : 1;
56 bool fStencilWrapOpsSupport : 1;
57 bool fHWAALineSupport : 1;
58 bool fShaderDerivativeSupport : 1;
59 bool fGeometryShaderSupport : 1;
60 bool fDualSourceBlendingSupport : 1;
61 bool fBufferLockSupport : 1;
commit-bot@chromium.orgc4dc0ad2013-10-09 14:11:33 +000062 bool fPathRenderingSupport : 1;
bsalomon@google.com6b0cf022013-05-03 13:35:14 +000063 bool fDstReadInShaderSupport : 1;
commit-bot@chromium.orgb8356522013-07-18 22:26:39 +000064 bool fReuseScratchTextures : 1;
bsalomon@google.comc26d94f2013-03-25 18:19:00 +000065
66 int fMaxRenderTargetSize;
67 int fMaxTextureSize;
68 int fMaxSampleCount;
69
commit-bot@chromium.org6b7938f2013-10-15 14:18:16 +000070 // The first entry for each config is without msaa and the second is with.
71 bool fConfigRenderSupport[kGrPixelConfigCnt][2];
commit-bot@chromium.org73880512013-10-14 15:33:45 +000072
bsalomon@google.comc26d94f2013-03-25 18:19:00 +000073 typedef SkRefCnt INHERITED;
74};
75
76#endif