diff options
author | Jim Van Verth <jvanverth@google.com> | 2018-01-25 16:26:25 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-01-26 13:54:54 +0000 |
commit | fc4f768e5aaf8efdd112f38295a35de83a0f9a55 (patch) | |
tree | 64571d9e826dd917299fd4973111732dd76ddcb1 /src/gpu/effects/GrDistanceFieldGeoProc.cpp | |
parent | fc807c885b3cce6252cc1d057098d96f8e14eadc (diff) |
Use int when possible to calculate atlas indices in shaders.
On certain iOS devices half has a mantissa of only 10 bits, which is not
enough to perform the floating point trickery to get the lower bits
out of the "texture coordinates". Instead we use int if available, and
float if not available.
Also re-enables multitexturing for iOS and adds a sample which
stresses the issue, and a version of fontcache that tests multitexturing.
Bug: skia:7285
Change-Id: Ia541b6a418c1860c941071750ceb26459eb846ea
Reviewed-on: https://skia-review.googlesource.com/99800
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Diffstat (limited to 'src/gpu/effects/GrDistanceFieldGeoProc.cpp')
-rw-r--r-- | src/gpu/effects/GrDistanceFieldGeoProc.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/gpu/effects/GrDistanceFieldGeoProc.cpp b/src/gpu/effects/GrDistanceFieldGeoProc.cpp index d8944fa9d0..8a1a4de2d1 100644 --- a/src/gpu/effects/GrDistanceFieldGeoProc.cpp +++ b/src/gpu/effects/GrDistanceFieldGeoProc.cpp @@ -66,7 +66,8 @@ public: // add varyings GrGLSLVarying uv(kFloat2_GrSLType); - GrGLSLVarying texIdx(kHalf_GrSLType); + GrSLType texIdxType = args.fShaderCaps->integerSupport() ? kInt_GrSLType : kFloat_GrSLType; + GrGLSLVarying texIdx(texIdxType); GrGLSLVarying st(kFloat2_GrSLType); append_index_uv_varyings(args, dfTexEffect.inTextureCoords()->fName, atlasSizeInvName, &uv, &texIdx, &st); @@ -325,7 +326,8 @@ public: &atlasSizeInvName); GrGLSLVarying uv(kFloat2_GrSLType); - GrGLSLVarying texIdx(kHalf_GrSLType); + GrSLType texIdxType = args.fShaderCaps->integerSupport() ? kInt_GrSLType : kFloat_GrSLType; + GrGLSLVarying texIdx(texIdxType); GrGLSLVarying st(kFloat2_GrSLType); append_index_uv_varyings(args, dfPathEffect.inTextureCoords()->fName, atlasSizeInvName, &uv, &texIdx, &st); @@ -608,7 +610,8 @@ public: // set up varyings GrGLSLVarying uv(kFloat2_GrSLType); - GrGLSLVarying texIdx(kHalf_GrSLType); + GrSLType texIdxType = args.fShaderCaps->integerSupport() ? kInt_GrSLType : kFloat_GrSLType; + GrGLSLVarying texIdx(texIdxType); GrGLSLVarying st(kFloat2_GrSLType); append_index_uv_varyings(args, dfTexEffect.inTextureCoords()->fName, atlasSizeInvName, &uv, &texIdx, &st); |