OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #ifndef GrContextOptions_DEFINED | 8 #ifndef GrContextOptions_DEFINED |
9 #define GrContextOptions_DEFINED | 9 #define GrContextOptions_DEFINED |
10 | 10 |
11 #include "SkTypes.h" | 11 #include "SkTypes.h" |
12 | 12 |
13 struct GrContextOptions { | 13 struct GrContextOptions { |
14 GrContextOptions() | 14 GrContextOptions() {}; |
15 : fSuppressPrints(false) | |
16 , fMaxTextureSizeOverride(SK_MaxS32) | |
17 , fMaxTileSizeOverride(0) | |
18 , fSuppressDualSourceBlending(false) | |
19 , fBufferMapThreshold(-1) | |
20 , fUseDrawInsteadOfPartialRenderTargetWrite(false) | |
21 , fImmediateMode(false) | |
22 , fClipBatchToBounds(false) | |
23 , fDrawBatchBounds(false) | |
24 , fMaxBatchLookback(-1) | |
25 , fMaxBatchLookahead(-1) | |
26 , fUseShaderSwizzling(false) | |
27 , fDoManualMipmapping(false) | |
28 , fEnableInstancedRendering(false) {} | |
29 | 15 |
30 // Suppress prints for the GrContext. | 16 // Suppress prints for the GrContext. |
31 bool fSuppressPrints; | 17 bool fSuppressPrints = false; |
32 | 18 |
33 /** Overrides: These options override feature detection using backend API qu
eries. These | 19 /** Overrides: These options override feature detection using backend API qu
eries. These |
34 overrides can only reduce the feature set or limits, never increase them
beyond the | 20 overrides can only reduce the feature set or limits, never increase them
beyond the |
35 detected values. */ | 21 detected values. */ |
36 | 22 |
37 int fMaxTextureSizeOverride; | 23 int fMaxTextureSizeOverride = SK_MaxS32; |
| 24 |
38 /** If non-zero, overrides the maximum size of a tile for sw-backed images a
nd bitmaps rendered | 25 /** If non-zero, overrides the maximum size of a tile for sw-backed images a
nd bitmaps rendered |
39 by SkGpuDevice. */ | 26 by SkGpuDevice. */ |
40 int fMaxTileSizeOverride; | 27 int fMaxTileSizeOverride = 0; |
41 bool fSuppressDualSourceBlending; | 28 bool fSuppressDualSourceBlending = false; |
42 | 29 |
43 /** the threshold in bytes above which we will use a buffer mapping API to m
ap vertex and index | 30 /** the threshold in bytes above which we will use a buffer mapping API to m
ap vertex and index |
44 buffers to CPU memory in order to update them. A value of -1 means the
GrContext should | 31 buffers to CPU memory in order to update them. A value of -1 means the
GrContext should |
45 deduce the optimal value for this platform. */ | 32 deduce the optimal value for this platform. */ |
46 int fBufferMapThreshold; | 33 int fBufferMapThreshold = -1; |
47 | 34 |
48 /** some gpus have problems with partial writes of the rendertarget */ | 35 /** some gpus have problems with partial writes of the rendertarget */ |
49 bool fUseDrawInsteadOfPartialRenderTargetWrite; | 36 bool fUseDrawInsteadOfPartialRenderTargetWrite = false; |
50 | 37 |
51 /** The GrContext operates in immediate mode. It will issue all draws to the
backend API | 38 /** The GrContext operates in immediate mode. It will issue all draws to the
backend API |
52 immediately. Intended to ease debugging. */ | 39 immediately. Intended to ease debugging. */ |
53 bool fImmediateMode; | 40 bool fImmediateMode = false; |
54 | 41 |
55 /** For debugging purposes turn each GrBatch's bounds into a clip rect. This
is used to | 42 /** For debugging purposes turn each GrBatch's bounds into a clip rect. This
is used to |
56 verify that the clip bounds are conservative. */ | 43 verify that the clip bounds are conservative. */ |
57 bool fClipBatchToBounds; | 44 bool fClipBatchToBounds = false; |
58 | 45 |
59 /** For debugging purposes draw a wireframe device bounds rect for each GrBa
tch. The wire | 46 /** For debugging purposes draw a wireframe device bounds rect for each GrBa
tch. The wire |
60 frame rect is draw before the GrBatch in order to visualize batches that
draw outside | 47 frame rect is draw before the GrBatch in order to visualize batches that
draw outside |
61 of their dev bounds. */ | 48 of their dev bounds. */ |
62 bool fDrawBatchBounds; | 49 bool fDrawBatchBounds = false; |
63 | 50 |
64 /** For debugging, override the default maximum look-back or look-ahead wind
ow for GrBatch | 51 /** For debugging, override the default maximum look-back or look-ahead wind
ow for GrBatch |
65 combining. */ | 52 combining. */ |
66 int fMaxBatchLookback; | 53 int fMaxBatchLookback = -1; |
67 int fMaxBatchLookahead; | 54 int fMaxBatchLookahead = -1; |
68 | 55 |
69 /** Force us to do all swizzling manually in the shader and don't rely on ex
tensions to do | 56 /** Force us to do all swizzling manually in the shader and don't rely on ex
tensions to do |
70 swizzling. */ | 57 swizzling. */ |
71 bool fUseShaderSwizzling; | 58 bool fUseShaderSwizzling = false; |
72 | 59 |
73 /** Construct mipmaps manually, via repeated downsampling draw-calls. This i
s used when | 60 /** Construct mipmaps manually, via repeated downsampling draw-calls. This i
s used when |
74 the driver's implementation (glGenerateMipmap) contains bugs. This requi
res mipmap | 61 the driver's implementation (glGenerateMipmap) contains bugs. This requi
res mipmap |
75 level and LOD control (ie desktop or ES3). */ | 62 level and LOD control (ie desktop or ES3). */ |
76 bool fDoManualMipmapping; | 63 bool fDoManualMipmapping = false; |
77 | 64 |
78 /** Enable instanced rendering as long as all required functionality is supp
orted by the HW. | 65 /** Enable instanced rendering as long as all required functionality is supp
orted by the HW. |
79 Instanced rendering is still experimental at this point and disabled by
default. */ | 66 Instanced rendering is still experimental at this point and disabled by
default. */ |
80 bool fEnableInstancedRendering; | 67 bool fEnableInstancedRendering = false; |
| 68 |
| 69 /** Disables distance field rendering for paths. Distance field computation
can be expensive |
| 70 and yields no benefit if a path is not rendered multiple times with diff
erent transforms */ |
| 71 bool fDisableDistanceFieldPaths = false; |
81 }; | 72 }; |
82 | 73 |
83 #endif | 74 #endif |
OLD | NEW |