Add check for highp support in Conic effect

This CL may not really be necessary since it seems that the Android Ones we have fall back to mediump when highp isn't supported.

FYI, for bits-of-precision/precision we have:

                        Low Med High Precision-Used
A1 (Cherry One - Mali 400) 10 10 0  Med        - conic looks bad
N5 (Adreno 330)            10 10 23 High       - conic looks bad!!!
N6 (Adreno 420)            10 10 23 High       - conic looks good
N7v2 (Adreno 320)          10 10 23 High       - conic looks bad!!!
N9 (K1)                    23 23 23 High       - looks good
N10 (Mail-604)             10 10 23 High       - looks good

I suspect derivative computation is broken on the Adreno 300s.

BUG=555779,skia:4668
TBR=bsalomon@google.com

Review URL: https://codereview.chromium.org/1513573009
This commit is contained in:
robertphillips 2015-12-11 04:59:36 -08:00 committed by Commit bot
parent 546eb5c57a
commit 2eb1009b6e
2 changed files with 21 additions and 9 deletions

View File

@ -70,7 +70,7 @@ public:
* called.
*/
const PrecisionInfo& getFloatShaderPrecisionInfo(GrShaderType shaderType,
GrSLPrecision precision) const {
GrSLPrecision precision) const {
return fFloatPrecisions[shaderType][precision];
};

View File

@ -111,14 +111,26 @@ void GrGLConicEffect::onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) {
args.fTransformsIn,
args.fTransformsOut);
GrGLSLShaderVar edgeAlpha("edgeAlpha", kFloat_GrSLType, 0, kHigh_GrSLPrecision);
GrGLSLShaderVar dklmdx("dklmdx", kVec3f_GrSLType, 0, kHigh_GrSLPrecision);
GrGLSLShaderVar dklmdy("dklmdy", kVec3f_GrSLType, 0, kHigh_GrSLPrecision);
GrGLSLShaderVar dfdx("dfdx", kFloat_GrSLType, 0, kHigh_GrSLPrecision);
GrGLSLShaderVar dfdy("dfdy", kFloat_GrSLType, 0, kHigh_GrSLPrecision);
GrGLSLShaderVar gF("gF", kVec2f_GrSLType, 0, kHigh_GrSLPrecision);
GrGLSLShaderVar gFM("gFM", kFloat_GrSLType, 0, kHigh_GrSLPrecision);
GrGLSLShaderVar func("func", kFloat_GrSLType, 0, kHigh_GrSLPrecision);
// TODO: this precision check should actually be a check on the number of bits
// high and medium provide and the selection of the lowest level that suffices.
// Additionally we should assert that the upstream code only lets us get here if
// either high or medium provides the required number of bits.
GrSLPrecision precision = kHigh_GrSLPrecision;
const GrShaderCaps::PrecisionInfo& highP = args.fGLSLCaps->getFloatShaderPrecisionInfo(
kFragment_GrShaderType,
kHigh_GrSLPrecision);
if (!highP.supported()) {
precision = kMedium_GrSLPrecision;
}
GrGLSLShaderVar edgeAlpha("edgeAlpha", kFloat_GrSLType, 0, precision);
GrGLSLShaderVar dklmdx("dklmdx", kVec3f_GrSLType, 0, precision);
GrGLSLShaderVar dklmdy("dklmdy", kVec3f_GrSLType, 0, precision);
GrGLSLShaderVar dfdx("dfdx", kFloat_GrSLType, 0, precision);
GrGLSLShaderVar dfdy("dfdy", kFloat_GrSLType, 0, precision);
GrGLSLShaderVar gF("gF", kVec2f_GrSLType, 0, precision);
GrGLSLShaderVar gFM("gFM", kFloat_GrSLType, 0, precision);
GrGLSLShaderVar func("func", kFloat_GrSLType, 0, precision);
fragBuilder->declAppend(edgeAlpha);
fragBuilder->declAppend(dklmdx);