Chromium Code Reviews| Index: src/gpu/GrDrawTarget.cpp |
| diff --git a/src/gpu/GrDrawTarget.cpp b/src/gpu/GrDrawTarget.cpp |
| index 3918ce2a2179a5a45da62427f1637e703f7a35ea..8a03fdafd6635522bbce6d5aa12a9ddfb15037f7 100644 |
| --- a/src/gpu/GrDrawTarget.cpp |
| +++ b/src/gpu/GrDrawTarget.cpp |
| @@ -19,7 +19,7 @@ |
| #include "GrSurfacePriv.h" |
| #include "GrTexture.h" |
| #include "GrVertexBuffer.h" |
| - |
| +#include "gl/GrGLRenderTarget.h" |
| #include "batches/GrClearBatch.h" |
| #include "batches/GrCopySurfaceBatch.h" |
| #include "batches/GrDiscardBatch.h" |
| @@ -210,6 +210,8 @@ void GrDrawTarget::drawBatches(GrBatchFlushState* flushState) { |
| } |
| fBatches[i]->draw(flushState); |
| } |
| + |
| + fGpu->performFlushWorkaround(); |
| } |
| void GrDrawTarget::reset() { |
| @@ -513,6 +515,12 @@ void GrDrawTarget::recordBatch(GrBatch* batch) { |
| /////////////////////////////////////////////////////////////////////////////// |
| +#ifdef ENABLE_PLS |
|
bsalomon
2016/01/04 15:33:46
There is an SkTPin that does the same thing.
|
| + static int clamp(int min, int v, int max) { |
| + return SkTMin(SkTMax(v, min), max); |
| + } |
| +#endif |
| + |
| bool GrDrawTarget::installPipelineInDrawBatch(const GrPipelineBuilder* pipelineBuilder, |
| const GrScissorState* scissor, |
| GrDrawBatch* batch) { |
| @@ -521,6 +529,30 @@ bool GrDrawTarget::installPipelineInDrawBatch(const GrPipelineBuilder* pipelineB |
| args.fCaps = this->caps(); |
| args.fScissor = scissor; |
| batch->getPipelineOptimizations(&args.fOpts); |
| + #ifdef ENABLE_PLS |
| + GrScissorState finalScissor; |
| + if (args.fOpts.fOverrides.fUsePLSDstRead) { |
| + // FIXME shouldn't have to cast to GL implementation here |
|
bsalomon
2016/01/04 15:33:46
The viewport rect isn't really right because it re
|
| + GrGLRenderTarget* rt = static_cast<GrGLRenderTarget*>(pipelineBuilder->getRenderTarget()); |
| + GrGLIRect viewport = rt->getViewport(); |
| + SkIRect ibounds; |
| + ibounds.fLeft = clamp(viewport.fLeft, SkScalarFloorToInt(batch->bounds().fLeft), |
| + viewport.fWidth); |
| + ibounds.fTop = clamp(viewport.fBottom, SkScalarFloorToInt(batch->bounds().fTop), |
| + viewport.fHeight); |
| + ibounds.fRight = clamp(viewport.fLeft, SkScalarCeilToInt(batch->bounds().fRight), |
| + viewport.fWidth); |
| + ibounds.fBottom = clamp(viewport.fBottom, SkScalarCeilToInt(batch->bounds().fBottom), |
| + viewport.fHeight); |
| + if (scissor != nullptr && scissor->enabled()) { |
| + if (!ibounds.intersect(scissor->rect())) { |
| + ibounds = scissor->rect(); |
| + } |
| + } |
| + finalScissor.set(ibounds); |
| + args.fScissor = &finalScissor; |
| + } |
| + #endif |
| args.fOpts.fColorPOI.completeCalculations(pipelineBuilder->fColorFragmentProcessors.begin(), |
| pipelineBuilder->numColorFragmentProcessors()); |
| args.fOpts.fCoveragePOI.completeCalculations( |