Index: src/gpu/GrDrawTarget.cpp |
diff --git a/src/gpu/GrDrawTarget.cpp b/src/gpu/GrDrawTarget.cpp |
index 7213a92152af7d1efca0a48c65e815074a38a9a1..bd3caf5e44cf8d8fe6d239df2def11bd3c3b72e9 100644 |
--- a/src/gpu/GrDrawTarget.cpp |
+++ b/src/gpu/GrDrawTarget.cpp |
@@ -32,6 +32,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. |
@@ -44,7 +46,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(); |
@@ -204,6 +207,10 @@ void GrDrawTarget::prepareBatches(GrBatchFlushState* flushState) { |
fBatches[i]->prepare(flushState); |
} |
} |
+ |
+ if (fInstancedRendering) { |
+ fInstancedRendering->beginFlush(flushState->resourceProvider()); |
+ } |
} |
void GrDrawTarget::drawBatches(GrBatchFlushState* flushState) { |
@@ -231,6 +238,9 @@ void GrDrawTarget::drawBatches(GrBatchFlushState* flushState) { |
void GrDrawTarget::reset() { |
fBatches.reset(); |
+ if (fInstancedRendering) { |
+ fInstancedRendering->endFlush(); |
+ } |
} |
void GrDrawTarget::drawBatch(const GrPipelineBuilder& pipelineBuilder, |