Index: src/gpu/GrDrawTarget.cpp |
diff --git a/src/gpu/GrDrawTarget.cpp b/src/gpu/GrDrawTarget.cpp |
index fc3caf5212369b06a0de54fcd8d408df185b225f..86e0c82f225f1a6cf32e54602cb50c3c2375af82 100644 |
--- a/src/gpu/GrDrawTarget.cpp |
+++ b/src/gpu/GrDrawTarget.cpp |
@@ -33,6 +33,8 @@ |
#include "batches/GrRectBatchFactory.h" |
#include "batches/GrStencilPathBatch.h" |
+#include "instanced/InstancedRendering.h" |
+ |
//////////////////////////////////////////////////////////////////////////////// |
// Experimentally we have found that most batching occurs within the first 10 comparisons. |
@@ -45,7 +47,8 @@ GrDrawTarget::GrDrawTarget(GrRenderTarget* rt, GrGpu* gpu, GrResourceProvider* r |
, fResourceProvider(resourceProvider) |
, fAuditTrail(auditTrail) |
, fFlags(0) |
- , fRenderTarget(rt) { |
+ , fRenderTarget(rt) |
+ , fInstancedRendering(fGpu->createInstancedRenderingIfSupported()) { |
// TODO: Stop extracting the context (currently needed by GrClipMaskManager) |
fContext = fGpu->getContext(); |
@@ -201,6 +204,10 @@ void GrDrawTarget::prepareBatches(GrBatchFlushState* flushState) { |
fBatches[i]->prepare(flushState); |
} |
} |
+ |
+ if (fInstancedRendering) { |
+ fInstancedRendering->beginFlush(flushState->resourceProvider()); |
+ } |
} |
void GrDrawTarget::drawBatches(GrBatchFlushState* flushState) { |
@@ -269,6 +276,9 @@ void GrDrawTarget::drawBatches(GrBatchFlushState* flushState) { |
void GrDrawTarget::reset() { |
fBatches.reset(); |
+ if (fInstancedRendering) { |
+ fInstancedRendering->endFlush(); |
+ } |
} |
void GrDrawTarget::drawBatch(const GrPipelineBuilder& pipelineBuilder, |