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 "GrGLFragmentShaderBuilder.h" | 8 #include "GrGLFragmentShaderBuilder.h" |
9 #include "GrGLProgramBuilder.h" | 9 #include "GrGLProgramBuilder.h" |
10 #include "gl/GrGLGpu.h" | 10 #include "gl/GrGLGpu.h" |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 "GL_OES_standard_derivatives"); | 111 "GL_OES_standard_derivatives"); |
112 } | 112 } |
113 return true; | 113 return true; |
114 } | 114 } |
115 default: | 115 default: |
116 SkFAIL("Unexpected GLSLFeature requested."); | 116 SkFAIL("Unexpected GLSLFeature requested."); |
117 return false; | 117 return false; |
118 } | 118 } |
119 } | 119 } |
120 | 120 |
121 SkString GrGLFragmentShaderBuilder::ensureFSCoords2D( | 121 SkString GrGLFragmentShaderBuilder::ensureFSCoords2D(const GrGLSLTransformedCoor
dsArray& coords, |
122 const GrGLProcessor::TransformedCoordsArray& coords, int index) { | 122 int index) { |
123 if (kVec3f_GrSLType != coords[index].getType()) { | 123 if (kVec3f_GrSLType != coords[index].getType()) { |
124 SkASSERT(kVec2f_GrSLType == coords[index].getType()); | 124 SkASSERT(kVec2f_GrSLType == coords[index].getType()); |
125 return coords[index].getName(); | 125 return coords[index].getName(); |
126 } | 126 } |
127 | 127 |
128 SkString coords2D("coords2D"); | 128 SkString coords2D("coords2D"); |
129 if (0 != index) { | 129 if (0 != index) { |
130 coords2D.appendf("_%i", index); | 130 coords2D.appendf("_%i", index); |
131 } | 131 } |
132 this->codeAppendf("\tvec2 %s = %s.xy / %s.z;", | 132 this->codeAppendf("\tvec2 %s = %s.xy / %s.z;", |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
308 fMangleString.appendf("_c%d", fSubstageIndices[fSubstageIndices.count() - 2]
); | 308 fMangleString.appendf("_c%d", fSubstageIndices[fSubstageIndices.count() - 2]
); |
309 } | 309 } |
310 | 310 |
311 void GrGLFragmentBuilder::onAfterChildProcEmitCode() { | 311 void GrGLFragmentBuilder::onAfterChildProcEmitCode() { |
312 SkASSERT(fSubstageIndices.count() >= 2); | 312 SkASSERT(fSubstageIndices.count() >= 2); |
313 fSubstageIndices.pop_back(); | 313 fSubstageIndices.pop_back(); |
314 fSubstageIndices.back()++; | 314 fSubstageIndices.back()++; |
315 int removeAt = fMangleString.findLastOf('_'); | 315 int removeAt = fMangleString.findLastOf('_'); |
316 fMangleString.remove(removeAt, fMangleString.size() - removeAt); | 316 fMangleString.remove(removeAt, fMangleString.size() - removeAt); |
317 } | 317 } |
OLD | NEW |