GrContextOptions.h revision 69cfe95b7be386cf7d349b61388e93ea7c3cd386
1/*
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 {
14    GrContextOptions()
15        : fDrawPathToCompressedTexture(false)
16        , fSuppressPrints(false)
17        , fMaxTextureSizeOverride(SK_MaxS32)
18        , fMaxTileSizeOverride(0)
19        , fSuppressDualSourceBlending(false)
20        , fGeometryBufferMapThreshold(-1)
21        , fUseDrawInsteadOfPartialRenderTargetWrite(false)
22        , fImmediateMode(false)
23        , fClipBatchToBounds(false)
24        , fUseShaderSwizzling(false) {}
25
26    // EXPERIMENTAL
27    // May be removed in the future, or may become standard depending
28    // on the outcomes of a variety of internal tests.
29    bool fDrawPathToCompressedTexture;
30
31    // Suppress prints for the GrContext.
32    bool fSuppressPrints;
33
34    /** Overrides: These options override feature detection using backend API queries. These
35        overrides can only reduce the feature set or limits, never increase them beyond the
36        detected values. */
37
38    int  fMaxTextureSizeOverride;
39    /** If non-zero, overrides the maximum size of a tile for sw-backed images and bitmaps rendered
40        by SkGpuDevice. */
41    int  fMaxTileSizeOverride;
42    bool fSuppressDualSourceBlending;
43
44    /** the threshold in bytes above which we will use a buffer mapping API to map vertex and index
45        buffers to CPU memory in order to update them.  A value of -1 means the GrContext should
46        deduce the optimal value for this platform. */
47    int  fGeometryBufferMapThreshold;
48
49    /** some gpus have problems with partial writes of the rendertarget */
50    bool fUseDrawInsteadOfPartialRenderTargetWrite;
51
52    /** The GrContext operates in immediate mode. It will issue all draws to the backend API
53        immediately. Intended to ease debugging. */
54    bool fImmediateMode;
55
56    /** For debugging purposes turn each GrBatch's bounds into a clip rect. This is used to
57        verify that the clip bounds are conservative. */
58    bool fClipBatchToBounds;
59
60    /** Force us to do all swizzling manually in the shader and don't rely on extensions to do
61        swizzling. */
62    bool fUseShaderSwizzling;
63};
64
65#endif
66