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 namespace gr_instanced { |
| 17 |
| 18 class GLInstancedRendering final : public InstancedRendering { |
| 19 public: |
| 20 static GLInstancedRendering* CreateIfSupported(GrGLGpu*); |
| 21 ~GLInstancedRendering() override; |
| 22 |
| 23 private: |
| 24 GLInstancedRendering(GrGLGpu*, AntialiasMode lastSupportedAAMode); |
| 25 |
| 26 GrGLGpu* glGpu() const; |
| 27 |
| 28 Batch* createBatch(int instanceIdx) override; |
| 29 |
| 30 void onBeginFlush(GrResourceProvider*) override; |
| 31 void onDraw(const GrPipeline&, const InstanceProcessor&, const Batch*) overr
ide; |
| 32 void onEndFlush() override; |
| 33 void onResetGpuResources(ResetType) override; |
| 34 |
| 35 void flushInstanceAttribs(int baseInstance); |
| 36 |
| 37 struct GLDrawCmdInfo { |
| 38 int fInstanceCount; |
| 39 }; |
| 40 |
| 41 GrGLuint fVertexArrayID; |
| 42 SkAutoTUnref<GrGLBuffer> fInstanceBuffer; |
| 43 SkAutoTUnref<GrGLBuffer> fDrawIndirectBuffer; |
| 44 SkAutoSTMalloc<1024, GLDrawCmdInfo> fGLDrawCmdsInfo; |
| 45 uint32_t fInstanceAttribsBufferUniqueId; |
| 46 int fInstanceAttribsBaseInstance; |
| 47 |
| 48 class GLBatch; |
| 49 |
| 50 typedef InstancedRendering INHERITED; |
| 51 }; |
| 52 |
| 53 } |
| 54 |
| 55 #endif |
OLD | NEW |