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 "GrGLGeometryProcessor.h" | 8 #include "GrGLGeometryProcessor.h" |
9 | 9 |
10 #include "builders/GrGLProgramBuilder.h" | 10 #include "builders/GrGLProgramBuilder.h" |
(...skipping 29 matching lines...) Expand all Loading... |
40 } | 40 } |
41 varyingType = SkToBool(SkMatrix::kPerspective_Mask & type) ? kVec3f_
GrSLType : | 41 varyingType = SkToBool(SkMatrix::kPerspective_Mask & type) ? kVec3f_
GrSLType : |
42 kVec2f_
GrSLType; | 42 kVec2f_
GrSLType; |
43 GrSLPrecision precision = coordTransforms[t]->precision(); | 43 GrSLPrecision precision = coordTransforms[t]->precision(); |
44 | 44 |
45 const char* uniName; | 45 const char* uniName; |
46 fInstalledTransforms[i][t].fHandle = | 46 fInstalledTransforms[i][t].fHandle = |
47 pb->addUniform(GrGLProgramBuilder::kVertex_Visibility, | 47 pb->addUniform(GrGLProgramBuilder::kVertex_Visibility, |
48 kMat33f_GrSLType, precision, | 48 kMat33f_GrSLType, precision, |
49 strUniName.c_str(), | 49 strUniName.c_str(), |
50 &uniName).toShaderBuilderIndex(); | 50 &uniName).toIndex(); |
51 | 51 |
52 SkString strVaryingName("MatrixCoord"); | 52 SkString strVaryingName("MatrixCoord"); |
53 strVaryingName.appendf("_%i_%i", i, t); | 53 strVaryingName.appendf("_%i_%i", i, t); |
54 | 54 |
55 GrGLVertToFrag v(varyingType); | 55 GrGLVertToFrag v(varyingType); |
56 pb->addVarying(strVaryingName.c_str(), &v, precision); | 56 pb->addVarying(strVaryingName.c_str(), &v, precision); |
57 | 57 |
58 SkASSERT(kVec2f_GrSLType == varyingType || kVec3f_GrSLType == varyin
gType); | 58 SkASSERT(kVec2f_GrSLType == varyingType || kVec3f_GrSLType == varyin
gType); |
59 SkNEW_APPEND_TO_TARRAY(&(*tout)[i], GrGLProcessor::TransformedCoords
, | 59 SkNEW_APPEND_TO_TARRAY(&(*tout)[i], GrGLProcessor::TransformedCoords
, |
60 (SkString(v.fsIn()), varyingType)); | 60 (SkString(v.fsIn()), varyingType)); |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 gpArgs->fPositionVar.set(kVec2f_GrSLType, "pos2"); | 145 gpArgs->fPositionVar.set(kVec2f_GrSLType, "pos2"); |
146 vsBuilder->codeAppendf("vec2 %s = vec2(%s * vec3(%s, 1));", | 146 vsBuilder->codeAppendf("vec2 %s = vec2(%s * vec3(%s, 1));", |
147 gpArgs->fPositionVar.c_str(), viewMatrixName,
posName); | 147 gpArgs->fPositionVar.c_str(), viewMatrixName,
posName); |
148 } else { | 148 } else { |
149 gpArgs->fPositionVar.set(kVec3f_GrSLType, "pos3"); | 149 gpArgs->fPositionVar.set(kVec3f_GrSLType, "pos3"); |
150 vsBuilder->codeAppendf("vec3 %s = %s * vec3(%s, 1);", | 150 vsBuilder->codeAppendf("vec3 %s = %s * vec3(%s, 1);", |
151 gpArgs->fPositionVar.c_str(), viewMatrixName,
posName); | 151 gpArgs->fPositionVar.c_str(), viewMatrixName,
posName); |
152 } | 152 } |
153 } | 153 } |
154 } | 154 } |
OLD | NEW |