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

Side by Side Diff: src/gpu/glsl/GrGLSLGeometryProcessor.h

Issue 1457543003: Add ShaderBuilders to EmitArgs and remove gettings from ProgBuilder. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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/glsl/GrGLSLFragmentProcessor.cpp ('k') | src/gpu/glsl/GrGLSLGeometryProcessor.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 GrGLSLGeometryProcessor_DEFINED 8 #ifndef GrGLSLGeometryProcessor_DEFINED
9 #define GrGLSLGeometryProcessor_DEFINED 9 #define GrGLSLGeometryProcessor_DEFINED
10 10
(...skipping 25 matching lines...) Expand all
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(GrGLSLGPBuilder* gp, 45 void emitTransforms(GrGLSLGPBuilder* gp,
46 GrGLSLVertexBuilder* vb,
46 const GrShaderVar& posVar, 47 const GrShaderVar& posVar,
47 const char* localCoords, 48 const char* localCoords,
48 const TransformsIn& tin, 49 const TransformsIn& tin,
49 TransformsOut* tout) { 50 TransformsOut* tout) {
50 this->emitTransforms(gp, posVar, localCoords, SkMatrix::I(), tin, tout); 51 this->emitTransforms(gp, vb, posVar, localCoords, SkMatrix::I(), tin, to ut);
51 } 52 }
52 53
53 // Emit pre-transformed coords as a vertex attribute per coord-transform. 54 // Emit pre-transformed coords as a vertex attribute per coord-transform.
54 void emitTransforms(GrGLSLGPBuilder*, 55 void emitTransforms(GrGLSLGPBuilder*,
56 GrGLSLVertexBuilder*,
55 const GrShaderVar& posVar, 57 const GrShaderVar& posVar,
56 const char* localCoords, 58 const char* localCoords,
57 const SkMatrix& localMatrix, 59 const SkMatrix& localMatrix,
58 const TransformsIn&, 60 const TransformsIn&,
59 TransformsOut*); 61 TransformsOut*);
60 62
61 // caller has emitted transforms via attributes 63 // caller has emitted transforms via attributes
62 void emitTransforms(GrGLSLGPBuilder*, 64 void emitTransforms(GrGLSLGPBuilder*,
65 GrGLSLVertexBuilder*,
63 const char* localCoords, 66 const char* localCoords,
64 const TransformsIn& tin, 67 const TransformsIn& tin,
65 TransformsOut* tout); 68 TransformsOut* tout);
66 69
67 struct GrGPArgs { 70 struct GrGPArgs {
68 // The variable used by a GP to store its position. It can be 71 // 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. 72 // either a vec2 or a vec3 depending on the presence of perspective.
70 GrShaderVar fPositionVar; 73 GrShaderVar fPositionVar;
71 }; 74 };
72 75
73 // Create the correct type of position variable given the CTM 76 // Create the correct type of position variable given the CTM
74 void setupPosition(GrGLSLGPBuilder*, GrGPArgs*, const char* posName); 77 void setupPosition(GrGLSLGPBuilder*, GrGLSLVertexBuilder*, GrGPArgs*, const char* posName);
75 void setupPosition(GrGLSLGPBuilder*, GrGPArgs*, const char* posName, const S kMatrix& mat, 78 void setupPosition(GrGLSLGPBuilder*,
79 GrGLSLVertexBuilder*,
80 GrGPArgs*,
81 const char* posName,
82 const SkMatrix& mat,
76 UniformHandle* viewMatrixUniform); 83 UniformHandle* viewMatrixUniform);
77 84
78 static uint32_t ComputePosKey(const SkMatrix& mat) { 85 static uint32_t ComputePosKey(const SkMatrix& mat) {
79 if (mat.isIdentity()) { 86 if (mat.isIdentity()) {
80 return 0x0; 87 return 0x0;
81 } else if (!mat.hasPerspective()) { 88 } else if (!mat.hasPerspective()) {
82 return 0x01; 89 return 0x01;
83 } else { 90 } else {
84 return 0x02; 91 return 0x02;
85 } 92 }
(...skipping 15 matching lines...) Expand all
101 } 108 }
102 } 109 }
103 } 110 }
104 111
105 virtual void onEmitCode(EmitArgs&, GrGPArgs*) = 0; 112 virtual void onEmitCode(EmitArgs&, GrGPArgs*) = 0;
106 113
107 typedef GrGLSLPrimitiveProcessor INHERITED; 114 typedef GrGLSLPrimitiveProcessor INHERITED;
108 }; 115 };
109 116
110 #endif 117 #endif
OLDNEW
« no previous file with comments | « src/gpu/glsl/GrGLSLFragmentProcessor.cpp ('k') | src/gpu/glsl/GrGLSLGeometryProcessor.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698