| Index: src/gpu/GrDrawTarget.cpp
|
| diff --git a/src/gpu/GrDrawTarget.cpp b/src/gpu/GrDrawTarget.cpp
|
| index 7213a92152af7d1efca0a48c65e815074a38a9a1..16fcfb3ef22c236f3e1fef7bbd22b4b2f6ec5eee 100644
|
| --- a/src/gpu/GrDrawTarget.cpp
|
| +++ b/src/gpu/GrDrawTarget.cpp
|
| @@ -11,6 +11,7 @@
|
| #include "GrCaps.h"
|
| #include "GrDrawContext.h"
|
| #include "GrGpu.h"
|
| +#include "GrGpuCommandBuffer.h"
|
| #include "GrPath.h"
|
| #include "GrPipeline.h"
|
| #include "GrMemoryPool.h"
|
| @@ -209,10 +210,34 @@ void GrDrawTarget::prepareBatches(GrBatchFlushState* flushState) {
|
| void GrDrawTarget::drawBatches(GrBatchFlushState* flushState) {
|
| // Draw all the generated geometry.
|
| SkRandom random;
|
| + GrRenderTarget* currentRT = nullptr;
|
| + GrGpuCommandBuffer* commandBuffer = nullptr;
|
| for (int i = 0; i < fBatches.count(); ++i) {
|
| if (!fBatches[i]) {
|
| continue;
|
| }
|
| + if (fBatches[i]->renderTarget() != currentRT /* || commandBuffer*/) {
|
| + if (commandBuffer) {
|
| + commandBuffer->end();
|
| + // For now just use size of whole render target, but this should be updated to
|
| + // only be the actual bounds of the various draws.
|
| + SkIRect bounds = SkIRect::MakeWH(currentRT->width(), currentRT->height());
|
| + commandBuffer->submit(bounds);
|
| + delete commandBuffer;
|
| + commandBuffer = nullptr;
|
| + }
|
| + currentRT = fBatches[i]->renderTarget();
|
| + if (currentRT) {
|
| + static const GrGpuCommandBuffer::LoadAndStoreOp kBasicLoadStoreOp =
|
| + GrGpuCommandBuffer::kLoadAndStore_LoadAndStoreOp;
|
| + static const GrColor kClearValue = GrColor_ILLEGAL;
|
| + commandBuffer = fGpu->createCommandBuffer(currentRT,
|
| + kBasicLoadStoreOp, // Color load/store
|
| + kClearValue, // Color clear value
|
| + kBasicLoadStoreOp, // Stencil load/store
|
| + kClearValue); // Stencil clear value
|
| + }
|
| + }
|
| if (fDrawBatchBounds) {
|
| const SkRect& bounds = fBatches[i]->bounds();
|
| SkIRect ibounds;
|
| @@ -223,7 +248,15 @@ void GrDrawTarget::drawBatches(GrBatchFlushState* flushState) {
|
| fGpu->drawDebugWireRect(rt, ibounds, 0xFF000000 | random.nextU());
|
| }
|
| }
|
| - fBatches[i]->draw(flushState);
|
| + fBatches[i]->draw(flushState, commandBuffer);
|
| + }
|
| + if (commandBuffer) {
|
| + commandBuffer->end();
|
| + // For now just use size of whole render target, but this should be updated to
|
| + // only be the actual bounds of the various draws.
|
| + SkIRect bounds = SkIRect::MakeWH(currentRT->width(), currentRT->height());
|
| + commandBuffer->submit(bounds);
|
| + delete commandBuffer;
|
| }
|
|
|
| fGpu->finishDrawTarget();
|
|
|