Set GeometryBufferMapThreshold defaults

TBR=bsalomon@google.com
BUG=skia:

Review URL: https://codereview.chromium.org/1161543003
This commit is contained in:
joshualitt 2015-06-01 14:17:47 -07:00 committed by Commit bot
parent 933d9863dd
commit e5b74c6856
3 changed files with 13 additions and 7 deletions

View File

@ -203,6 +203,7 @@ public:
}
size_t geometryBufferMapThreshold() const {
SkASSERT(fGeometryBufferMapThreshold >= 0);
return fGeometryBufferMapThreshold;
}
@ -229,6 +230,7 @@ protected:
BlendEquationSupport fBlendEquationSupport;
uint32_t fMapBufferFlags;
int fGeometryBufferMapThreshold;
int fMaxRenderTargetSize;
int fMaxTextureSize;
@ -242,7 +244,6 @@ protected:
private:
bool fSupressPrints : 1;
bool fDrawPathMasksToCompressedTextureSupport : 1;
size_t fGeometryBufferMapThreshold;
typedef SkRefCnt INHERITED;
};

View File

@ -17,7 +17,7 @@ struct GrContextOptions {
, fMaxTextureSizeOverride(SK_MaxS32)
, fMinTextureSizeOverride(0)
, fSuppressDualSourceBlending(false)
, fGeometryBufferMapThreshold(1 << 15) {}
, fGeometryBufferMapThreshold(-1) {}
// EXPERIMENTAL
// May be removed in the future, or may become standard depending
@ -35,11 +35,10 @@ struct GrContextOptions {
int fMinTextureSizeOverride;
bool fSuppressDualSourceBlending;
/** fGeometryBufferMapThreshold gives a threshold (in bytes) for when Gr should
map a GrGeometryBuffer to update its contents. It will use map() if the
size of the updated region is greater than the threshold. Otherwise it will
use updateData(). */
size_t fGeometryBufferMapThreshold;
/** 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. */
int fGeometryBufferMapThreshold;
};
#endif

View File

@ -271,6 +271,12 @@ void GrGLCaps::init(const GrGLContextInfo& ctxInfo, const GrGLInterface* gli) {
}
}
// On many GPUs, map memory is very expensive, so we effectively disable it here by setting the
// threshold to the maximum unless the client gives us a hint that map memory is cheap.
if (fGeometryBufferMapThreshold < 0) {
fGeometryBufferMapThreshold = ctxInfo.isChromium() ? 0 : SK_MaxS32;
}
if (kGL_GrGLStandard == standard) {
SkASSERT(ctxInfo.version() >= GR_GL_VER(2,0) ||
ctxInfo.hasExtension("GL_ARB_texture_non_power_of_two"));