Readd "immediate" mode

This isn't an exact replacement. The accumulated batches are now flushed at drawContext-entry-point granularity (via the AutoCheckFlush objects) rather than per batch.

TBR=bsalomon@google.com

Review URL: https://codereview.chromium.org/1439533003
This commit is contained in:
robertphillips 2015-11-11 13:18:11 -08:00 committed by Commit bot
parent dad57c8c48
commit caef345048
7 changed files with 18 additions and 13 deletions

View File

@ -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;

View File

@ -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

View File

@ -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;

View File

@ -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);

View File

@ -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,

View File

@ -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

View File

@ -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