Reland "Add new method for storing DrawOpAtlas texture index."
This is a reland of c8b2e615400fe43b74dbbd2d7167bb97bd032f87
Original change's description:
> Add new method for storing DrawOpAtlas texture index.
>
> Storing the texture index in the lower bit of each texture coordinate
> seems to have issues on certain iOS devices. Rather than do that, we
> use the sign of the texture coordinate to act as our storage bit.
> To manage encoding 0 we map [0, N] to [-1, -N-1] to represent a bit.
>
> Change-Id: Ic588ee92cf858915a1833cf482d4b23bd11c1000
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/263561
> Commit-Queue: Jim Van Verth <jvanverth@google.com>
> Reviewed-by: Brian Osman <brianosman@google.com>
Change-Id: I901502c3d83ff9727c51ad4447b0cee733257649
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/264566
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
diff --git a/src/gpu/effects/GrBitmapTextGeoProc.cpp b/src/gpu/effects/GrBitmapTextGeoProc.cpp
index 48b2397..e6734f0 100644
--- a/src/gpu/effects/GrBitmapTextGeoProc.cpp
+++ b/src/gpu/effects/GrBitmapTextGeoProc.cpp
@@ -37,10 +37,9 @@
kVertex_GrShaderFlag, kFloat2_GrSLType, "AtlasSizeInv", &atlasDimensionsInvName);
GrGLSLVarying uv(kFloat2_GrSLType);
- GrSLType texIdxType = args.fShaderCaps->integerSupport() ? kInt_GrSLType : kFloat_GrSLType;
- GrGLSLVarying texIdx(texIdxType);
- append_index_uv_varyings(args, btgp.inTextureCoords().name(), atlasDimensionsInvName, &uv,
- &texIdx, nullptr);
+ GrGLSLVarying texIdx(kFloat_GrSLType);
+ append_index_uv_varyings(args, btgp.numTextureSamplers(), btgp.inTextureCoords().name(),
+ atlasDimensionsInvName, &uv, &texIdx, nullptr);
GrGLSLFPFragmentBuilder* fragBuilder = args.fFragBuilder;
// Setup pass through color
@@ -146,8 +145,8 @@
fInColor = MakeColorAttribute("inColor", wideColor);
}
- fInTextureCoords = {"inTextureCoords", kUShort2_GrVertexAttribType,
- caps.integerSupport() ? kUShort2_GrSLType : kFloat2_GrSLType};
+ fInTextureCoords = {"inTextureCoords", kShort2_GrVertexAttribType,
+ caps.integerSupport() ? kShort2_GrSLType : kFloat2_GrSLType};
this->setVertexAttributes(&fInPosition, 3);
if (numActiveViews) {