OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 #include "GrGeometryProcessor.h" | 8 #include "GrGeometryProcessor.h" |
9 | 9 |
10 #include "gl/GrGLGeometryProcessor.h" | 10 #include "gl/GrGLGeometryProcessor.h" |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
49 &stagedLocalVarName); | 49 &stagedLocalVarName); |
50 fs->codeAppendf("%s = %s;", outputName, stagedLocalVarName); | 50 fs->codeAppendf("%s = %s;", outputName, stagedLocalVarName); |
51 } else if (kAttribute_GrGPInput == inputType) { | 51 } else if (kAttribute_GrGPInput == inputType) { |
52 SkASSERT(colorAttr); | 52 SkASSERT(colorAttr); |
53 pb->addPassThroughAttribute(colorAttr, outputName); | 53 pb->addPassThroughAttribute(colorAttr, outputName); |
54 } else if (kAllOnes_GrGPInput == inputType) { | 54 } else if (kAllOnes_GrGPInput == inputType) { |
55 fs->codeAppendf("%s = vec4(1);", outputName); | 55 fs->codeAppendf("%s = vec4(1);", outputName); |
56 } | 56 } |
57 } | 57 } |
58 | 58 |
59 void GrGLGeometryProcessor::setupUniformViewMatrix(GrGLGPBuilder* pb) { | |
bsalomon
2014/12/30 13:19:38
These functions are so similarly named. Maybe we c
| |
60 fViewMatrixUniform = pb->addUniform(GrGLProgramBuilder::kVertex_Visibility, | |
61 kMat33f_GrSLType, kDefault_GrSLPrecision , | |
62 "uViewM", | |
63 &fViewMatrixName); | |
64 } | |
65 | |
66 void GrGLGeometryProcessor::setUniformViewMatrix(const GrGLProgramDataManager& p dman, | |
67 const SkMatrix& viewMatrix) { | |
68 if (!fViewMatrix.cheapEqualTo(viewMatrix)) { | |
69 SkASSERT(fViewMatrixUniform.isValid()); | |
70 fViewMatrix = viewMatrix; | |
71 | |
72 GrGLfloat viewMatrix[3 * 3]; | |
73 GrGLGetMatrix<3>(viewMatrix, fViewMatrix); | |
74 pdman.setMatrix3f(fViewMatrixUniform, viewMatrix); | |
75 } | |
76 } | |
77 | |
59 //////////////////////////////////////////////////////////////////////////////// /////////////////// | 78 //////////////////////////////////////////////////////////////////////////////// /////////////////// |
60 | 79 |
61 struct PathBatchTracker { | 80 struct PathBatchTracker { |
62 GrGPInput fInputColorType; | 81 GrGPInput fInputColorType; |
63 GrGPInput fInputCoverageType; | 82 GrGPInput fInputCoverageType; |
64 GrColor fColor; | 83 GrColor fColor; |
65 bool fUsesLocalCoords; | 84 bool fUsesLocalCoords; |
66 }; | 85 }; |
67 | 86 |
68 class GrGLPathProcessor : public GrGLGeometryProcessor { | 87 class GrGLPathProcessor : public GrGLGeometryProcessor { |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
173 | 192 |
174 void GrPathProcessor::getGLProcessorKey(const GrBatchTracker& bt, | 193 void GrPathProcessor::getGLProcessorKey(const GrBatchTracker& bt, |
175 const GrGLCaps& caps, | 194 const GrGLCaps& caps, |
176 GrProcessorKeyBuilder* b) const { | 195 GrProcessorKeyBuilder* b) const { |
177 GrGLPathProcessor::GenKey(*this, bt, caps, b); | 196 GrGLPathProcessor::GenKey(*this, bt, caps, b); |
178 } | 197 } |
179 | 198 |
180 GrGLGeometryProcessor* GrPathProcessor::createGLInstance(const GrBatchTracker& b t) const { | 199 GrGLGeometryProcessor* GrPathProcessor::createGLInstance(const GrBatchTracker& b t) const { |
181 return SkNEW_ARGS(GrGLPathProcessor, (*this, bt)); | 200 return SkNEW_ARGS(GrGLPathProcessor, (*this, bt)); |
182 } | 201 } |
OLD | NEW |