Use high precision vertex attributes.
Specifying vertex attributes and the view matrix as mediump causes bad artifacts on Mali T6XX. Covered by the bigmatrix GM in msaa4 mode. BUG:skia=3545,3771 Review URL: https://codereview.chromium.org/1145273002
This commit is contained in:
parent
67ca2a93f9
commit
f2539d50f9
@ -193,7 +193,8 @@ private:
|
||||
bool hasColor = SkToBool(gpTypeFlags & GrDefaultGeoProcFactory::kColor_GPType);
|
||||
bool hasLocalCoord = SkToBool(gpTypeFlags & GrDefaultGeoProcFactory::kLocalCoord_GPType);
|
||||
bool hasCoverage = SkToBool(gpTypeFlags & GrDefaultGeoProcFactory::kCoverage_GPType);
|
||||
fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVertexAttribType));
|
||||
fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVertexAttribType,
|
||||
kHigh_GrSLPrecision));
|
||||
if (hasColor) {
|
||||
fInColor = &this->addVertexAttrib(Attribute("inColor", kVec4ub_GrVertexAttribType));
|
||||
}
|
||||
|
@ -183,7 +183,8 @@ private:
|
||||
, fLocalMatrix(localMatrix)
|
||||
, fUsesLocalCoords(usesLocalCoords) {
|
||||
this->initClassID<CircleEdgeEffect>();
|
||||
fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVertexAttribType));
|
||||
fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVertexAttribType,
|
||||
kHigh_GrSLPrecision));
|
||||
fInCircleEdge = &this->addVertexAttrib(Attribute("inCircleEdge",
|
||||
kVec4f_GrVertexAttribType));
|
||||
fStroke = stroke;
|
||||
@ -556,7 +557,8 @@ private:
|
||||
, fViewMatrix(viewMatrix)
|
||||
, fUsesLocalCoords(usesLocalCoords) {
|
||||
this->initClassID<DIEllipseEdgeEffect>();
|
||||
fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVertexAttribType));
|
||||
fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVertexAttribType,
|
||||
kHigh_GrSLPrecision));
|
||||
fInEllipseOffsets0 = &this->addVertexAttrib(Attribute("inEllipseOffsets0",
|
||||
kVec2f_GrVertexAttribType));
|
||||
fInEllipseOffsets1 = &this->addVertexAttrib(Attribute("inEllipseOffsets1",
|
||||
|
@ -126,13 +126,16 @@ public:
|
||||
: fName(NULL)
|
||||
, fType(kFloat_GrVertexAttribType)
|
||||
, fOffset(0) {}
|
||||
Attribute(const char* name, GrVertexAttribType type)
|
||||
Attribute(const char* name, GrVertexAttribType type,
|
||||
GrSLPrecision precision = kDefault_GrSLPrecision)
|
||||
: fName(name)
|
||||
, fType(type)
|
||||
, fOffset(SkAlign4(GrVertexAttribTypeSize(type))) {}
|
||||
, fOffset(SkAlign4(GrVertexAttribTypeSize(type)))
|
||||
, fPrecision(precision) {}
|
||||
const char* fName;
|
||||
GrVertexAttribType fType;
|
||||
size_t fOffset;
|
||||
GrSLPrecision fPrecision;
|
||||
};
|
||||
|
||||
int numAttribs() const { return fNumAttribs; }
|
||||
|
@ -200,7 +200,8 @@ GrConicEffect::GrConicEffect(GrColor color, const SkMatrix& viewMatrix, uint8_t
|
||||
, fCoverageScale(coverage)
|
||||
, fEdgeType(edgeType) {
|
||||
this->initClassID<GrConicEffect>();
|
||||
fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVertexAttribType));
|
||||
fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVertexAttribType,
|
||||
kHigh_GrSLPrecision));
|
||||
fInConicCoeffs = &this->addVertexAttrib(Attribute("inConicCoeffs",
|
||||
kVec4f_GrVertexAttribType));
|
||||
}
|
||||
@ -401,7 +402,8 @@ GrQuadEffect::GrQuadEffect(GrColor color, const SkMatrix& viewMatrix, uint8_t co
|
||||
, fCoverageScale(coverage)
|
||||
, fEdgeType(edgeType) {
|
||||
this->initClassID<GrQuadEffect>();
|
||||
fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVertexAttribType));
|
||||
fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVertexAttribType,
|
||||
kHigh_GrSLPrecision));
|
||||
fInHairQuadEdge = &this->addVertexAttrib(Attribute("inHairQuadEdge",
|
||||
kVec4f_GrVertexAttribType));
|
||||
}
|
||||
@ -614,7 +616,8 @@ GrCubicEffect::GrCubicEffect(GrColor color, const SkMatrix& viewMatrix,
|
||||
, fViewMatrix(viewMatrix)
|
||||
, fEdgeType(edgeType) {
|
||||
this->initClassID<GrCubicEffect>();
|
||||
fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVertexAttribType));
|
||||
fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVertexAttribType,
|
||||
kHigh_GrSLPrecision));
|
||||
fInCubicCoeffs = &this->addVertexAttrib(Attribute("inCubicCoeffs",
|
||||
kVec4f_GrVertexAttribType));
|
||||
}
|
||||
|
@ -205,7 +205,8 @@ GrDistanceFieldA8TextGeoProc::GrDistanceFieldA8TextGeoProc(GrColor color,
|
||||
, fUsesLocalCoords(usesLocalCoords) {
|
||||
SkASSERT(!(flags & ~kNonLCD_DistanceFieldEffectMask));
|
||||
this->initClassID<GrDistanceFieldA8TextGeoProc>();
|
||||
fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVertexAttribType));
|
||||
fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVertexAttribType,
|
||||
kHigh_GrSLPrecision));
|
||||
if (flags & kColorAttr_DistanceFieldEffectFlag) {
|
||||
fInColor = &this->addVertexAttrib(Attribute("inColor", kVec4ub_GrVertexAttribType));
|
||||
}
|
||||
@ -420,7 +421,8 @@ GrDistanceFieldPathGeoProc::GrDistanceFieldPathGeoProc(
|
||||
, fUsesLocalCoords(usesLocalCoords) {
|
||||
SkASSERT(!(flags & ~kNonLCD_DistanceFieldEffectMask));
|
||||
this->initClassID<GrDistanceFieldPathGeoProc>();
|
||||
fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVertexAttribType));
|
||||
fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVertexAttribType,
|
||||
kHigh_GrSLPrecision));
|
||||
if (flags & kColorAttr_DistanceFieldEffectFlag) {
|
||||
fInColor = &this->addVertexAttrib(Attribute("inColor", kVec4ub_GrVertexAttribType));
|
||||
}
|
||||
@ -674,7 +676,8 @@ GrDistanceFieldLCDTextGeoProc::GrDistanceFieldLCDTextGeoProc(
|
||||
, fUsesLocalCoords(usesLocalCoords) {
|
||||
SkASSERT(!(flags & ~kLCD_DistanceFieldEffectMask) && (flags & kUseLCD_DistanceFieldEffectFlag));
|
||||
this->initClassID<GrDistanceFieldLCDTextGeoProc>();
|
||||
fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVertexAttribType));
|
||||
fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVertexAttribType,
|
||||
kHigh_GrSLPrecision));
|
||||
fInTextureCoords = &this->addVertexAttrib(Attribute("inTextureCoords",
|
||||
kVec2s_GrVertexAttribType));
|
||||
this->addTextureAccess(&fTextureAccess);
|
||||
|
@ -47,7 +47,7 @@ void GrGLPrimitiveProcessor::setupUniformColor(GrGLGPBuilder* pb,
|
||||
|
||||
void GrGLPrimitiveProcessor::addUniformViewMatrix(GrGLGPBuilder* pb) {
|
||||
fViewMatrixUniform = pb->addUniform(GrGLProgramBuilder::kVertex_Visibility,
|
||||
kMat33f_GrSLType, kDefault_GrSLPrecision,
|
||||
kMat33f_GrSLType, kHigh_GrSLPrecision,
|
||||
"uViewM",
|
||||
&fViewMatrixName);
|
||||
}
|
||||
|
@ -23,7 +23,9 @@ public:
|
||||
void addAttribute(const GrGeometryProcessor::Attribute* attr) {
|
||||
this->addAttribute(GrShaderVar(attr->fName,
|
||||
GrVertexAttribTypeToSLType(attr->fType),
|
||||
GrShaderVar::kAttribute_TypeModifier));
|
||||
GrShaderVar::kAttribute_TypeModifier,
|
||||
GrShaderVar::kNonArray,
|
||||
attr->fPrecision));
|
||||
}
|
||||
|
||||
private:
|
||||
|
Loading…
Reference in New Issue
Block a user