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

Unified Diff: src/gpu/GrDrawTarget.cpp

Issue 1897203002: Implement instanced rendering for simple shapes (Closed) Base URL: https://skia.googlesource.com/skia.git@upload2_requireHWAA
Patch Set: comments Created 4 years, 8 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
« no previous file with comments | « src/gpu/GrDrawTarget.h ('k') | src/gpu/GrDrawingManager.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrDrawTarget.cpp
diff --git a/src/gpu/GrDrawTarget.cpp b/src/gpu/GrDrawTarget.cpp
index 49c46feeaf62e390b91ccb21d9a3f6e8e0dce243..0a518bbcbb1777e71342253e8b9033a295f12aa5 100644
--- a/src/gpu/GrDrawTarget.cpp
+++ b/src/gpu/GrDrawTarget.cpp
@@ -16,6 +16,7 @@
#include "GrRenderTarget.h"
#include "GrResourceProvider.h"
#include "GrRenderTargetPriv.h"
+#include "GrInstancedRendering.h"
#include "GrSurfacePriv.h"
#include "GrTexture.h"
#include "gl/GrGLRenderTarget.h"
@@ -42,7 +43,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();
fClipMaskManager.reset(new GrClipMaskManager(this, options.fClipBatchToBounds));
@@ -202,6 +204,10 @@ void GrDrawTarget::prepareBatches(GrBatchFlushState* flushState) {
fBatches[i]->prepare(flushState);
}
}
+
+ if (fInstancedRendering) {
+ fInstancedRendering->beginFlush(flushState->resourceProvider());
+ }
}
void GrDrawTarget::drawBatches(GrBatchFlushState* flushState) {
@@ -229,6 +235,9 @@ void GrDrawTarget::drawBatches(GrBatchFlushState* flushState) {
void GrDrawTarget::reset() {
fBatches.reset();
+ if (fInstancedRendering) {
+ fInstancedRendering->endFlush();
+ }
}
void GrDrawTarget::drawBatch(const GrPipelineBuilder& pipelineBuilder,
« no previous file with comments | « src/gpu/GrDrawTarget.h ('k') | src/gpu/GrDrawingManager.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698