aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrResourceProvider.cpp
diff options
context:
space:
mode:
authorGravatar Robert Phillips <robertphillips@google.com>2018-02-08 10:59:38 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-02-08 16:28:30 +0000
commita3f70261ccf4c14648505fed8bdc517ceb1b925e (patch)
tree8cff94fc78cf47d242abbf39b426195dc56c3178 /src/gpu/GrResourceProvider.cpp
parentf8cac792274b01901899a4fa6e4d571d218a3e05 (diff)
Switch MDB GrContextOptions over to Enable style
Change-Id: Id6541c346a13649c89ca3b9ccb13972976f9b973 Reviewed-on: https://skia-review.googlesource.com/105603 Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'src/gpu/GrResourceProvider.cpp')
-rw-r--r--src/gpu/GrResourceProvider.cpp22
1 files changed, 20 insertions, 2 deletions
diff --git a/src/gpu/GrResourceProvider.cpp b/src/gpu/GrResourceProvider.cpp
index c9575b26dc..17da9a7e8c 100644
--- a/src/gpu/GrResourceProvider.cpp
+++ b/src/gpu/GrResourceProvider.cpp
@@ -30,18 +30,36 @@ GR_DECLARE_STATIC_UNIQUE_KEY(gQuadIndexBufferKey);
const uint32_t GrResourceProvider::kMinScratchTextureSize = 16;
+// Turn on/off the explicit distribution of GPU resources at flush time
+#ifndef SK_DISABLE_EXPLICIT_GPU_RESOURCE_ALLOCATION
+ #define SK_DISABLE_EXPLICIT_GPU_RESOURCE_ALLOCATION
+#endif
+
+#ifdef SK_DISABLE_EXPLICIT_GPU_RESOURCE_ALLOCATION
+static const bool kDefaultExplicitlyAllocateGPUResources = false;
+#else
+static const bool kDefaultExplicitlyAllocateGPUResources = true;
+#endif
+
#define ASSERT_SINGLE_OWNER \
SkDEBUGCODE(GrSingleOwner::AutoEnforce debug_SingleOwner(fSingleOwner);)
GrResourceProvider::GrResourceProvider(GrGpu* gpu, GrResourceCache* cache, GrSingleOwner* owner,
- bool explicitlyAllocateGPUResources)
+ GrContextOptions::Enable explicitlyAllocateGPUResources)
: fCache(cache)
, fGpu(gpu)
- , fExplicitlyAllocateGPUResources(explicitlyAllocateGPUResources)
#ifdef SK_DEBUG
, fSingleOwner(owner)
#endif
{
+ if (GrContextOptions::Enable::kNo == explicitlyAllocateGPUResources) {
+ fExplicitlyAllocateGPUResources = false;
+ } else if (GrContextOptions::Enable::kYes == explicitlyAllocateGPUResources) {
+ fExplicitlyAllocateGPUResources = true;
+ } else {
+ fExplicitlyAllocateGPUResources = kDefaultExplicitlyAllocateGPUResources;
+ }
+
fCaps = sk_ref_sp(fGpu->caps());
GR_DEFINE_STATIC_UNIQUE_KEY(gQuadIndexBufferKey);