| 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 "GrCoordTransform.h" | 10 #include "GrCoordTransform.h" |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 SkNEW_APPEND_TO_TARRAY(&(*tout)[i], GrGLProcessor::TransformedCoords
, | 211 SkNEW_APPEND_TO_TARRAY(&(*tout)[i], GrGLProcessor::TransformedCoords
, |
| 212 (SkString(v.fsIn()), varyingType)); | 212 (SkString(v.fsIn()), varyingType)); |
| 213 | 213 |
| 214 // varying = matrix * coords (logically) | 214 // varying = matrix * coords (logically) |
| 215 if (kDevice_GrCoordSet == coordType) { | 215 if (kDevice_GrCoordSet == coordType) { |
| 216 if (kVec2f_GrSLType == varyingType) { | 216 if (kVec2f_GrSLType == varyingType) { |
| 217 if (kVec2f_GrSLType == posVar.getType()) { | 217 if (kVec2f_GrSLType == posVar.getType()) { |
| 218 vb->codeAppendf("%s = (%s * vec3(%s, 1)).xy;", | 218 vb->codeAppendf("%s = (%s * vec3(%s, 1)).xy;", |
| 219 v.vsOut(), uniName, posVar.c_str()); | 219 v.vsOut(), uniName, posVar.c_str()); |
| 220 } else { | 220 } else { |
| 221 vb->codeAppendf("%s = (%s * %s).xy;", v.vsOut(), uniName
, posVar.c_str()); | 221 // The brackets here are just to scope the temp variable |
| 222 vb->codeAppendf("{ vec3 temp = %s * %s;", uniName, posVa
r.c_str()); |
| 223 vb->codeAppendf("%s = vec2(temp.x/temp.z, temp.y/temp.z)
; }", v.vsOut()); |
| 222 } | 224 } |
| 223 } else { | 225 } else { |
| 224 if (kVec2f_GrSLType == posVar.getType()) { | 226 if (kVec2f_GrSLType == posVar.getType()) { |
| 225 vb->codeAppendf("%s = %s * vec3(%s, 1);", | 227 vb->codeAppendf("%s = %s * vec3(%s, 1);", |
| 226 v.vsOut(), uniName, posVar.c_str()); | 228 v.vsOut(), uniName, posVar.c_str()); |
| 227 } else { | 229 } else { |
| 228 vb->codeAppendf("%s = %s * %s;", v.vsOut(), uniName, pos
Var.c_str()); | 230 vb->codeAppendf("%s = %s * %s;", v.vsOut(), uniName, pos
Var.c_str()); |
| 229 } | 231 } |
| 230 } | 232 } |
| 231 } else { | 233 } else { |
| (...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 560 const GrGLCaps& caps)
const { | 562 const GrGLCaps& caps)
const { |
| 561 SkASSERT(caps.nvprSupport() != GrGLCaps::kNone_NvprSupport); | 563 SkASSERT(caps.nvprSupport() != GrGLCaps::kNone_NvprSupport); |
| 562 if (caps.nvprSupport() == GrGLCaps::kLegacy_NvprSupport) { | 564 if (caps.nvprSupport() == GrGLCaps::kLegacy_NvprSupport) { |
| 563 return SkNEW_ARGS(GrGLLegacyPathProcessor, (*this, bt, | 565 return SkNEW_ARGS(GrGLLegacyPathProcessor, (*this, bt, |
| 564 caps.maxFixedFunctionTexture
Coords())); | 566 caps.maxFixedFunctionTexture
Coords())); |
| 565 } else { | 567 } else { |
| 566 return SkNEW_ARGS(GrGLNormalPathProcessor, (*this, bt)); | 568 return SkNEW_ARGS(GrGLNormalPathProcessor, (*this, bt)); |
| 567 } | 569 } |
| 568 } | 570 } |
| 569 | 571 |
| OLD | NEW |