Remove hacks for UShort2 texture coords
Plumb GPU type down for binding of vertex attributes in GL. Use that
to select between float and int versions of VertexAttribPointer.
For client code that was relying on the strange behavior of UShort2,
use shader caps to pick the appropriate GrSLType.
Bug: skia:
Change-Id: If52ea49e0a5667246687e90e088d0823dbedb921
Reviewed-on: https://skia-review.googlesource.com/155401
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
diff --git a/src/gpu/ops/GrAtlasTextOp.cpp b/src/gpu/ops/GrAtlasTextOp.cpp
index ba39b97..b45b2cf 100644
--- a/src/gpu/ops/GrAtlasTextOp.cpp
+++ b/src/gpu/ops/GrAtlasTextOp.cpp
@@ -7,6 +7,7 @@
#include "GrAtlasTextOp.h"
+#include "GrCaps.h"
#include "GrContext.h"
#include "GrContextPriv.h"
#include "GrMemoryPool.h"
@@ -312,13 +313,14 @@
bool vmPerspective = fGeoData[0].fViewMatrix.hasPerspective();
if (this->usesDistanceFields()) {
- flushInfo.fGeometryProcessor = this->setupDfProcessor(proxies, numActiveProxies);
+ flushInfo.fGeometryProcessor = this->setupDfProcessor(*target->caps().shaderCaps(),
+ proxies, numActiveProxies);
} else {
GrSamplerState samplerState = fNeedsGlyphTransform ? GrSamplerState::ClampBilerp()
: GrSamplerState::ClampNearest();
flushInfo.fGeometryProcessor = GrBitmapTextGeoProc::Make(
- this->color(), proxies, numActiveProxies, samplerState, maskFormat,
- localMatrix, vmPerspective);
+ *target->caps().shaderCaps(), this->color(), proxies, numActiveProxies, samplerState,
+ maskFormat, localMatrix, vmPerspective);
}
flushInfo.fGlyphsToFlush = 0;
@@ -521,7 +523,8 @@
// TODO trying to figure out why lcd is so whack
// (see comments in GrTextContext::ComputeCanonicalColor)
-sk_sp<GrGeometryProcessor> GrAtlasTextOp::setupDfProcessor(const sk_sp<GrTextureProxy>* proxies,
+sk_sp<GrGeometryProcessor> GrAtlasTextOp::setupDfProcessor(const GrShaderCaps& caps,
+ const sk_sp<GrTextureProxy>* proxies,
unsigned int numActiveProxies) const {
bool isLCD = this->isLCD();
@@ -546,7 +549,7 @@
GrDistanceFieldLCDTextGeoProc::DistanceAdjust widthAdjust =
GrDistanceFieldLCDTextGeoProc::DistanceAdjust::Make(
redCorrection, greenCorrection, blueCorrection);
- return GrDistanceFieldLCDTextGeoProc::Make(proxies, numActiveProxies,
+ return GrDistanceFieldLCDTextGeoProc::Make(caps, proxies, numActiveProxies,
GrSamplerState::ClampBilerp(), widthAdjust,
fDFGPFlags, localMatrix);
} else {
@@ -558,11 +561,11 @@
correction = fDistanceAdjustTable->getAdjustment(lum >> kDistanceAdjustLumShift,
fUseGammaCorrectDistanceTable);
}
- return GrDistanceFieldA8TextGeoProc::Make(proxies, numActiveProxies,
+ return GrDistanceFieldA8TextGeoProc::Make(caps, proxies, numActiveProxies,
GrSamplerState::ClampBilerp(),
correction, fDFGPFlags, localMatrix);
#else
- return GrDistanceFieldA8TextGeoProc::Make(proxies, numActiveProxies,
+ return GrDistanceFieldA8TextGeoProc::Make(caps, proxies, numActiveProxies,
GrSamplerState::ClampBilerp(),
fDFGPFlags, localMatrix);
#endif