diff options
author | bsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2011-02-02 19:24:54 +0000 |
---|---|---|
committer | bsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2011-02-02 19:24:54 +0000 |
commit | 4333323006ac6ef472e011b8ea8f0bb303a0f21f (patch) | |
tree | 442ac819bacb63b8954d9bc8d64a6ef1eba41ebf | |
parent | c48b2b330f8bf0e01381e27ca36f48ef5c7d8d5f (diff) |
Make enabling static rect VB configurable by user config file.
git-svn-id: http://skia.googlecode.com/svn/trunk@753 2bbb7eff-a529-9590-31e7-b0007b416f81
-rw-r--r-- | gpu/include/GrConfig.h | 4 | ||||
-rw-r--r-- | gpu/include/GrUserConfig.h | 8 | ||||
-rw-r--r-- | gpu/src/GrContext.cpp | 5 |
3 files changed, 14 insertions, 3 deletions
diff --git a/gpu/include/GrConfig.h b/gpu/include/GrConfig.h index b599a537e5..4c5ddd6ac7 100644 --- a/gpu/include/GrConfig.h +++ b/gpu/include/GrConfig.h @@ -305,6 +305,10 @@ inline void GrCrash(const char* msg) { GrPrintf(msg); GrAlwaysAssert(false); } #define GR_GL_LOG_CALLS 0 #endif +#if !defined(GR_STATIC_RECT_VB) + #define GR_STATIC_RECT_VB 0 +#endif + /////////////////////////////////////////////////////////////////////////////// // tail section: // diff --git a/gpu/include/GrUserConfig.h b/gpu/include/GrUserConfig.h index 2d46b9feac..3484760649 100644 --- a/gpu/include/GrUserConfig.h +++ b/gpu/include/GrUserConfig.h @@ -51,6 +51,14 @@ */ //#define GR_GL_LOG_CALLS 1 +/* + * When drawing rects this causes Ganesh to use a vertex buffer containing + * a unit square that is positioned by a matrix. Enable on systems where + * emitting per-rect-draw verts is more expensive than constant/matrix + * updates. Defaults to 0. + */ +//#define GR_STATIC_RECT_VB 1 + /////////////////////////////////////////////////////////////////////////////// /* * temporary flags (may go away soon) diff --git a/gpu/src/GrContext.cpp b/gpu/src/GrContext.cpp index f966c2c9d6..3446e23c2b 100644 --- a/gpu/src/GrContext.cpp +++ b/gpu/src/GrContext.cpp @@ -24,7 +24,6 @@ #include "GrIndexBuffer.h"
#define DEFER_TEXT_RENDERING 1
-#define USE_STATIC_RECT_VB 0
static const size_t MAX_TEXTURE_CACHE_COUNT = 128;
static const size_t MAX_TEXTURE_CACHE_BYTES = 8 * 1024 * 1024;
@@ -381,7 +380,7 @@ void GrContext::drawRect(const GrPaint& paint, fGpu->drawNonIndexed(primType, 0, vertCount);
} else {
- #if USE_STATIC_RECT_VB
+ #if GR_STATIC_RECT_VB
fGpu->setVertexSourceToBuffer(fGpu->unitSquareVertexBuffer(), layout);
GrDrawTarget::AutoViewMatrixRestore avmr(fGpu);
GrMatrix m;
@@ -428,7 +427,7 @@ void GrContext::drawRectToRect(const GrPaint& paint, this->prepareToDraw(paint);
-#if USE_STATIC_RECT_VB
+#if GR_STATIC_RECT_VB
GrVertexLayout layout = GrDrawTarget::StagePosAsTexCoordVertexLayoutBit(0);
GrDrawTarget::AutoViewMatrixRestore avmr(fGpu);
|