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

Unified Diff: src/gpu/instanced/InstanceProcessor.h

Issue 2066993003: Begin instanced rendering for simple shapes (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Rix perf regressions Created 4 years, 5 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/instanced/GLInstancedRendering.cpp ('k') | src/gpu/instanced/InstanceProcessor.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/instanced/InstanceProcessor.h
diff --git a/src/gpu/instanced/InstanceProcessor.h b/src/gpu/instanced/InstanceProcessor.h
new file mode 100644
index 0000000000000000000000000000000000000000..b0edde95b8262137f4d6cc1f653f0f7d7bc2240c
--- /dev/null
+++ b/src/gpu/instanced/InstanceProcessor.h
@@ -0,0 +1,63 @@
+/*
+ * Copyright 2016 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef gr_instanced_InstanceProcessor_DEFINED
+#define gr_instanced_InstanceProcessor_DEFINED
+
+#include "GrBufferAccess.h"
+#include "GrGeometryProcessor.h"
+#include "instanced/InstancedRenderingTypes.h"
+
+namespace gr_instanced {
+
+/**
+ * This class provides a GP implementation that uses instanced rendering. Is sends geometry in as
+ * basic, pre-baked canonical shapes, and uses instanced vertex attribs to control how these shapes
+ * are transformed and drawn. MSAA is accomplished with the sample mask rather than finely
+ * tesselated geometry.
+ */
+class InstanceProcessor : public GrGeometryProcessor {
+public:
+ static bool IsSupported(const GrGLSLCaps&, const GrCaps&, AntialiasMode* lastSupportedAAMode);
+
+ InstanceProcessor(BatchInfo, GrBuffer* paramsBuffer);
+
+ const char* name() const override { return "Instance Processor"; }
+ BatchInfo batchInfo() const { return fBatchInfo; }
+
+ void getGLSLProcessorKey(const GrGLSLCaps&, GrProcessorKeyBuilder* b) const override {
+ b->add32(fBatchInfo.fData);
+ }
+ GrGLSLPrimitiveProcessor* createGLSLInstance(const GrGLSLCaps&) const override;
+
+ /**
+ * Returns a buffer of ShapeVertex that defines the canonical instanced geometry.
+ */
+ static const GrBuffer* SK_WARN_UNUSED_RESULT FindOrCreateVertexBuffer(GrGpu*);
+
+ /**
+ * Returns a buffer of 8-bit indices for the canonical instanced geometry. The client can call
+ * GetIndexRangeForXXX to know which indices to use for a specific shape.
+ */
+ static const GrBuffer* SK_WARN_UNUSED_RESULT FindOrCreateIndex8Buffer(GrGpu*);
+
+ static IndexRange GetIndexRangeForRect(AntialiasMode);
+ static IndexRange GetIndexRangeForOval(AntialiasMode, const SkRect& devBounds);
+ static IndexRange GetIndexRangeForRRect(AntialiasMode);
+
+ static const char* GetNameOfIndexRange(IndexRange);
+
+private:
+ const BatchInfo fBatchInfo;
+ GrBufferAccess fParamsAccess;
+
+ typedef GrGeometryProcessor INHERITED;
+};
+
+}
+
+#endif
« no previous file with comments | « src/gpu/instanced/GLInstancedRendering.cpp ('k') | src/gpu/instanced/InstanceProcessor.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698