|
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 #ifndef GrDrawTargetCaps_DEFINED |
|
9 #define GrDrawTargetCaps_DEFINED |
|
10 |
|
11 #include "GrTypes.h" |
|
12 #include "SkRefCnt.h" |
|
13 #include "SkString.h" |
|
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(); } |
|
23 GrDrawTargetCaps(const GrDrawTargetCaps& other) : INHERITED() { *this = other; } |
|
24 GrDrawTargetCaps& operator= (const GrDrawTargetCaps&); |
|
25 |
|
26 virtual void reset(); |
|
27 virtual SkString dump() const; |
|
28 |
|
29 bool eightBitPaletteSupport() const { return f8BitPaletteSupport; } |
|
30 bool npotTextureTileSupport() const { return fNPOTTextureTileSupport; } |
|
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; } |
|
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; } |
|
41 bool pathRenderingSupport() const { return fPathRenderingSupport; } |
|
42 bool dstReadInShaderSupport() const { return fDstReadInShaderSupport; } |
|
43 bool gpuTracingSupport() const { return fGpuTracingSupport; } |
|
44 |
|
45 // Scratch textures not being reused means that those scratch textures |
|
46 // that we upload to (i.e., don't have a render target) will not be |
|
47 // recycled in the texture cache. This is to prevent ghosting by drivers |
|
48 // (in particular for deferred architectures). |
|
49 bool reuseScratchTextures() const { return fReuseScratchTextures; } |
|
50 |
|
51 int maxRenderTargetSize() const { return fMaxRenderTargetSize; } |
|
52 int maxTextureSize() const { return fMaxTextureSize; } |
|
53 // Will be 0 if MSAA is not supported |
|
54 int maxSampleCount() const { return fMaxSampleCount; } |
|
55 |
|
56 bool isConfigRenderable(GrPixelConfig config, bool withMSAA) const { |
|
57 SkASSERT(kGrPixelConfigCnt > config); |
|
58 return fConfigRenderSupport[config][withMSAA]; |
|
59 } |
|
60 |
|
61 protected: |
|
62 bool f8BitPaletteSupport : 1; |
|
63 bool fNPOTTextureTileSupport : 1; |
|
64 bool fMipMapSupport : 1; |
|
65 bool fTwoSidedStencilSupport : 1; |
|
66 bool fStencilWrapOpsSupport : 1; |
|
67 bool fHWAALineSupport : 1; |
|
68 bool fShaderDerivativeSupport : 1; |
|
69 bool fGeometryShaderSupport : 1; |
|
70 bool fDualSourceBlendingSupport : 1; |
|
71 bool fBufferLockSupport : 1; |
|
72 bool fPathRenderingSupport : 1; |
|
73 bool fDstReadInShaderSupport : 1; |
|
74 bool fReuseScratchTextures : 1; |
|
75 bool fGpuTracingSupport : 1; |
|
76 |
|
77 int fMaxRenderTargetSize; |
|
78 int fMaxTextureSize; |
|
79 int fMaxSampleCount; |
|
80 |
|
81 // The first entry for each config is without msaa and the second is with. |
|
82 bool fConfigRenderSupport[kGrPixelConfigCnt][2]; |
|
83 |
|
84 typedef SkRefCnt INHERITED; |
|
85 }; |
|
86 |
|
87 #endif |