| OLD | NEW |
| (Empty) |
| 1 /* | |
| 2 * Copyright 2016 Google Inc. | |
| 3 * | |
| 4 * Use of this source code is governed by a BSD-style license that can be | |
| 5 * found in the LICENSE file. | |
| 6 */ | |
| 7 | |
| 8 #ifndef gr_instanced_GLInstancedRendering_DEFINED | |
| 9 #define gr_instanced_GLInstancedRendering_DEFINED | |
| 10 | |
| 11 #include "gl/GrGLBuffer.h" | |
| 12 #include "instanced/InstancedRendering.h" | |
| 13 | |
| 14 class GrGLGpu; | |
| 15 | |
| 16 #define GR_GL_LOG_INSTANCED_BATCHES 0 | |
| 17 | |
| 18 namespace gr_instanced { | |
| 19 | |
| 20 class GLInstancedRendering final : public InstancedRendering { | |
| 21 public: | |
| 22 static GLInstancedRendering* CreateIfSupported(GrGLGpu*); | |
| 23 ~GLInstancedRendering() override; | |
| 24 | |
| 25 private: | |
| 26 GLInstancedRendering(GrGLGpu*, AntialiasMode lastSupportedAAMode); | |
| 27 | |
| 28 GrGLGpu* glGpu() const; | |
| 29 | |
| 30 Batch* createBatch() override; | |
| 31 | |
| 32 void onBeginFlush(GrResourceProvider*) override; | |
| 33 void onDraw(const GrPipeline&, const InstanceProcessor&, const Batch*) overr
ide; | |
| 34 void onEndFlush() override; | |
| 35 void onResetGpuResources(ResetType) override; | |
| 36 | |
| 37 void flushInstanceAttribs(int baseInstance); | |
| 38 | |
| 39 struct GLDrawCmdInfo { | |
| 40 int fInstanceCount; | |
| 41 #if GR_GL_LOG_INSTANCED_BATCHES | |
| 42 IndexRange fGeometry; | |
| 43 #endif | |
| 44 }; | |
| 45 | |
| 46 GrGLuint fVertexArrayID; | |
| 47 SkAutoTUnref<GrGLBuffer> fInstanceBuffer; | |
| 48 SkAutoTUnref<GrGLBuffer> fDrawIndirectBuffer; | |
| 49 SkAutoSTMalloc<1024, GLDrawCmdInfo> fGLDrawCmdsInfo; | |
| 50 uint32_t fInstanceAttribsBufferUniqueId; | |
| 51 int fInstanceAttribsBaseInstance; | |
| 52 | |
| 53 class GLBatch; | |
| 54 | |
| 55 typedef InstancedRendering INHERITED; | |
| 56 }; | |
| 57 | |
| 58 } | |
| 59 | |
| 60 #endif | |
| OLD | NEW |