blob: 8e6368a38960574dcede2bd88c084ff421c2025f [file] [log] [blame]
bsalomon682c2692015-05-22 14:01:46 -07001/*
2 * Copyright 2015 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8#ifndef GrContextOptions_DEFINED
9#define GrContextOptions_DEFINED
10
11#include "SkTypes.h"
12
13struct GrContextOptions {
bsalomon4ee6bd82015-05-27 13:23:23 -070014 GrContextOptions()
15 : fDrawPathToCompressedTexture(false)
16 , fSuppressPrints(false)
cdalton6fd158e2015-05-27 15:08:33 -070017 , fMaxTextureSizeOverride(SK_MaxS32)
bsalomon8c07b7a2015-11-02 11:36:52 -080018 , fMaxTileSizeOverride(0)
joshualitt7224c862015-05-29 06:46:47 -070019 , fSuppressDualSourceBlending(false)
joshualitt83bc2292015-06-18 14:18:02 -070020 , fGeometryBufferMapThreshold(-1)
bsalomon648c6962015-10-23 09:06:59 -070021 , fUseDrawInsteadOfPartialRenderTargetWrite(false)
egdanielb7e7d572015-11-04 04:23:53 -080022 , fImmediateMode(false)
bsalomon69cfe952015-11-30 13:27:47 -080023 , fClipBatchToBounds(false)
bsalomon6dea83f2015-12-03 12:58:06 -080024 , fDrawBatchBounds(false)
bsalomon489147c2015-12-14 12:13:09 -080025 , fMaxBatchLookback(-1)
egdanielb7e7d572015-11-04 04:23:53 -080026 , fUseShaderSwizzling(false) {}
bsalomon682c2692015-05-22 14:01:46 -070027
28 // EXPERIMENTAL
29 // May be removed in the future, or may become standard depending
30 // on the outcomes of a variety of internal tests.
31 bool fDrawPathToCompressedTexture;
bsalomon4ee6bd82015-05-27 13:23:23 -070032
bsalomon682c2692015-05-22 14:01:46 -070033 // Suppress prints for the GrContext.
34 bool fSuppressPrints;
bsalomon4ee6bd82015-05-27 13:23:23 -070035
36 /** Overrides: These options override feature detection using backend API queries. These
37 overrides can only reduce the feature set or limits, never increase them beyond the
38 detected values. */
39
cdalton6fd158e2015-05-27 15:08:33 -070040 int fMaxTextureSizeOverride;
bsalomon8c07b7a2015-11-02 11:36:52 -080041 /** If non-zero, overrides the maximum size of a tile for sw-backed images and bitmaps rendered
42 by SkGpuDevice. */
43 int fMaxTileSizeOverride;
cdalton6fd158e2015-05-27 15:08:33 -070044 bool fSuppressDualSourceBlending;
joshualitt7224c862015-05-29 06:46:47 -070045
joshualitte5b74c62015-06-01 14:17:47 -070046 /** the threshold in bytes above which we will use a buffer mapping API to map vertex and index
47 buffers to CPU memory in order to update them. A value of -1 means the GrContext should
48 deduce the optimal value for this platform. */
49 int fGeometryBufferMapThreshold;
joshualitt83bc2292015-06-18 14:18:02 -070050
51 /** some gpus have problems with partial writes of the rendertarget */
52 bool fUseDrawInsteadOfPartialRenderTargetWrite;
bsalomon648c6962015-10-23 09:06:59 -070053
bsalomon69cfe952015-11-30 13:27:47 -080054 /** The GrContext operates in immediate mode. It will issue all draws to the backend API
bsalomon648c6962015-10-23 09:06:59 -070055 immediately. Intended to ease debugging. */
56 bool fImmediateMode;
egdanielb7e7d572015-11-04 04:23:53 -080057
bsalomon69cfe952015-11-30 13:27:47 -080058 /** For debugging purposes turn each GrBatch's bounds into a clip rect. This is used to
59 verify that the clip bounds are conservative. */
60 bool fClipBatchToBounds;
61
bsalomon6dea83f2015-12-03 12:58:06 -080062 /** For debugging purposes draw a wireframe device bounds rect for each GrBatch. The wire
63 frame rect is draw before the GrBatch in order to visualize batches that draw outside
64 of their dev bounds. */
65 bool fDrawBatchBounds;
66
bsalomon489147c2015-12-14 12:13:09 -080067 /** For debugging, override the default maximum look-back window for GrBatch combining. */
68 int fMaxBatchLookback;
69
egdanielb7e7d572015-11-04 04:23:53 -080070 /** Force us to do all swizzling manually in the shader and don't rely on extensions to do
71 swizzling. */
72 bool fUseShaderSwizzling;
bsalomon682c2692015-05-22 14:01:46 -070073};
74
75#endif