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

Side by Side Diff: src/gpu/GrGeometryProcessor.h

Issue 845103005: GrBatchPrototype (Closed) Base URL: https://skia.googlesource.com/skia.git@lc2
Patch Set: a bit more tweaking Created 5 years, 11 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright 2013 Google Inc. 2 * Copyright 2013 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #ifndef GrGeometryProcessor_DEFINED 8 #ifndef GrGeometryProcessor_DEFINED
9 #define GrGeometryProcessor_DEFINED 9 #define GrGeometryProcessor_DEFINED
10 10
11 #include "GrColor.h" 11 #include "GrColor.h"
12 #include "GrGeometryData.h"
13 #include "GrProcessor.h" 12 #include "GrProcessor.h"
14 #include "GrShaderVar.h" 13 #include "GrShaderVar.h"
15 14
16 /* 15 /*
17 * The GrPrimitiveProcessor represents some kind of geometric primitive. This i ncludes the shape 16 * The GrPrimitiveProcessor represents some kind of geometric primitive. This i ncludes the shape
18 * of the primitive and the inherent color of the primitive. The GrPrimitivePro cessor is 17 * of the primitive and the inherent color of the primitive. The GrPrimitivePro cessor is
19 * responsible for providing a color and coverage input into the Ganesh renderin g pipeline. Through 18 * responsible for providing a color and coverage input into the Ganesh renderin g pipeline. Through
20 * optimization, Ganesh may decide a different color, no color, and / or no cove rage are required 19 * optimization, Ganesh may decide a different color, no color, and / or no cove rage are required
21 * from the GrPrimitiveProcessor, so the GrPrimitiveProcessor must be able to su pport this 20 * from the GrPrimitiveProcessor, so the GrPrimitiveProcessor must be able to su pport this
22 * functionality. We also use the GrPrimitiveProcessor to make batching decisio ns. 21 * functionality. We also use the GrPrimitiveProcessor to make batching decisio ns.
(...skipping 16 matching lines...) Expand all
39 * it draws. Each primitive draw will bundle all required data to perform the d raw, and these 38 * it draws. Each primitive draw will bundle all required data to perform the d raw, and these
40 * bundles of data will be owned by an instance of the associated GrPrimitivePro cessor. Bundles 39 * bundles of data will be owned by an instance of the associated GrPrimitivePro cessor. Bundles
41 * can be updated alongside the GrBatchTracker struct itself, ultimately allowin g the 40 * can be updated alongside the GrBatchTracker struct itself, ultimately allowin g the
42 * GrPrimitiveProcessor complete control of how it gets data into the fragment s hader as long as 41 * GrPrimitiveProcessor complete control of how it gets data into the fragment s hader as long as
43 * it emits the appropriate color, or none at all, as directed. 42 * it emits the appropriate color, or none at all, as directed.
44 */ 43 */
45 44
46 /* 45 /*
47 * A struct for tracking batching decisions. While this lives on GrOptState, it is managed 46 * A struct for tracking batching decisions. While this lives on GrOptState, it is managed
48 * entirely by the derived classes of the GP. 47 * entirely by the derived classes of the GP.
48 * // TODO this was an early attempt at handling out of order batching. It shou ld be
49 * used carefully as it is being replaced by GrBatch
49 */ 50 */
50 class GrBatchTracker { 51 class GrBatchTracker {
51 public: 52 public:
52 template <typename T> const T& cast() const { 53 template <typename T> const T& cast() const {
53 SkASSERT(sizeof(T) <= kMaxSize); 54 SkASSERT(sizeof(T) <= kMaxSize);
54 return *reinterpret_cast<const T*>(fData.get()); 55 return *reinterpret_cast<const T*>(fData.get());
55 } 56 }
56 57
57 template <typename T> T* cast() { 58 template <typename T> T* cast() {
58 SkASSERT(sizeof(T) <= kMaxSize); 59 SkASSERT(sizeof(T) <= kMaxSize);
59 return reinterpret_cast<T*>(fData.get()); 60 return reinterpret_cast<T*>(fData.get());
60 } 61 }
61 62
62 static const size_t kMaxSize = 32; 63 static const size_t kMaxSize = 32;
63 64
64 private: 65 private:
65 SkAlignedSStorage<kMaxSize> fData; 66 SkAlignedSStorage<kMaxSize> fData;
66 }; 67 };
67 68
69 class GrIndexBufferAllocPool;
68 class GrGLCaps; 70 class GrGLCaps;
69 class GrGLPrimitiveProcessor; 71 class GrGLPrimitiveProcessor;
70 class GrOptDrawState; 72 class GrOptDrawState;
73 class GrVertexBufferAllocPool;
71 74
72 struct GrInitInvariantOutput; 75 struct GrInitInvariantOutput;
73 76
74
75 /* 77 /*
76 * This enum is shared by GrPrimitiveProcessors and GrGLPrimitiveProcessors to c oordinate shaders 78 * This enum is shared by GrPrimitiveProcessors and GrGLPrimitiveProcessors to c oordinate shaders
77 * with vertex attributes / uniforms. 79 * with vertex attributes / uniforms.
78 */ 80 */
79 enum GrGPInput { 81 enum GrGPInput {
80 kAllOnes_GrGPInput, 82 kAllOnes_GrGPInput,
81 kAttribute_GrGPInput, 83 kAttribute_GrGPInput,
82 kUniform_GrGPInput, 84 kUniform_GrGPInput,
83 kIgnored_GrGPInput, 85 kIgnored_GrGPInput,
84 }; 86 };
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 407
406 private: 408 private:
407 bool hasExplicitLocalCoords() const SK_OVERRIDE { return false; } 409 bool hasExplicitLocalCoords() const SK_OVERRIDE { return false; }
408 410
409 GrColor fColor; 411 GrColor fColor;
410 412
411 typedef GrPrimitiveProcessor INHERITED; 413 typedef GrPrimitiveProcessor INHERITED;
412 }; 414 };
413 415
414 #endif 416 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698