| 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 "glsl/GrGLSLFragmentShaderBuilder.h" | 10 #include "glsl/GrGLSLFragmentShaderBuilder.h" |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 // emit transforms with position | 104 // emit transforms with position |
| 105 this->emitTransforms(vertBuilder, | 105 this->emitTransforms(vertBuilder, |
| 106 varyingHandler, | 106 varyingHandler, |
| 107 uniformHandler, | 107 uniformHandler, |
| 108 gpArgs->fPositionVar, | 108 gpArgs->fPositionVar, |
| 109 gp.inPosition()->fName, | 109 gp.inPosition()->fName, |
| 110 gp.localMatrix(), | 110 gp.localMatrix(), |
| 111 args.fTransformsIn, | 111 args.fTransformsIn, |
| 112 args.fTransformsOut); | 112 args.fTransformsOut); |
| 113 | 113 |
| 114 GrGLSLShaderVar edgeAlpha("edgeAlpha", kFloat_GrSLType, 0, kHigh_GrSLPrecisi
on); | 114 // TODO: this precision check should actually be a check on the number of bi
ts |
| 115 GrGLSLShaderVar dklmdx("dklmdx", kVec3f_GrSLType, 0, kHigh_GrSLPrecision); | 115 // high and medium provide and the selection of the lowest level that suffic
es. |
| 116 GrGLSLShaderVar dklmdy("dklmdy", kVec3f_GrSLType, 0, kHigh_GrSLPrecision); | 116 // Additionally we should assert that the upstream code only lets us get her
e if |
| 117 GrGLSLShaderVar dfdx("dfdx", kFloat_GrSLType, 0, kHigh_GrSLPrecision); | 117 // either high or medium provides the required number of bits. |
| 118 GrGLSLShaderVar dfdy("dfdy", kFloat_GrSLType, 0, kHigh_GrSLPrecision); | 118 GrSLPrecision precision = kHigh_GrSLPrecision; |
| 119 GrGLSLShaderVar gF("gF", kVec2f_GrSLType, 0, kHigh_GrSLPrecision); | 119 const GrShaderCaps::PrecisionInfo& highP = args.fGLSLCaps->getFloatShaderPre
cisionInfo( |
| 120 GrGLSLShaderVar gFM("gFM", kFloat_GrSLType, 0, kHigh_GrSLPrecision); | 120 kFragment_GrShaderT
ype, |
| 121 GrGLSLShaderVar func("func", kFloat_GrSLType, 0, kHigh_GrSLPrecision); | 121 kHigh_GrSLPrecision
); |
| 122 if (!highP.supported()) { |
| 123 precision = kMedium_GrSLPrecision; |
| 124 } |
| 125 |
| 126 GrGLSLShaderVar edgeAlpha("edgeAlpha", kFloat_GrSLType, 0, precision); |
| 127 GrGLSLShaderVar dklmdx("dklmdx", kVec3f_GrSLType, 0, precision); |
| 128 GrGLSLShaderVar dklmdy("dklmdy", kVec3f_GrSLType, 0, precision); |
| 129 GrGLSLShaderVar dfdx("dfdx", kFloat_GrSLType, 0, precision); |
| 130 GrGLSLShaderVar dfdy("dfdy", kFloat_GrSLType, 0, precision); |
| 131 GrGLSLShaderVar gF("gF", kVec2f_GrSLType, 0, precision); |
| 132 GrGLSLShaderVar gFM("gFM", kFloat_GrSLType, 0, precision); |
| 133 GrGLSLShaderVar func("func", kFloat_GrSLType, 0, precision); |
| 122 | 134 |
| 123 fragBuilder->declAppend(edgeAlpha); | 135 fragBuilder->declAppend(edgeAlpha); |
| 124 fragBuilder->declAppend(dklmdx); | 136 fragBuilder->declAppend(dklmdx); |
| 125 fragBuilder->declAppend(dklmdy); | 137 fragBuilder->declAppend(dklmdy); |
| 126 fragBuilder->declAppend(dfdx); | 138 fragBuilder->declAppend(dfdx); |
| 127 fragBuilder->declAppend(dfdy); | 139 fragBuilder->declAppend(dfdy); |
| 128 fragBuilder->declAppend(gF); | 140 fragBuilder->declAppend(gF); |
| 129 fragBuilder->declAppend(gFM); | 141 fragBuilder->declAppend(gFM); |
| 130 fragBuilder->declAppend(func); | 142 fragBuilder->declAppend(func); |
| 131 | 143 |
| (...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 711 do { | 723 do { |
| 712 GrPrimitiveEdgeType edgeType = | 724 GrPrimitiveEdgeType edgeType = |
| 713 static_cast<GrPrimitiveEdgeType>( | 725 static_cast<GrPrimitiveEdgeType>( |
| 714 d->fRandom->nextULessThan(kGrProcessorEdgeTypeCnt)); | 726 d->fRandom->nextULessThan(kGrProcessorEdgeTypeCnt)); |
| 715 gp = GrCubicEffect::Create(GrRandomColor(d->fRandom), | 727 gp = GrCubicEffect::Create(GrRandomColor(d->fRandom), |
| 716 GrTest::TestMatrix(d->fRandom), edgeType, *d-
>fCaps); | 728 GrTest::TestMatrix(d->fRandom), edgeType, *d-
>fCaps); |
| 717 } while (nullptr == gp); | 729 } while (nullptr == gp); |
| 718 return gp; | 730 return gp; |
| 719 } | 731 } |
| 720 | 732 |
| OLD | NEW |