aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
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
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')
-rw-r--r--src/gpu/GrDrawingManager.cpp35
-rw-r--r--src/gpu/GrDrawingManager.h19
-rw-r--r--src/gpu/GrResourceProvider.cpp22
-rw-r--r--src/gpu/GrResourceProvider.h4
-rw-r--r--src/gpu/GrTextureProxy.cpp6
5 files changed, 63 insertions, 23 deletions
diff --git a/src/gpu/GrDrawingManager.cpp b/src/gpu/GrDrawingManager.cpp
index 703bc0a92d..cba23b4539 100644
--- a/src/gpu/GrDrawingManager.cpp
+++ b/src/gpu/GrDrawingManager.cpp
@@ -31,6 +31,41 @@
#include "GrTracing.h"
#include "text/GrAtlasTextContext.h"
+// Turn on/off the sorting of opLists at flush time
+#ifndef SK_DISABLE_RENDER_TARGET_SORTING
+ #define SK_DISABLE_RENDER_TARGET_SORTING
+#endif
+
+#ifdef SK_DISABLE_RENDER_TARGET_SORTING
+static const bool kDefaultSortRenderTargets = false;
+#else
+static const bool kDefaultSortRenderTargets = true;
+#endif
+
+GrDrawingManager::GrDrawingManager(GrContext* context,
+ const GrPathRendererChain::Options& optionsForPathRendererChain,
+ const GrAtlasTextContext::Options& optionsForAtlasTextContext,
+ GrSingleOwner* singleOwner,
+ GrContextOptions::Enable sortRenderTargets)
+ : fContext(context)
+ , fOptionsForPathRendererChain(optionsForPathRendererChain)
+ , fOptionsForAtlasTextContext(optionsForAtlasTextContext)
+ , fSingleOwner(singleOwner)
+ , fAbandoned(false)
+ , fAtlasTextContext(nullptr)
+ , fPathRendererChain(nullptr)
+ , fSoftwarePathRenderer(nullptr)
+ , fFlushing(false) {
+
+ if (GrContextOptions::Enable::kNo == sortRenderTargets) {
+ fSortRenderTargets = false;
+ } else if (GrContextOptions::Enable::kYes == sortRenderTargets) {
+ fSortRenderTargets = true;
+ } else {
+ fSortRenderTargets = kDefaultSortRenderTargets;
+ }
+}
+
void GrDrawingManager::cleanup() {
for (int i = 0; i < fOpLists.count(); ++i) {
// no opList should receive a new command after this
diff --git a/src/gpu/GrDrawingManager.h b/src/gpu/GrDrawingManager.h
index 200d0cafce..050d707ec4 100644
--- a/src/gpu/GrDrawingManager.h
+++ b/src/gpu/GrDrawingManager.h
@@ -83,22 +83,9 @@ public:
void copyOpListsFromDDL(const SkDeferredDisplayList*, GrRenderTargetProxy* newDest);
private:
- GrDrawingManager(GrContext* context,
- const GrPathRendererChain::Options& optionsForPathRendererChain,
- const GrAtlasTextContext::Options& optionsForAtlasTextContext,
- GrSingleOwner* singleOwner,
- bool sortRenderTargets)
- : fContext(context)
- , fOptionsForPathRendererChain(optionsForPathRendererChain)
- , fOptionsForAtlasTextContext(optionsForAtlasTextContext)
- , fSingleOwner(singleOwner)
- , fAbandoned(false)
- , fAtlasTextContext(nullptr)
- , fPathRendererChain(nullptr)
- , fSoftwarePathRenderer(nullptr)
- , fFlushing(false)
- , fSortRenderTargets(sortRenderTargets) {
- }
+ GrDrawingManager(GrContext*, const GrPathRendererChain::Options&,
+ const GrAtlasTextContext::Options&, GrSingleOwner*,
+ GrContextOptions::Enable sortRenderTargets);
void abandon();
void cleanup();
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);
diff --git a/src/gpu/GrResourceProvider.h b/src/gpu/GrResourceProvider.h
index 7b5fb60ea1..caa108747d 100644
--- a/src/gpu/GrResourceProvider.h
+++ b/src/gpu/GrResourceProvider.h
@@ -9,6 +9,7 @@
#define GrResourceProvider_DEFINED
#include "GrBuffer.h"
+#include "GrContextOptions.h"
#include "GrPathRange.h"
#include "GrResourceCache.h"
#include "SkImageInfo.h"
@@ -39,7 +40,8 @@ class SkTypeface;
*/
class GrResourceProvider {
public:
- GrResourceProvider(GrGpu*, GrResourceCache*, GrSingleOwner*, bool explicitlyAllocate);
+ GrResourceProvider(GrGpu*, GrResourceCache*, GrSingleOwner*,
+ GrContextOptions::Enable explicitlyAllocateGPUResources);
/**
* Finds a resource in the cache, based on the specified key. Prior to calling this, the caller
diff --git a/src/gpu/GrTextureProxy.cpp b/src/gpu/GrTextureProxy.cpp
index 13e124021f..3362ec81d4 100644
--- a/src/gpu/GrTextureProxy.cpp
+++ b/src/gpu/GrTextureProxy.cpp
@@ -95,10 +95,8 @@ void GrTextureProxyPriv::setDeferredUploader(std::unique_ptr<GrDeferredProxyUplo
}
void GrTextureProxyPriv::scheduleUpload(GrOpFlushState* flushState) {
- SkASSERT(fTextureProxy->fDeferredUploader);
-
- // Instantiate might have failed
- if (fTextureProxy->fTarget) {
+ // The texture proxy's contents may already have been uploaded or instantiation may have failed
+ if (fTextureProxy->fDeferredUploader && fTextureProxy->fTarget) {
fTextureProxy->fDeferredUploader->scheduleUpload(flushState, fTextureProxy);
}
}