Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(760)

Unified Diff: src/gpu/GrDrawTarget.cpp

Issue 2066993003: Begin instanced rendering for simple shapes (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: get mixed samples and base instance paths working again Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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,

Powered by Google App Engine
This is Rietveld 408576698