diff options
author | joshualitt <joshualitt@chromium.org> | 2015-05-29 06:46:47 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-05-29 06:46:47 -0700 |
commit | 7224c866321e4222ef452fc0c73ae05283a2227c (patch) | |
tree | 4f413c7e679c7a4fd04c966ca6d6b8298e18c349 | |
parent | e800657f2f8a42863481f5a4d7b0d698ecd94e4c (diff) |
add context override of GeometryBufferMapThreshold
BUG=skia:
Review URL: https://codereview.chromium.org/1159713006
-rw-r--r-- | gyp/gpu.gypi | 1 | ||||
-rw-r--r-- | include/gpu/GrCaps.h | 8 | ||||
-rw-r--r-- | include/gpu/GrConfig.h | 27 | ||||
-rw-r--r-- | include/gpu/GrContextOptions.h | 9 | ||||
-rw-r--r-- | include/gpu/GrUserConfig.h | 22 | ||||
-rw-r--r-- | src/gpu/GrBufferAllocPool.cpp | 5 | ||||
-rw-r--r-- | src/gpu/GrBufferAllocPool.h | 1 | ||||
-rw-r--r-- | src/gpu/GrCaps.cpp | 1 |
8 files changed, 20 insertions, 54 deletions
diff --git a/gyp/gpu.gypi b/gyp/gpu.gypi index 6a93a7c7d9..f47e6fa60d 100644 --- a/gyp/gpu.gypi +++ b/gyp/gpu.gypi @@ -40,7 +40,6 @@ '<(skia_include_path)/gpu/GrTextureAccess.h', '<(skia_include_path)/gpu/GrTestUtils.h', '<(skia_include_path)/gpu/GrTypes.h', - '<(skia_include_path)/gpu/GrUserConfig.h', '<(skia_include_path)/gpu/GrXferProcessor.h', '<(skia_include_path)/gpu/effects/GrConstColorProcessor.h', diff --git a/include/gpu/GrCaps.h b/include/gpu/GrCaps.h index e083042ae4..25f3caaded 100644 --- a/include/gpu/GrCaps.h +++ b/include/gpu/GrCaps.h @@ -196,7 +196,12 @@ public: bool suppressPrints() const { return fSupressPrints; } bool drawPathMasksToCompressedTexturesSupport() const { - return fDrawPathMasksToCompressedTextureSupport; } + return fDrawPathMasksToCompressedTextureSupport; + } + + size_t geometryBufferMapThreshold() const { + return fGeometryBufferMapThreshold; + } protected: /** Subclasses must call this at the end of their constructors in order to apply caps @@ -233,6 +238,7 @@ protected: private: bool fSupressPrints : 1; bool fDrawPathMasksToCompressedTextureSupport : 1; + size_t fGeometryBufferMapThreshold; typedef SkRefCnt INHERITED; }; diff --git a/include/gpu/GrConfig.h b/include/gpu/GrConfig.h index 6a00eabe14..de121faf3e 100644 --- a/include/gpu/GrConfig.h +++ b/include/gpu/GrConfig.h @@ -76,23 +76,6 @@ typedef unsigned __int64 uint64_t; #include <stdint.h> #endif -/* - * The "user config" file can be empty, and everything should work. It is - * meant to store a given platform/client's overrides of our guess-work. - * - * A alternate user config file can be specified by defining - * GR_USER_CONFIG_FILE. It should be defined relative to GrConfig.h - * - * e.g. it can change the BUILD target or supply its own defines for anything - * else (e.g. GR_DEFAULT_RESOURCE_CACHE_MB_LIMIT) - */ -#if !defined(GR_USER_CONFIG_FILE) - #include "GrUserConfig.h" -#else - #include GR_USER_CONFIG_FILE -#endif - - /////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// // postconfig section: @@ -203,16 +186,6 @@ typedef unsigned __int64 uint64_t; #endif /** - * GR_GEOM_BUFFER_MAP_THRESHOLD 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(). - */ -#if !defined(GR_GEOM_BUFFER_MAP_THRESHOLD) - #define GR_GEOM_BUFFER_MAP_THRESHOLD (1 << 15) -#endif - -/** * GR_STROKE_PATH_RENDERING controls whether or not the GrStrokePathRenderer can be selected * as a path renderer. GrStrokePathRenderer is currently an experimental path renderer. */ diff --git a/include/gpu/GrContextOptions.h b/include/gpu/GrContextOptions.h index dfb352b507..d8d59fac3a 100644 --- a/include/gpu/GrContextOptions.h +++ b/include/gpu/GrContextOptions.h @@ -15,7 +15,8 @@ struct GrContextOptions { : fDrawPathToCompressedTexture(false) , fSuppressPrints(false) , fMaxTextureSizeOverride(SK_MaxS32) - , fSuppressDualSourceBlending(false) {} + , fSuppressDualSourceBlending(false) + , fGeometryBufferMapThreshold(1 << 15) {} // EXPERIMENTAL // May be removed in the future, or may become standard depending @@ -31,6 +32,12 @@ struct GrContextOptions { int fMaxTextureSizeOverride; 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; }; #endif diff --git a/include/gpu/GrUserConfig.h b/include/gpu/GrUserConfig.h deleted file mode 100644 index 4ff95f73b5..0000000000 --- a/include/gpu/GrUserConfig.h +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright 2010 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef GrUserConfig_DEFINED -#define GrUserConfig_DEFINED - -#if defined(GR_USER_CONFIG_FILE) - #error "default user config pulled in but GR_USER_CONFIG_FILE is defined." -#endif - -/** - * This gives a threshold in bytes of when to map a GrGeometryBuffer vs using - * updateData. (Note the depending on the underlying 3D API the update functions - * may always be implemented using a map) - */ -//#define GR_GEOM_BUFFER_MAP_THRESHOLD (1<<15) - -#endif diff --git a/src/gpu/GrBufferAllocPool.cpp b/src/gpu/GrBufferAllocPool.cpp index db19a5b540..6492527c03 100644 --- a/src/gpu/GrBufferAllocPool.cpp +++ b/src/gpu/GrBufferAllocPool.cpp @@ -57,6 +57,7 @@ GrBufferAllocPool::GrBufferAllocPool(GrGpu* gpu, *fPreallocBuffers.append() = buffer; } } + fGeometryBufferMapThreshold = gpu->caps()->geometryBufferMapThreshold(); } GrBufferAllocPool::~GrBufferAllocPool() { @@ -288,7 +289,7 @@ bool GrBufferAllocPool::createBlock(size_t requestSize) { // threshold. bool attemptMap = block.fBuffer->isCPUBacked(); if (!attemptMap && GrCaps::kNone_MapFlags != fGpu->caps()->mapBufferFlags()) { - attemptMap = size > GR_GEOM_BUFFER_MAP_THRESHOLD; + attemptMap = size > fGeometryBufferMapThreshold; } if (attemptMap) { @@ -332,7 +333,7 @@ void GrBufferAllocPool::flushCpuData(const BufferBlock& block, size_t flushSize) VALIDATE(true); if (GrCaps::kNone_MapFlags != fGpu->caps()->mapBufferFlags() && - flushSize > GR_GEOM_BUFFER_MAP_THRESHOLD) { + flushSize > fGeometryBufferMapThreshold) { void* data = buffer->map(); if (data) { memcpy(data, fBufferPtr, flushSize); diff --git a/src/gpu/GrBufferAllocPool.h b/src/gpu/GrBufferAllocPool.h index df0a0ccd9c..cd5d1971da 100644 --- a/src/gpu/GrBufferAllocPool.h +++ b/src/gpu/GrBufferAllocPool.h @@ -128,6 +128,7 @@ private: int fPreallocBufferStartIdx; SkAutoMalloc fCpuData; void* fBufferPtr; + size_t fGeometryBufferMapThreshold; }; class GrVertexBuffer; diff --git a/src/gpu/GrCaps.cpp b/src/gpu/GrCaps.cpp index f078fad9fb..1f277b7f7e 100644 --- a/src/gpu/GrCaps.cpp +++ b/src/gpu/GrCaps.cpp @@ -105,6 +105,7 @@ GrCaps::GrCaps(const GrContextOptions& options) { fSupressPrints = options.fSuppressPrints; fDrawPathMasksToCompressedTextureSupport = options.fDrawPathToCompressedTexture; + fGeometryBufferMapThreshold = options.fGeometryBufferMapThreshold; } void GrCaps::applyOptionsOverrides(const GrContextOptions& options) { |