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

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

Issue 1243583002: Add support for transformedLocalCoords to GrDefaultGeoProc (Closed) Base URL: https://skia.googlesource.com/skia.git@pipelinetobatch2
Patch Set: tweaks Created 5 years, 4 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
« no previous file with comments | « src/gpu/GrPrimitiveProcessor.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
(...skipping 23 matching lines...) Expand all
34 template <class GeometryProcessor> 34 template <class GeometryProcessor>
35 void setTransformDataHelper(const GrPrimitiveProcessor& primProc, 35 void setTransformDataHelper(const GrPrimitiveProcessor& primProc,
36 const GrGLProgramDataManager& pdman, 36 const GrGLProgramDataManager& 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 // A helper for subclasses which don't have an explicit local matrix 44 // Emit a uniform matrix for each coord transform.
45 void emitTransforms(GrGLGPBuilder* gp, 45 void emitTransforms(GrGLGPBuilder* 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 void emitTransforms(GrGLGPBuilder*, 54 void emitTransforms(GrGLGPBuilder*,
54 const GrShaderVar& posVar, 55 const GrShaderVar& posVar,
55 const char* localCoords, 56 const char* localCoords,
56 const SkMatrix& localMatrix, 57 const SkMatrix& localMatrix,
57 const TransformsIn&, 58 const TransformsIn&,
58 TransformsOut*); 59 TransformsOut*);
59 60
61 // caller has emitted transforms via attributes
62 void emitTransforms(GrGLGPBuilder*,
63 const char* localCoords,
64 const TransformsIn& tin,
65 TransformsOut* tout);
66
60 struct GrGPArgs { 67 struct GrGPArgs {
61 // 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
62 // 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.
63 GrShaderVar fPositionVar; 70 GrShaderVar fPositionVar;
64 }; 71 };
65 72
66 // Create the correct type of position variable given the CTM 73 // Create the correct type of position variable given the CTM
67 void setupPosition(GrGLGPBuilder*, GrGPArgs*, const char* posName); 74 void setupPosition(GrGLGPBuilder*, GrGPArgs*, const char* posName);
68 void setupPosition(GrGLGPBuilder*, GrGPArgs*, const char* posName, const SkM atrix& mat, 75 void setupPosition(GrGLGPBuilder*, GrGPArgs*, const char* posName, const SkM atrix& mat,
69 UniformHandle* viewMatrixUniform); 76 UniformHandle* viewMatrixUniform);
(...skipping 24 matching lines...) Expand all
94 } 101 }
95 } 102 }
96 } 103 }
97 104
98 virtual void onEmitCode(EmitArgs&, GrGPArgs*) = 0; 105 virtual void onEmitCode(EmitArgs&, GrGPArgs*) = 0;
99 106
100 typedef GrGLPrimitiveProcessor INHERITED; 107 typedef GrGLPrimitiveProcessor INHERITED;
101 }; 108 };
102 109
103 #endif 110 #endif
OLDNEW
« no previous file with comments | « src/gpu/GrPrimitiveProcessor.h ('k') | src/gpu/gl/GrGLGeometryProcessor.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698