2015-05-22 21:01:46 +00:00
|
|
|
/*
|
|
|
|
* Copyright 2015 Google Inc.
|
|
|
|
*
|
|
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
|
|
* found in the LICENSE file.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef GrContextOptions_DEFINED
|
|
|
|
#define GrContextOptions_DEFINED
|
|
|
|
|
|
|
|
#include "SkTypes.h"
|
|
|
|
|
|
|
|
struct GrContextOptions {
|
2015-05-27 20:23:23 +00:00
|
|
|
GrContextOptions()
|
2016-05-13 12:47:23 +00:00
|
|
|
: fSuppressPrints(false)
|
2015-05-27 22:08:33 +00:00
|
|
|
, fMaxTextureSizeOverride(SK_MaxS32)
|
2015-11-02 19:36:52 +00:00
|
|
|
, fMaxTileSizeOverride(0)
|
2015-05-29 13:46:47 +00:00
|
|
|
, fSuppressDualSourceBlending(false)
|
2016-03-25 19:15:03 +00:00
|
|
|
, fBufferMapThreshold(-1)
|
2015-10-23 16:06:59 +00:00
|
|
|
, fUseDrawInsteadOfPartialRenderTargetWrite(false)
|
2015-11-04 12:23:53 +00:00
|
|
|
, fImmediateMode(false)
|
2015-11-30 21:27:47 +00:00
|
|
|
, fClipBatchToBounds(false)
|
2015-12-03 20:58:06 +00:00
|
|
|
, fDrawBatchBounds(false)
|
2015-12-14 20:13:09 +00:00
|
|
|
, fMaxBatchLookback(-1)
|
2016-03-07 19:50:44 +00:00
|
|
|
, fMaxBatchLookahead(-1)
|
2016-06-09 20:11:08 +00:00
|
|
|
, fUseShaderSwizzling(false)
|
2016-07-29 15:14:20 +00:00
|
|
|
, fDoManualMipmapping(false)
|
|
|
|
, fEnableInstancedRendering(false) {}
|
2015-05-22 21:01:46 +00:00
|
|
|
|
|
|
|
// Suppress prints for the GrContext.
|
|
|
|
bool fSuppressPrints;
|
2015-05-27 20:23:23 +00:00
|
|
|
|
|
|
|
/** Overrides: These options override feature detection using backend API queries. These
|
|
|
|
overrides can only reduce the feature set or limits, never increase them beyond the
|
|
|
|
detected values. */
|
|
|
|
|
2015-05-27 22:08:33 +00:00
|
|
|
int fMaxTextureSizeOverride;
|
2015-11-02 19:36:52 +00:00
|
|
|
/** If non-zero, overrides the maximum size of a tile for sw-backed images and bitmaps rendered
|
|
|
|
by SkGpuDevice. */
|
|
|
|
int fMaxTileSizeOverride;
|
2015-05-27 22:08:33 +00:00
|
|
|
bool fSuppressDualSourceBlending;
|
2015-05-29 13:46:47 +00:00
|
|
|
|
2015-06-01 21:17:47 +00:00
|
|
|
/** the threshold in bytes above which we will use a buffer mapping API to map vertex and index
|
|
|
|
buffers to CPU memory in order to update them. A value of -1 means the GrContext should
|
|
|
|
deduce the optimal value for this platform. */
|
2016-03-25 19:15:03 +00:00
|
|
|
int fBufferMapThreshold;
|
2015-06-18 21:18:02 +00:00
|
|
|
|
|
|
|
/** some gpus have problems with partial writes of the rendertarget */
|
|
|
|
bool fUseDrawInsteadOfPartialRenderTargetWrite;
|
2015-10-23 16:06:59 +00:00
|
|
|
|
2015-11-30 21:27:47 +00:00
|
|
|
/** The GrContext operates in immediate mode. It will issue all draws to the backend API
|
2015-10-23 16:06:59 +00:00
|
|
|
immediately. Intended to ease debugging. */
|
|
|
|
bool fImmediateMode;
|
2015-11-04 12:23:53 +00:00
|
|
|
|
2015-11-30 21:27:47 +00:00
|
|
|
/** For debugging purposes turn each GrBatch's bounds into a clip rect. This is used to
|
|
|
|
verify that the clip bounds are conservative. */
|
|
|
|
bool fClipBatchToBounds;
|
|
|
|
|
2015-12-03 20:58:06 +00:00
|
|
|
/** For debugging purposes draw a wireframe device bounds rect for each GrBatch. The wire
|
|
|
|
frame rect is draw before the GrBatch in order to visualize batches that draw outside
|
|
|
|
of their dev bounds. */
|
|
|
|
bool fDrawBatchBounds;
|
|
|
|
|
2016-03-07 19:50:44 +00:00
|
|
|
/** For debugging, override the default maximum look-back or look-ahead window for GrBatch
|
|
|
|
combining. */
|
2015-12-14 20:13:09 +00:00
|
|
|
int fMaxBatchLookback;
|
2016-03-07 19:50:44 +00:00
|
|
|
int fMaxBatchLookahead;
|
2015-12-14 20:13:09 +00:00
|
|
|
|
2015-11-04 12:23:53 +00:00
|
|
|
/** Force us to do all swizzling manually in the shader and don't rely on extensions to do
|
|
|
|
swizzling. */
|
|
|
|
bool fUseShaderSwizzling;
|
2016-06-09 20:11:08 +00:00
|
|
|
|
|
|
|
/** Construct mipmaps manually, via repeated downsampling draw-calls. This is used when
|
|
|
|
the driver's implementation (glGenerateMipmap) contains bugs. This requires mipmap
|
|
|
|
level and LOD control (ie desktop or ES3). */
|
|
|
|
bool fDoManualMipmapping;
|
2016-07-29 15:14:20 +00:00
|
|
|
|
|
|
|
/** Enable instanced rendering as long as all required functionality is supported by the HW.
|
|
|
|
Instanced rendering is still experimental at this point and disabled by default. */
|
|
|
|
bool fEnableInstancedRendering;
|
2015-05-22 21:01:46 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|