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

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

Issue 1490283004: Create GLSLUniformHandler class for gpu backend (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: clean up public api of uniformhandler Created 5 years 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/GrGLSLFragmentShaderBuilder.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 24 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(GrGLSLGPBuilder* gp, 45 void emitTransforms(GrGLSLVertexBuilder* vb,
46 GrGLSLVertexBuilder* vb,
47 GrGLSLVaryingHandler* varyingHandler, 46 GrGLSLVaryingHandler* varyingHandler,
47 GrGLSLUniformHandler* uniformHandler,
48 const GrShaderVar& posVar, 48 const GrShaderVar& posVar,
49 const char* localCoords, 49 const char* localCoords,
50 const TransformsIn& tin, 50 const TransformsIn& tin,
51 TransformsOut* tout) { 51 TransformsOut* tout) {
52 this->emitTransforms(gp, vb, varyingHandler, posVar, localCoords, SkMatr ix::I(), tin, tout); 52 this->emitTransforms(vb, varyingHandler, uniformHandler,
53 posVar, localCoords, SkMatrix::I(), tin, tout);
53 } 54 }
54 55
55 // Emit pre-transformed coords as a vertex attribute per coord-transform. 56 // Emit pre-transformed coords as a vertex attribute per coord-transform.
56 void emitTransforms(GrGLSLGPBuilder*, 57 void emitTransforms(GrGLSLVertexBuilder*,
57 GrGLSLVertexBuilder*,
58 GrGLSLVaryingHandler*, 58 GrGLSLVaryingHandler*,
59 GrGLSLUniformHandler*,
59 const GrShaderVar& posVar, 60 const GrShaderVar& posVar,
60 const char* localCoords, 61 const char* localCoords,
61 const SkMatrix& localMatrix, 62 const SkMatrix& localMatrix,
62 const TransformsIn&, 63 const TransformsIn&,
63 TransformsOut*); 64 TransformsOut*);
64 65
65 // caller has emitted transforms via attributes 66 // caller has emitted transforms via attributes
66 void emitTransforms(GrGLSLGPBuilder*, 67 void emitTransforms(GrGLSLVertexBuilder*,
67 GrGLSLVertexBuilder*,
68 GrGLSLVaryingHandler*, 68 GrGLSLVaryingHandler*,
69 const char* localCoords, 69 const char* localCoords,
70 const TransformsIn& tin, 70 const TransformsIn& tin,
71 TransformsOut* tout); 71 TransformsOut* tout);
72 72
73 struct GrGPArgs { 73 struct GrGPArgs {
74 // The variable used by a GP to store its position. It can be 74 // The variable used by a GP to store its position. It can be
75 // either a vec2 or a vec3 depending on the presence of perspective. 75 // either a vec2 or a vec3 depending on the presence of perspective.
76 GrShaderVar fPositionVar; 76 GrShaderVar fPositionVar;
77 }; 77 };
78 78
79 // Create the correct type of position variable given the CTM 79 // Create the correct type of position variable given the CTM
80 void setupPosition(GrGLSLGPBuilder*, GrGLSLVertexBuilder*, GrGPArgs*, const char* posName); 80 void setupPosition(GrGLSLVertexBuilder*, GrGPArgs*, const char* posName);
81 void setupPosition(GrGLSLGPBuilder*, 81 void setupPosition(GrGLSLVertexBuilder*,
82 GrGLSLVertexBuilder*, 82 GrGLSLUniformHandler* uniformHandler,
83 GrGPArgs*, 83 GrGPArgs*,
84 const char* posName, 84 const char* posName,
85 const SkMatrix& mat, 85 const SkMatrix& mat,
86 UniformHandle* viewMatrixUniform); 86 UniformHandle* viewMatrixUniform);
87 87
88 static uint32_t ComputePosKey(const SkMatrix& mat) { 88 static uint32_t ComputePosKey(const SkMatrix& mat) {
89 if (mat.isIdentity()) { 89 if (mat.isIdentity()) {
90 return 0x0; 90 return 0x0;
91 } else if (!mat.hasPerspective()) { 91 } else if (!mat.hasPerspective()) {
92 return 0x01; 92 return 0x01;
(...skipping 18 matching lines...) Expand all
111 } 111 }
112 } 112 }
113 } 113 }
114 114
115 virtual void onEmitCode(EmitArgs&, GrGPArgs*) = 0; 115 virtual void onEmitCode(EmitArgs&, GrGPArgs*) = 0;
116 116
117 typedef GrGLSLPrimitiveProcessor INHERITED; 117 typedef GrGLSLPrimitiveProcessor INHERITED;
118 }; 118 };
119 119
120 #endif 120 #endif
OLDNEW
« no previous file with comments | « src/gpu/glsl/GrGLSLFragmentShaderBuilder.cpp ('k') | src/gpu/glsl/GrGLSLGeometryProcessor.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698