Chromium Code Reviews| 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 GrInstanceProcessor_DEFINED | |
| 9 #define GrInstanceProcessor_DEFINED | |
| 10 | |
| 11 #include "GrBufferAccess.h" | |
| 12 #include "GrGeometryProcessor.h" | |
| 13 #include "GrInstancedRenderingTypes.h" | |
| 14 | |
| 15 /** | |
| 16 * This class provides a GP implementation that uses instanced rendering. Is sen ds geometry in as | |
| 17 * basic, pre-baked canonical shapes, and uses instanced vertex attribs to contr ol how these shapes | |
| 18 * are transformed and drawn. MSAA is accomplished with the sample mask rather t han finely | |
| 19 * tesselated geometry. | |
| 20 */ | |
| 21 class GrInstanceProcessor : public GrGeometryProcessor, private GrInstancedRende ringTypes { | |
| 22 public: | |
| 23 static uint32_t GetSupportedAAModes(const GrGLSLCaps&, const GrCaps&); | |
|
bsalomon
2016/04/25 13:22:39
Having GLSL caps here is sort of violation of the
Chris Dalton
2016/04/25 17:01:19
Is it really a layering violation when the class h
bsalomon
2016/04/27 14:10:32
It is definitely the case that if we added another
| |
| 24 | |
| 25 GrInstanceProcessor(BatchTracker, GrBuffer* paramsBuffer, AntialiasMode); | |
| 26 | |
| 27 const char* name() const override { return "Instance Processor"; } | |
| 28 BatchTracker tracker() const { return fTracker; } | |
| 29 AntialiasMode antialiasMode() const { return fAntialiasMode; } | |
| 30 | |
| 31 void getGLSLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) c onst override; | |
| 32 GrGLSLPrimitiveProcessor* createGLSLInstance(const GrGLSLCaps&) const overri de; | |
| 33 | |
| 34 /** | |
| 35 * Returns a buffer of ShapeVertex that defines the canonical instanced geom etry. | |
| 36 */ | |
| 37 static const GrBuffer* SK_WARN_UNUSED_RESULT FindOrCreateVertexBuffer(GrGpu* ); | |
| 38 | |
| 39 /** | |
| 40 * Returns a buffer of 8-bit indices for the canonical instanced geometry. T he client can call | |
| 41 * GetIndexRangeForXXX to know which indices to use for a specific shape. | |
| 42 */ | |
| 43 static const GrBuffer* SK_WARN_UNUSED_RESULT FindOrCreateIndex8Buffer(GrGpu* ); | |
| 44 | |
| 45 static void GetIndexRangeForRect(AntialiasMode, uint32_t* firstIndex, uint32 _t* count); | |
| 46 static void GetIndexRangeForOval(AntialiasMode, const SkRect& devBounds, uin t32_t* firstIndex, | |
| 47 uint32_t* count); | |
| 48 static void GetIndexRangeForRRect(AntialiasMode, uint32_t* firstIndex, uint3 2_t* count); | |
| 49 | |
| 50 private: | |
| 51 const BatchTracker fTracker; | |
| 52 const AntialiasMode fAntialiasMode; | |
| 53 GrBufferAccess fParamsAccess; | |
| 54 | |
| 55 typedef GrGeometryProcessor INHERITED; | |
| 56 }; | |
| 57 | |
| 58 #endif | |
| OLD | NEW |