Adjust atlas sizes to fix Mali400 precision issues
The previous change to atlas sizes introduced an issue where texture
coordinates for glyphs stored on the right side of the atlas were being
computed in an imprecise manner on Mali400 chips.
The only reasonable fix appears to be to use power-of-two texture sizes.
This widens the glyph atlas to the next power of 2 (or 2048) for A8 glyphs
only, and widens each GrPlot by 2x as well. By doing this, we can fit 3-4 large
distance field glyphs into a single GrPlot, which gives us 100-128 total large
glyphs at one time.
The 565 and 8888 glyph atlases are kept in their original size to preserve
space.
BUG=skia:3523
Review URL: https://codereview.chromium.org/994303003
diff --git a/src/gpu/effects/GrBitmapTextGeoProc.cpp b/src/gpu/effects/GrBitmapTextGeoProc.cpp
index 54e8891..2c187a9 100644
--- a/src/gpu/effects/GrBitmapTextGeoProc.cpp
+++ b/src/gpu/effects/GrBitmapTextGeoProc.cpp
@@ -39,9 +39,15 @@
GrGLVertToFrag v(kVec2f_GrSLType);
pb->addVarying("TextureCoords", &v);
// this is only used with text, so our texture bounds always match the glyph atlas
- vsBuilder->codeAppendf("%s = vec2(" GR_FONT_ATLAS_RECIP_WIDTH ", "
- GR_FONT_ATLAS_RECIP_HEIGHT ")*%s;", v.vsOut(),
- cte.inTextureCoords()->fName);
+ if (cte.maskFormat() == kA8_GrMaskFormat) {
+ vsBuilder->codeAppendf("%s = vec2(" GR_FONT_ATLAS_A8_RECIP_WIDTH ", "
+ GR_FONT_ATLAS_RECIP_HEIGHT ")*%s;", v.vsOut(),
+ cte.inTextureCoords()->fName);
+ } else {
+ vsBuilder->codeAppendf("%s = vec2(" GR_FONT_ATLAS_RECIP_WIDTH ", "
+ GR_FONT_ATLAS_RECIP_HEIGHT ")*%s;", v.vsOut(),
+ cte.inTextureCoords()->fName);
+ }
// Setup pass through color
this->setupColorPassThrough(pb, local.fInputColorType, args.fOutputColor, cte.inColor(),