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

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

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/instanced/GLInstancedRendering.h
diff --git a/src/gpu/instanced/GLInstancedRendering.h b/src/gpu/instanced/GLInstancedRendering.h
new file mode 100644
index 0000000000000000000000000000000000000000..fc6f5c99151f28eb2858c8baa157c1642160d32f
--- /dev/null
+++ b/src/gpu/instanced/GLInstancedRendering.h
@@ -0,0 +1,55 @@
+/*
+ * 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_GLInstancedRendering_DEFINED
+#define gr_instanced_GLInstancedRendering_DEFINED
+
+#include "gl/GrGLBuffer.h"
+#include "instanced/InstancedRendering.h"
+
+class GrGLGpu;
+
+namespace gr_instanced {
+
+class GLInstancedRendering final : public InstancedRendering {
+public:
+ static GLInstancedRendering* CreateIfSupported(GrGLGpu*);
+ ~GLInstancedRendering() override;
+
+private:
+ GLInstancedRendering(GrGLGpu*, AntialiasMode lastSupportedAAMode);
+
+ GrGLGpu* glGpu() const;
+
+ Batch* createBatch(int instanceIdx) override;
+
+ void onBeginFlush(GrResourceProvider*) override;
+ void onDraw(const GrPipeline&, const InstanceProcessor&, const Batch*) override;
+ void onEndFlush() override;
+ void onResetGpuResources(ResetType) override;
+
+ void flushInstanceAttribs(int baseInstance);
+
+ struct GLDrawCmdInfo {
+ int fInstanceCount;
+ };
+
+ GrGLuint fVertexArrayID;
+ SkAutoTUnref<GrGLBuffer> fInstanceBuffer;
+ SkAutoTUnref<GrGLBuffer> fDrawIndirectBuffer;
+ SkAutoSTMalloc<1024, GLDrawCmdInfo> fGLDrawCmdsInfo;
+ uint32_t fInstanceAttribsBufferUniqueId;
+ int fInstanceAttribsBaseInstance;
+
+ class GLBatch;
+
+ typedef InstancedRendering INHERITED;
+};
+
+}
+
+#endif

Powered by Google App Engine
This is Rietveld 408576698