bsalomon | 682c269 | 2015-05-22 14:01:46 -0700 | [diff] [blame] | 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 | |
| 13 | struct GrContextOptions { |
bsalomon | 4ee6bd8 | 2015-05-27 13:23:23 -0700 | [diff] [blame] | 14 | GrContextOptions() |
| 15 | : fDrawPathToCompressedTexture(false) |
| 16 | , fSuppressPrints(false) |
cdalton | 6fd158e | 2015-05-27 15:08:33 -0700 | [diff] [blame] | 17 | , fMaxTextureSizeOverride(SK_MaxS32) |
bsalomon | 8c07b7a | 2015-11-02 11:36:52 -0800 | [diff] [blame] | 18 | , fMaxTileSizeOverride(0) |
joshualitt | 7224c86 | 2015-05-29 06:46:47 -0700 | [diff] [blame] | 19 | , fSuppressDualSourceBlending(false) |
joshualitt | 83bc229 | 2015-06-18 14:18:02 -0700 | [diff] [blame] | 20 | , fGeometryBufferMapThreshold(-1) |
bsalomon | 648c696 | 2015-10-23 09:06:59 -0700 | [diff] [blame] | 21 | , fUseDrawInsteadOfPartialRenderTargetWrite(false) |
egdaniel | b7e7d57 | 2015-11-04 04:23:53 -0800 | [diff] [blame] | 22 | , fImmediateMode(false) |
bsalomon | 69cfe95 | 2015-11-30 13:27:47 -0800 | [diff] [blame] | 23 | , fClipBatchToBounds(false) |
bsalomon | 6dea83f | 2015-12-03 12:58:06 -0800 | [diff] [blame] | 24 | , fDrawBatchBounds(false) |
bsalomon | 489147c | 2015-12-14 12:13:09 -0800 | [diff] [blame^] | 25 | , fMaxBatchLookback(-1) |
egdaniel | b7e7d57 | 2015-11-04 04:23:53 -0800 | [diff] [blame] | 26 | , fUseShaderSwizzling(false) {} |
bsalomon | 682c269 | 2015-05-22 14:01:46 -0700 | [diff] [blame] | 27 | |
| 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; |
bsalomon | 4ee6bd8 | 2015-05-27 13:23:23 -0700 | [diff] [blame] | 32 | |
bsalomon | 682c269 | 2015-05-22 14:01:46 -0700 | [diff] [blame] | 33 | // Suppress prints for the GrContext. |
| 34 | bool fSuppressPrints; |
bsalomon | 4ee6bd8 | 2015-05-27 13:23:23 -0700 | [diff] [blame] | 35 | |
| 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 | |
cdalton | 6fd158e | 2015-05-27 15:08:33 -0700 | [diff] [blame] | 40 | int fMaxTextureSizeOverride; |
bsalomon | 8c07b7a | 2015-11-02 11:36:52 -0800 | [diff] [blame] | 41 | /** If non-zero, overrides the maximum size of a tile for sw-backed images and bitmaps rendered |
| 42 | by SkGpuDevice. */ |
| 43 | int fMaxTileSizeOverride; |
cdalton | 6fd158e | 2015-05-27 15:08:33 -0700 | [diff] [blame] | 44 | bool fSuppressDualSourceBlending; |
joshualitt | 7224c86 | 2015-05-29 06:46:47 -0700 | [diff] [blame] | 45 | |
joshualitt | e5b74c6 | 2015-06-01 14:17:47 -0700 | [diff] [blame] | 46 | /** 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; |
joshualitt | 83bc229 | 2015-06-18 14:18:02 -0700 | [diff] [blame] | 50 | |
| 51 | /** some gpus have problems with partial writes of the rendertarget */ |
| 52 | bool fUseDrawInsteadOfPartialRenderTargetWrite; |
bsalomon | 648c696 | 2015-10-23 09:06:59 -0700 | [diff] [blame] | 53 | |
bsalomon | 69cfe95 | 2015-11-30 13:27:47 -0800 | [diff] [blame] | 54 | /** The GrContext operates in immediate mode. It will issue all draws to the backend API |
bsalomon | 648c696 | 2015-10-23 09:06:59 -0700 | [diff] [blame] | 55 | immediately. Intended to ease debugging. */ |
| 56 | bool fImmediateMode; |
egdaniel | b7e7d57 | 2015-11-04 04:23:53 -0800 | [diff] [blame] | 57 | |
bsalomon | 69cfe95 | 2015-11-30 13:27:47 -0800 | [diff] [blame] | 58 | /** 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 | |
bsalomon | 6dea83f | 2015-12-03 12:58:06 -0800 | [diff] [blame] | 62 | /** 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 | |
bsalomon | 489147c | 2015-12-14 12:13:09 -0800 | [diff] [blame^] | 67 | /** For debugging, override the default maximum look-back window for GrBatch combining. */ |
| 68 | int fMaxBatchLookback; |
| 69 | |
egdaniel | b7e7d57 | 2015-11-04 04:23:53 -0800 | [diff] [blame] | 70 | /** Force us to do all swizzling manually in the shader and don't rely on extensions to do |
| 71 | swizzling. */ |
| 72 | bool fUseShaderSwizzling; |
bsalomon | 682c269 | 2015-05-22 14:01:46 -0700 | [diff] [blame] | 73 | }; |
| 74 | |
| 75 | #endif |