diff options
author | Jim Van Verth <jvanverth@google.com> | 2017-11-20 12:36:16 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-11-20 18:07:08 +0000 |
commit | 999ec57291dc7cf1d8e3a745627670e6cadc1c12 (patch) | |
tree | 78b34ac300515da3103c730345d4f0390959fb97 /src/gpu/effects/GrDistanceFieldGeoProc.cpp | |
parent | 40dc8a71f5d55dd7ed4e64c883664efae6da70ca (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.
Bug: skia:7285
Change-Id: I365532c7cbbcca7c7753af209bef46e05be49e11
Reviewed-on: https://skia-review.googlesource.com/71181
Reviewed-by: Brian Salomon <bsalomon@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 aafabdeb60..3e9addef6d 100644 --- a/src/gpu/effects/GrDistanceFieldGeoProc.cpp +++ b/src/gpu/effects/GrDistanceFieldGeoProc.cpp @@ -78,7 +78,8 @@ public: // add varyings GrGLSLVertToFrag uv(kFloat2_GrSLType); - GrGLSLVertToFrag texIdx(kHalf_GrSLType); + GrSLType texIdxType = args.fShaderCaps->integerSupport() ? kInt_GrSLType : kFloat_GrSLType; + GrGLSLVertToFrag texIdx(texIdxType); GrGLSLVertToFrag st(kFloat2_GrSLType); append_index_uv_varyings(args, dfTexEffect.inTextureCoords()->fName, atlasSizeInvName, &uv, &texIdx, &st); @@ -344,7 +345,8 @@ public: &atlasSizeInvName); GrGLSLVertToFrag uv(kFloat2_GrSLType); - GrGLSLVertToFrag texIdx(kHalf_GrSLType); + GrSLType texIdxType = args.fShaderCaps->integerSupport() ? kInt_GrSLType : kFloat_GrSLType; + GrGLSLVertToFrag texIdx(texIdxType); GrGLSLVertToFrag st(kFloat2_GrSLType); append_index_uv_varyings(args, dfTexEffect.inTextureCoords()->fName, atlasSizeInvName, &uv, &texIdx, &st); @@ -639,7 +641,8 @@ public: // set up varyings GrGLSLVertToFrag uv(kFloat2_GrSLType); - GrGLSLVertToFrag texIdx(kHalf_GrSLType); + GrSLType texIdxType = args.fShaderCaps->integerSupport() ? kInt_GrSLType : kFloat_GrSLType; + GrGLSLVertToFrag texIdx(texIdxType); GrGLSLVertToFrag st(kFloat2_GrSLType); append_index_uv_varyings(args, dfTexEffect.inTextureCoords()->fName, atlasSizeInvName, &uv, &texIdx, &st); |