Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(288)

Unified Diff: src/gpu/effects/GrBezierEffect.cpp

Issue 1513573009: Add check for highp support in Conic effect (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « include/gpu/GrCaps.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/effects/GrBezierEffect.cpp
diff --git a/src/gpu/effects/GrBezierEffect.cpp b/src/gpu/effects/GrBezierEffect.cpp
index fcb567dfc5df0de29c61d38c3d611430cfe7c9c1..fdb737dab46b972592be2b8e33f924878206622f 100644
--- a/src/gpu/effects/GrBezierEffect.cpp
+++ b/src/gpu/effects/GrBezierEffect.cpp
@@ -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);
« no previous file with comments | « include/gpu/GrCaps.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698