blob: 5619e3063b8ff3a127e30f0c00e83d9311262eab [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)
22 , fImmediateMode(false) {}
bsalomon682c2692015-05-22 14:01:46 -070023
24 // EXPERIMENTAL
25 // May be removed in the future, or may become standard depending
26 // on the outcomes of a variety of internal tests.
27 bool fDrawPathToCompressedTexture;
bsalomon4ee6bd82015-05-27 13:23:23 -070028
bsalomon682c2692015-05-22 14:01:46 -070029 // Suppress prints for the GrContext.
30 bool fSuppressPrints;
bsalomon4ee6bd82015-05-27 13:23:23 -070031
32 /** Overrides: These options override feature detection using backend API queries. These
33 overrides can only reduce the feature set or limits, never increase them beyond the
34 detected values. */
35
cdalton6fd158e2015-05-27 15:08:33 -070036 int fMaxTextureSizeOverride;
bsalomon8c07b7a2015-11-02 11:36:52 -080037 /** If non-zero, overrides the maximum size of a tile for sw-backed images and bitmaps rendered
38 by SkGpuDevice. */
39 int fMaxTileSizeOverride;
cdalton6fd158e2015-05-27 15:08:33 -070040 bool fSuppressDualSourceBlending;
joshualitt7224c862015-05-29 06:46:47 -070041
joshualitte5b74c62015-06-01 14:17:47 -070042 /** the threshold in bytes above which we will use a buffer mapping API to map vertex and index
43 buffers to CPU memory in order to update them. A value of -1 means the GrContext should
44 deduce the optimal value for this platform. */
45 int fGeometryBufferMapThreshold;
joshualitt83bc2292015-06-18 14:18:02 -070046
47 /** some gpus have problems with partial writes of the rendertarget */
48 bool fUseDrawInsteadOfPartialRenderTargetWrite;
bsalomon648c6962015-10-23 09:06:59 -070049
50 /** The GrContext operates in immedidate mode. It will issue all draws to the backend API
51 immediately. Intended to ease debugging. */
52 bool fImmediateMode;
bsalomon682c2692015-05-22 14:01:46 -070053};
54
55#endif