OLD | NEW |
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 #include "GrBezierEffect.h" | 8 #include "GrBezierEffect.h" |
9 | 9 |
10 #include "gl/builders/GrGLProgramBuilder.h" | 10 #include "gl/builders/GrGLProgramBuilder.h" |
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
314 : INHERITED (factory) { | 314 : INHERITED (factory) { |
315 const GrCubicEffect& ce = processor.cast<GrCubicEffect>(); | 315 const GrCubicEffect& ce = processor.cast<GrCubicEffect>(); |
316 fEdgeType = ce.getEdgeType(); | 316 fEdgeType = ce.getEdgeType(); |
317 } | 317 } |
318 | 318 |
319 void GrGLCubicEffect::emitCode(const EmitArgs& args) { | 319 void GrGLCubicEffect::emitCode(const EmitArgs& args) { |
320 GrGLVertexBuilder* vsBuilder = args.fPB->getVertexShaderBuilder(); | 320 GrGLVertexBuilder* vsBuilder = args.fPB->getVertexShaderBuilder(); |
321 const GrCubicEffect& gp = args.fGP.cast<GrCubicEffect>(); | 321 const GrCubicEffect& gp = args.fGP.cast<GrCubicEffect>(); |
322 | 322 |
323 GrGLVertToFrag v(kVec4f_GrSLType); | 323 GrGLVertToFrag v(kVec4f_GrSLType); |
324 args.fPB->addVarying("CubicCoeffs", &v); | 324 args.fPB->addVarying("CubicCoeffs", &v, GrGLShaderVar::kHigh_Precision); |
325 vsBuilder->codeAppendf("%s = %s;", v.vsOut(), gp.inCubicCoeffs()->fName); | 325 vsBuilder->codeAppendf("%s = %s;", v.vsOut(), gp.inCubicCoeffs()->fName); |
326 | 326 |
327 // setup coord outputs | 327 // setup coord outputs |
328 vsBuilder->codeAppendf("%s = %s;", vsBuilder->positionCoords(), gp.inPositio
n()->fName); | 328 vsBuilder->codeAppendf("%s = %s;", vsBuilder->positionCoords(), gp.inPositio
n()->fName); |
329 vsBuilder->codeAppendf("%s = %s;", vsBuilder->localCoords(), gp.inPosition()
->fName); | 329 vsBuilder->codeAppendf("%s = %s;", vsBuilder->localCoords(), gp.inPosition()
->fName); |
330 | 330 |
331 // setup position varying | 331 // setup position varying |
332 vsBuilder->codeAppendf("%s = %s * vec3(%s, 1);", vsBuilder->glPosition(), vs
Builder->uViewM(), | 332 vsBuilder->codeAppendf("%s = %s * vec3(%s, 1);", vsBuilder->glPosition(), vs
Builder->uViewM(), |
333 gp.inPosition()->fName); | 333 gp.inPosition()->fName); |
334 | 334 |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
456 GrTexture*[]) { | 456 GrTexture*[]) { |
457 GrGeometryProcessor* gp; | 457 GrGeometryProcessor* gp; |
458 do { | 458 do { |
459 GrPrimitiveEdgeType edgeType = static_cast<GrPrimitiveEdgeType>( | 459 GrPrimitiveEdgeType edgeType = static_cast<GrPrimitiveEdgeType>( |
460 random->nextULessThan(kGrPro
cessorEdgeTypeCnt)); | 460 random->nextULessThan(kGrPro
cessorEdgeTypeCnt)); |
461 gp = GrCubicEffect::Create(edgeType, caps); | 461 gp = GrCubicEffect::Create(edgeType, caps); |
462 } while (NULL == gp); | 462 } while (NULL == gp); |
463 return gp; | 463 return gp; |
464 } | 464 } |
465 | 465 |
OLD | NEW |