xref: /aosp_15_r20/external/skia/src/gpu/graphite/ContextOptionsPriv.h (revision c8dee2aa9b3f27cf6c858bd81872bdeb2c07ed17)
1 /*
2  * Copyright 2023 Google LLC
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 skgpu_graphite_ContextOptionsPriv_DEFINED
9 #define skgpu_graphite_ContextOptionsPriv_DEFINED
10 
11 namespace skgpu::graphite {
12 
13 /**
14  * Used to include or exclude a specific path rendering technique for testing purposes.
15  */
16 enum class PathRendererStrategy {
17     /**
18      * Graphite selects the best path rendering technique for each shape. This is the default
19      * behavior.
20      */
21     kDefault,
22 
23     /**
24      * All paths are rasterized into coverage masks using a GPU compute approach. This method
25      * always uses analytic anti-aliasing.
26      */
27     kComputeAnalyticAA,
28 
29     /**
30      * All paths are rasterized into coverage masks using a GPU compute approach. This method
31      * supports 16 and 8 sample multi-sampled anti-aliasing.
32      */
33     kComputeMSAA16,
34     kComputeMSAA8,
35 
36     /**
37      * All paths are rasterized into coverage masks using the CPU raster backend.
38      */
39     kRasterAA,
40 
41     /**
42      * Render paths using tessellation and stencil-and-cover.
43      */
44     kTessellation,
45 };
46 
47 /**
48  * Private options that are only meant for testing within Skia's tools.
49  */
50 struct ContextOptionsPriv {
51 
52     int  fMaxTextureSizeOverride = SK_MaxS32;
53 
54     /**
55      * Maximum width and height of internal texture atlases.
56      */
57     int  fMaxTextureAtlasSize = 2048;
58 
59     /**
60      * If true, will store a pointer in Recorder that points back to the Context
61      * that created it. Used by readPixels() and other methods that normally require a Context.
62      */
63     bool fStoreContextRefInRecorder = false;
64 
65     PathRendererStrategy fPathRendererStrategy = PathRendererStrategy::kDefault;
66 };
67 
68 }  // namespace skgpu::graphite
69 
70 #endif  // skgpu_graphite_ContextOptionsPriv_DEFINED
71