aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--include/gpu/GrCaps.h7
-rw-r--r--include/gpu/GrContext.h6
-rw-r--r--src/gpu/GrCaps.cpp3
-rw-r--r--src/gpu/GrContext.cpp4
-rw-r--r--src/gpu/GrDrawContext.cpp4
-rw-r--r--src/gpu/GrTest.cpp2
-rw-r--r--tests/GLProgramsTest.cpp5
7 files changed, 18 insertions, 13 deletions
diff --git a/include/gpu/GrCaps.h b/include/gpu/GrCaps.h
index 572b9caea7..2ee7a37081 100644
--- a/include/gpu/GrCaps.h
+++ b/include/gpu/GrCaps.h
@@ -206,7 +206,9 @@ public:
return fConfigTextureSupport[config];
}
- bool suppressPrints() const { return fSupressPrints; }
+ bool suppressPrints() const { return fSuppressPrints; }
+
+ bool immediateFlush() const { return fImmediateFlush; }
bool drawPathMasksToCompressedTexturesSupport() const {
return fDrawPathMasksToCompressedTextureSupport;
@@ -277,7 +279,8 @@ protected:
private:
virtual void onApplyOptionsOverrides(const GrContextOptions&) {};
- bool fSupressPrints : 1;
+ bool fSuppressPrints : 1;
+ bool fImmediateFlush: 1;
bool fDrawPathMasksToCompressedTextureSupport : 1;
typedef SkRefCnt INHERITED;
diff --git a/include/gpu/GrContext.h b/include/gpu/GrContext.h
index c40241656d..098fdd2fe9 100644
--- a/include/gpu/GrContext.h
+++ b/include/gpu/GrContext.h
@@ -8,6 +8,7 @@
#ifndef GrContext_DEFINED
#define GrContext_DEFINED
+#include "GrCaps.h"
#include "GrClip.h"
#include "GrColor.h"
#include "GrPaint.h"
@@ -20,7 +21,6 @@
struct GrBatchAtlasConfig;
class GrBatchFontCache;
-class GrCaps;
struct GrContextOptions;
class GrDrawingManager;
class GrDrawContext;
@@ -205,7 +205,7 @@ public:
void flush(int flagsBitfield = 0);
void flushIfNecessary() {
- if (fFlushToReduceCacheSize) {
+ if (fFlushToReduceCacheSize || this->caps()->immediateFlush()) {
this->flush();
}
}
@@ -406,7 +406,7 @@ private:
bool init(GrBackend, GrBackendContext, const GrContextOptions& options);
void initMockContext();
- void initCommon(const GrContextOptions& options);
+ void initCommon();
/**
* These functions create premul <-> unpremul effects if it is possible to generate a pair
diff --git a/src/gpu/GrCaps.cpp b/src/gpu/GrCaps.cpp
index 3331db5567..e4f81ab79b 100644
--- a/src/gpu/GrCaps.cpp
+++ b/src/gpu/GrCaps.cpp
@@ -111,7 +111,8 @@ GrCaps::GrCaps(const GrContextOptions& options) {
memset(fConfigRenderSupport, 0, sizeof(fConfigRenderSupport));
memset(fConfigTextureSupport, 0, sizeof(fConfigTextureSupport));
- fSupressPrints = options.fSuppressPrints;
+ fSuppressPrints = options.fSuppressPrints;
+ fImmediateFlush = options.fImmediateMode;
fDrawPathMasksToCompressedTextureSupport = options.fDrawPathToCompressedTexture;
fGeometryBufferMapThreshold = options.fGeometryBufferMapThreshold;
fUseDrawInsteadOfPartialRenderTargetWrite = options.fUseDrawInsteadOfPartialRenderTargetWrite;
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index c2bcbd0bad..bd4ca40a34 100644
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -72,11 +72,11 @@ bool GrContext::init(GrBackend backend, GrBackendContext backendContext,
if (!fGpu) {
return false;
}
- this->initCommon(options);
+ this->initCommon();
return true;
}
-void GrContext::initCommon(const GrContextOptions& options) {
+void GrContext::initCommon() {
fCaps = SkRef(fGpu->caps());
fResourceCache = new GrResourceCache(fCaps);
fResourceCache->setOverBudgetCallback(OverBudgetCB, this);
diff --git a/src/gpu/GrDrawContext.cpp b/src/gpu/GrDrawContext.cpp
index 9c07211754..bac3a169f5 100644
--- a/src/gpu/GrDrawContext.cpp
+++ b/src/gpu/GrDrawContext.cpp
@@ -88,7 +88,6 @@ void GrDrawContext::copySurface(GrSurface* src, const SkIRect& srcRect, const Sk
this->getDrawTarget()->copySurface(fRenderTarget, src, srcRect, dstPoint);
}
-
void GrDrawContext::drawText(const GrClip& clip, const GrPaint& grPaint,
const SkPaint& skPaint,
const SkMatrix& viewMatrix,
@@ -103,8 +102,8 @@ void GrDrawContext::drawText(const GrClip& clip, const GrPaint& grPaint,
fTextContext->drawText(this, fRenderTarget, clip, grPaint, skPaint, viewMatrix,
text, byteLength, x, y, clipBounds);
-
}
+
void GrDrawContext::drawPosText(const GrClip& clip, const GrPaint& grPaint,
const SkPaint& skPaint,
const SkMatrix& viewMatrix,
@@ -122,6 +121,7 @@ void GrDrawContext::drawPosText(const GrClip& clip, const GrPaint& grPaint,
pos, scalarsPerPosition, offset, clipBounds);
}
+
void GrDrawContext::drawTextBlob(const GrClip& clip, const SkPaint& skPaint,
const SkMatrix& viewMatrix, const SkTextBlob* blob,
SkScalar x, SkScalar y,
diff --git a/src/gpu/GrTest.cpp b/src/gpu/GrTest.cpp
index 975636d28b..6e9df211fa 100644
--- a/src/gpu/GrTest.cpp
+++ b/src/gpu/GrTest.cpp
@@ -300,7 +300,7 @@ void GrContext::initMockContext() {
SkASSERT(nullptr == fGpu);
fGpu = new MockGpu(this, options);
SkASSERT(fGpu);
- this->initCommon(options);
+ this->initCommon();
// We delete these because we want to test the cache starting with zero resources. Also, none of
// these objects are required for any of tests that use this context. TODO: make stop allocating
diff --git a/tests/GLProgramsTest.cpp b/tests/GLProgramsTest.cpp
index dedd00959c..d1798fc8fa 100644
--- a/tests/GLProgramsTest.cpp
+++ b/tests/GLProgramsTest.cpp
@@ -301,8 +301,9 @@ static void set_random_stencil(GrPipelineBuilder* pipelineBuilder, SkRandom* ran
}
}
-bool GrDrawingManager::ProgramUnitTest(GrContext* context, GrDrawTarget* drawTarget, int maxStages) {
-
+bool GrDrawingManager::ProgramUnitTest(GrContext* context,
+ GrDrawTarget* drawTarget,
+ int maxStages) {
GrDrawingManager* drawingManager = context->drawingManager();
// setup dummy textures