Remove GR_DISABLE_DRAW_BUFFERING, replace with RTConf variable.
authorbsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>
Thu, 7 Feb 2013 21:02:36 +0000 (21:02 +0000)
committerbsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>
Thu, 7 Feb 2013 21:02:36 +0000 (21:02 +0000)
R=robertphillips@google.com
Review URL: https://codereview.appspot.com/7312061

git-svn-id: http://skia.googlecode.com/svn/trunk@7656 2bbb7eff-a529-9590-31e7-b0007b416f81

include/gpu/GrConfig.h
include/gpu/GrUserConfig.h
src/gpu/GrContext.cpp

index 14ce5c75abaef7aa5657c78345157eb17d09f1cd..27484811b6d06679d08fd7e68934f8e23e3b467f 100644 (file)
@@ -325,14 +325,6 @@ inline void GrCrash(const char* msg) { GrPrintf(msg); GrAlwaysAssert(false); }
     #define GR_TEXT_SCALAR_TYPE_IS_FIXED   0
 #endif
 
-/**
- *  GR_DISABLE_DRAW_BUFFERING prevents GrContext from queueing draws in a
- *  GrInOrderDrawBuffer.
- */
-#if !defined(GR_DISABLE_DRAW_BUFFERING)
-    #define GR_DISABLE_DRAW_BUFFERING 0
-#endif
-
 /**
  * GR_GEOM_BUFFER_LOCK_THRESHOLD gives a threshold (in bytes) for when Gr should
  * lock a GrGeometryBuffer to update its contents. It will use lock() if the
index 18939c99a973e12667e5c6d8054fa3fa5ce471c1..18ebb225cb836cb2053b09fb949dedbdc8bdb442 100644 (file)
     #define GR_DEBUG    1
 #endif
 
-/*
- * This causes the GrContext to execute all draws immediately in the 3D API
- * rather than internally queuing draws.
- */
-//#define GR_DISABLE_DRAW_BUFFERING 1
-
 /*
  * This gives a threshold in bytes of when to lock a GrGeometryBuffer vs using
  * updateData. (Note the depending on the underlying 3D API the update functions
index 2549576c8764008d86fc8bd789bec10746e01011..a73a5b52785c83dc5659e3c1a29f08db41171acc 100644 (file)
@@ -23,6 +23,7 @@
 #include "GrSoftwarePathRenderer.h"
 #include "GrStencilBuffer.h"
 #include "GrTextStrike.h"
+#include "SkRTConf.h"
 #include "SkStrokeRec.h"
 #include "SkTLazy.h"
 #include "SkTLS.h"
 SK_DEFINE_INST_COUNT(GrContext)
 SK_DEFINE_INST_COUNT(GrDrawState)
 
-// It can be useful to set this to kNo_BufferedDraw to test whether a bug is caused by using the
+// It can be useful to set this to false to test whether a bug is caused by using the
 // InOrderDrawBuffer, to compare performance of using/not using InOrderDrawBuffer, or to make
-// debugging easier.
-#define DEFAULT_BUFFERING (GR_DISABLE_DRAW_BUFFERING ? kNo_BufferedDraw : kYes_BufferedDraw)
+// debugging simpler.
+SK_CONF_DECLARE(bool, c_Defer, "gpu.deferContext", true, "Defers rendering in GrContext via GrInOrderDrawBuffer.");
+
+#define BUFFERED_DRAW (c_Defer ? kYes_BufferedDraw : kNo_BufferedDraw)
 
 #define MAX_BLUR_SIGMA 4.0f
 
@@ -552,7 +555,7 @@ void GrContext::setClip(const GrClipData* clipData) {
 void GrContext::clear(const GrIRect* rect,
                       const GrColor color,
                       GrRenderTarget* target) {
-    this->prepareToDraw(NULL, DEFAULT_BUFFERING)->clear(rect, color, target);
+    this->prepareToDraw(NULL, BUFFERED_DRAW)->clear(rect, color, target);
 }
 
 void GrContext::drawPaint(const GrPaint& origPaint) {
@@ -694,7 +697,7 @@ void GrContext::drawRect(const GrPaint& paint,
                          const SkMatrix* matrix) {
     SK_TRACE_EVENT0("GrContext::drawRect");
 
-    GrDrawTarget* target = this->prepareToDraw(&paint, DEFAULT_BUFFERING);
+    GrDrawTarget* target = this->prepareToDraw(&paint, BUFFERED_DRAW);
     GrDrawState::AutoStageDisable atr(fDrawState);
 
     GrRect devRect = rect;
@@ -785,7 +788,7 @@ void GrContext::drawRectToRect(const GrPaint& paint,
         return;
     }
 
-    GrDrawTarget* target = this->prepareToDraw(&paint, DEFAULT_BUFFERING);
+    GrDrawTarget* target = this->prepareToDraw(&paint, BUFFERED_DRAW);
     GrDrawState::AutoStageDisable atr(fDrawState);
 
     const GrRect* srcRects[GrDrawState::kNumStages] = {NULL};
@@ -808,7 +811,7 @@ void GrContext::drawVertices(const GrPaint& paint,
 
     GrDrawTarget::AutoReleaseGeometry geo;
 
-    GrDrawTarget* target = this->prepareToDraw(&paint, DEFAULT_BUFFERING);
+    GrDrawTarget* target = this->prepareToDraw(&paint, BUFFERED_DRAW);
     GrDrawState::AutoStageDisable atr(fDrawState);
 
     GrVertexLayout layout = 0;
@@ -928,7 +931,7 @@ void GrContext::internalDrawOval(const GrPaint& paint,
     }
 #endif
 
-    GrDrawTarget* target = this->prepareToDraw(&paint, DEFAULT_BUFFERING);
+    GrDrawTarget* target = this->prepareToDraw(&paint, BUFFERED_DRAW);
 
     GrDrawState* drawState = target->drawState();
     GrDrawState::AutoStageDisable atr(fDrawState);
@@ -1073,7 +1076,7 @@ void GrContext::internalDrawPath(const GrPaint& paint, const SkPath& path, const
     // cache. This presents a potential hazard for buffered drawing. However,
     // the writePixels that uploads to the scratch will perform a flush so we're
     // OK.
-    GrDrawTarget* target = this->prepareToDraw(&paint, DEFAULT_BUFFERING);
+    GrDrawTarget* target = this->prepareToDraw(&paint, BUFFERED_DRAW);
     GrDrawState::AutoStageDisable atr(fDrawState);
 
     bool prAA = paint.isAntiAlias() && !this->getRenderTarget()->isMultisampled();
@@ -1706,7 +1709,7 @@ void GrContext::setupDrawBuffer() {
 }
 
 GrDrawTarget* GrContext::getTextTarget(const GrPaint& paint) {
-    return prepareToDraw(&paint, DEFAULT_BUFFERING);
+    return this->prepareToDraw(&paint, BUFFERED_DRAW);
 }
 
 const GrIndexBuffer* GrContext::getQuadIndexBuffer() const {
@@ -1830,7 +1833,7 @@ GrTexture* GrContext::gaussianBlur(GrTexture* srcTexture,
         }
 
         this->setRenderTarget(dstTexture->asRenderTarget());
-        GrDrawTarget* target = this->prepareToDraw(NULL, DEFAULT_BUFFERING);
+        GrDrawTarget* target = this->prepareToDraw(NULL, BUFFERED_DRAW);
         convolve_gaussian(target, srcTexture, srcRect, sigmaX, radiusX,
                           Gr1DKernelEffect::kX_Direction);
         srcTexture = dstTexture;
@@ -1847,7 +1850,7 @@ GrTexture* GrContext::gaussianBlur(GrTexture* srcTexture,
         }
 
         this->setRenderTarget(dstTexture->asRenderTarget());
-        GrDrawTarget* target = this->prepareToDraw(NULL, DEFAULT_BUFFERING);
+        GrDrawTarget* target = this->prepareToDraw(NULL, BUFFERED_DRAW);
         convolve_gaussian(target, srcTexture, srcRect, sigmaY, radiusY,
                           Gr1DKernelEffect::kY_Direction);
         srcTexture = dstTexture;