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

Side by Side Diff: src/gpu/gl/GrGLGeometryProcessor.h

Issue 1416423003: Make GrGLSLProgramBuilder base class for ProgramBuilder (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: nit Created 5 years, 1 month 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
« no previous file with comments | « src/gpu/gl/GrGLFragmentProcessor.h ('k') | src/gpu/gl/GrGLGeometryProcessor.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 GrGLGeometryProcessor_DEFINED 8 #ifndef GrGLGeometryProcessor_DEFINED
9 #define GrGLGeometryProcessor_DEFINED 9 #define GrGLGeometryProcessor_DEFINED
10 10
11 #include "GrGLPrimitiveProcessor.h" 11 #include "GrGLPrimitiveProcessor.h"
12 12
13 class GrGLGPBuilder; 13 class GrGLSLGPBuilder;
14 14
15 /** 15 /**
16 * If a GL effect needs a GrGLFullShaderBuilder* object to emit vertex code, the n it must inherit 16 * If a GL effect needs a GrGLFullShaderBuilder* object to emit vertex code, the n it must inherit
17 * from this class. Since paths don't have vertices, this class is only meant to be used internally 17 * from this class. Since paths don't have vertices, this class is only meant to be used internally
18 * by skia, for special cases. 18 * by skia, for special cases.
19 */ 19 */
20 class GrGLGeometryProcessor : public GrGLPrimitiveProcessor { 20 class GrGLGeometryProcessor : public GrGLPrimitiveProcessor {
21 public: 21 public:
22 /* Any general emit code goes in the base class emitCode. Subclasses overri de onEmitCode */ 22 /* Any general emit code goes in the base class emitCode. Subclasses overri de onEmitCode */
23 void emitCode(EmitArgs&) override; 23 void emitCode(EmitArgs&) override;
(...skipping 11 matching lines...) Expand all
35 void setTransformDataHelper(const GrPrimitiveProcessor& primProc, 35 void setTransformDataHelper(const GrPrimitiveProcessor& primProc,
36 const GrGLSLProgramDataManager& pdman, 36 const GrGLSLProgramDataManager& pdman,
37 int index, 37 int index,
38 const SkTArray<const GrCoordTransform*, true>& t ransforms) { 38 const SkTArray<const GrCoordTransform*, true>& t ransforms) {
39 const GeometryProcessor& gp = primProc.cast<GeometryProcessor>(); 39 const GeometryProcessor& gp = primProc.cast<GeometryProcessor>();
40 this->setTransformDataMatrix(gp.localMatrix(), pdman, index, transforms) ; 40 this->setTransformDataMatrix(gp.localMatrix(), pdman, index, transforms) ;
41 } 41 }
42 42
43 protected: 43 protected:
44 // Emit a uniform matrix for each coord transform. 44 // Emit a uniform matrix for each coord transform.
45 void emitTransforms(GrGLGPBuilder* gp, 45 void emitTransforms(GrGLSLGPBuilder* gp,
46 const GrShaderVar& posVar, 46 const GrShaderVar& posVar,
47 const char* localCoords, 47 const char* localCoords,
48 const TransformsIn& tin, 48 const TransformsIn& tin,
49 TransformsOut* tout) { 49 TransformsOut* tout) {
50 this->emitTransforms(gp, posVar, localCoords, SkMatrix::I(), tin, tout); 50 this->emitTransforms(gp, posVar, localCoords, SkMatrix::I(), tin, tout);
51 } 51 }
52 52
53 // Emit pre-transformed coords as a vertex attribute per coord-transform. 53 // Emit pre-transformed coords as a vertex attribute per coord-transform.
54 void emitTransforms(GrGLGPBuilder*, 54 void emitTransforms(GrGLSLGPBuilder*,
55 const GrShaderVar& posVar, 55 const GrShaderVar& posVar,
56 const char* localCoords, 56 const char* localCoords,
57 const SkMatrix& localMatrix, 57 const SkMatrix& localMatrix,
58 const TransformsIn&, 58 const TransformsIn&,
59 TransformsOut*); 59 TransformsOut*);
60 60
61 // caller has emitted transforms via attributes 61 // caller has emitted transforms via attributes
62 void emitTransforms(GrGLGPBuilder*, 62 void emitTransforms(GrGLSLGPBuilder*,
63 const char* localCoords, 63 const char* localCoords,
64 const TransformsIn& tin, 64 const TransformsIn& tin,
65 TransformsOut* tout); 65 TransformsOut* tout);
66 66
67 struct GrGPArgs { 67 struct GrGPArgs {
68 // The variable used by a GP to store its position. It can be 68 // The variable used by a GP to store its position. It can be
69 // either a vec2 or a vec3 depending on the presence of perspective. 69 // either a vec2 or a vec3 depending on the presence of perspective.
70 GrShaderVar fPositionVar; 70 GrShaderVar fPositionVar;
71 }; 71 };
72 72
73 // Create the correct type of position variable given the CTM 73 // Create the correct type of position variable given the CTM
74 void setupPosition(GrGLGPBuilder*, GrGPArgs*, const char* posName); 74 void setupPosition(GrGLSLGPBuilder*, GrGPArgs*, const char* posName);
75 void setupPosition(GrGLGPBuilder*, GrGPArgs*, const char* posName, const SkM atrix& mat, 75 void setupPosition(GrGLSLGPBuilder*, GrGPArgs*, const char* posName, const S kMatrix& mat,
76 UniformHandle* viewMatrixUniform); 76 UniformHandle* viewMatrixUniform);
77 77
78 static uint32_t ComputePosKey(const SkMatrix& mat) { 78 static uint32_t ComputePosKey(const SkMatrix& mat) {
79 if (mat.isIdentity()) { 79 if (mat.isIdentity()) {
80 return 0x0; 80 return 0x0;
81 } else if (!mat.hasPerspective()) { 81 } else if (!mat.hasPerspective()) {
82 return 0x01; 82 return 0x01;
83 } else { 83 } else {
84 return 0x02; 84 return 0x02;
85 } 85 }
(...skipping 15 matching lines...) Expand all
101 } 101 }
102 } 102 }
103 } 103 }
104 104
105 virtual void onEmitCode(EmitArgs&, GrGPArgs*) = 0; 105 virtual void onEmitCode(EmitArgs&, GrGPArgs*) = 0;
106 106
107 typedef GrGLPrimitiveProcessor INHERITED; 107 typedef GrGLPrimitiveProcessor INHERITED;
108 }; 108 };
109 109
110 #endif 110 #endif
OLDNEW
« no previous file with comments | « src/gpu/gl/GrGLFragmentProcessor.h ('k') | src/gpu/gl/GrGLGeometryProcessor.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698