Specify CPU (buffer) and GPU (shader) types explicitly in Attribute
The CPU type is still specified using GrVertexAttribType.
The GPU type is specified directly using GrSLType.
kHalfX_GrVertexAttribType now really means half-float buffer
data, rather than float. (Caveat: The GL enum is only correct
with ES3/GL3 - ES2+extension needs a different value. Sigh.)
Bug: skia:
Change-Id: Ife101db68a5d4ea1ddc2f6c60fbec0c66d725c16
Reviewed-on: https://skia-review.googlesource.com/154628
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
diff --git a/src/gpu/effects/GrBezierEffect.h b/src/gpu/effects/GrBezierEffect.h
index eebe42a..b8742e8 100644
--- a/src/gpu/effects/GrBezierEffect.h
+++ b/src/gpu/effects/GrBezierEffect.h
@@ -120,8 +120,10 @@
bool fUsesLocalCoords;
uint8_t fCoverageScale;
GrClipEdgeType fEdgeType;
- static constexpr Attribute kAttributes[] = {{"inPosition", kFloat2_GrVertexAttribType},
- {"inConicCoeffs", kHalf4_GrVertexAttribType}};
+ static constexpr Attribute kAttributes[] = {
+ {"inPosition", kFloat2_GrVertexAttribType, kFloat2_GrSLType},
+ {"inConicCoeffs", kFloat4_GrVertexAttribType, kHalf4_GrSLType}
+ };
GR_DECLARE_GEOMETRY_PROCESSOR_TEST
@@ -205,8 +207,10 @@
uint8_t fCoverageScale;
GrClipEdgeType fEdgeType;
- static constexpr Attribute kAttributes[] = {{"inPosition", kFloat2_GrVertexAttribType},
- {"inHairQuadEdge", kHalf4_GrVertexAttribType}};
+ static constexpr Attribute kAttributes[] = {
+ {"inPosition", kFloat2_GrVertexAttribType, kFloat2_GrSLType},
+ {"inHairQuadEdge", kFloat4_GrVertexAttribType, kHalf4_GrSLType}
+ };
GR_DECLARE_GEOMETRY_PROCESSOR_TEST
@@ -292,7 +296,8 @@
SkMatrix fDevKLMMatrix;
GrClipEdgeType fEdgeType;
- static constexpr Attribute kInPosition = {"inPosition", kFloat2_GrVertexAttribType};
+ static constexpr Attribute kInPosition =
+ {"inPosition", kFloat2_GrVertexAttribType, kFloat2_GrSLType};
GR_DECLARE_GEOMETRY_PROCESSOR_TEST
diff --git a/src/gpu/effects/GrBitmapTextGeoProc.cpp b/src/gpu/effects/GrBitmapTextGeoProc.cpp
index ee38f43..02a9c46 100644
--- a/src/gpu/effects/GrBitmapTextGeoProc.cpp
+++ b/src/gpu/effects/GrBitmapTextGeoProc.cpp
@@ -132,17 +132,18 @@
SkASSERT(numActiveProxies <= kMaxTextures);
if (usesW) {
- fInPosition = {"inPosition", kFloat3_GrVertexAttribType};
+ fInPosition = {"inPosition", kFloat3_GrVertexAttribType, kFloat3_GrSLType};
} else {
- fInPosition = {"inPosition", kFloat2_GrVertexAttribType};
+ fInPosition = {"inPosition", kFloat2_GrVertexAttribType, kFloat2_GrSLType};
}
- fInTextureCoords = {"inTextureCoords", kUShort2_GrVertexAttribType};
+ fInTextureCoords =
+ {"inTextureCoords", kUShort2_GrVertexAttribType, kUShort2_GrSLType};
int cnt = 2;
bool hasVertexColor = kA8_GrMaskFormat == fMaskFormat ||
kA565_GrMaskFormat == fMaskFormat;
if (hasVertexColor) {
- fInColor = {"inColor", kUByte4_norm_GrVertexAttribType};
+ fInColor = {"inColor", kUByte4_norm_GrVertexAttribType, kHalf4_GrSLType};
++cnt;
}
diff --git a/src/gpu/effects/GrDistanceFieldGeoProc.cpp b/src/gpu/effects/GrDistanceFieldGeoProc.cpp
index 099cc7e..04f73c8 100644
--- a/src/gpu/effects/GrDistanceFieldGeoProc.cpp
+++ b/src/gpu/effects/GrDistanceFieldGeoProc.cpp
@@ -226,9 +226,9 @@
SkASSERT(!(flags & ~kNonLCD_DistanceFieldEffectMask));
if (flags & kPerspective_DistanceFieldEffectFlag) {
- fInPosition = {"inPosition", kFloat3_GrVertexAttribType};
+ fInPosition = {"inPosition", kFloat3_GrVertexAttribType, kFloat3_GrSLType};
} else {
- fInPosition = {"inPosition", kFloat2_GrVertexAttribType};
+ fInPosition = {"inPosition", kFloat2_GrVertexAttribType, kFloat2_GrSLType};
}
this->setVertexAttributeCnt(3);
@@ -837,9 +837,9 @@
SkASSERT(!(flags & ~kLCD_DistanceFieldEffectMask) && (flags & kUseLCD_DistanceFieldEffectFlag));
if (fFlags & kPerspective_DistanceFieldEffectFlag) {
- fInPosition = {"inPosition", kFloat3_GrVertexAttribType};
+ fInPosition = {"inPosition", kFloat3_GrVertexAttribType, kFloat3_GrSLType};
} else {
- fInPosition = {"inPosition", kFloat2_GrVertexAttribType};
+ fInPosition = {"inPosition", kFloat2_GrVertexAttribType, kFloat2_GrSLType};
}
this->setVertexAttributeCnt(3);
diff --git a/src/gpu/effects/GrDistanceFieldGeoProc.h b/src/gpu/effects/GrDistanceFieldGeoProc.h
index fcd98aa..c311908 100644
--- a/src/gpu/effects/GrDistanceFieldGeoProc.h
+++ b/src/gpu/effects/GrDistanceFieldGeoProc.h
@@ -118,8 +118,10 @@
float fDistanceAdjust;
#endif
- static constexpr Attribute kInColor = {"inColor", kUByte4_norm_GrVertexAttribType};
- static constexpr Attribute kInTextureCoords = {"inTextureCoords", kUShort2_GrVertexAttribType};
+ static constexpr Attribute kInColor =
+ {"inColor", kUByte4_norm_GrVertexAttribType, kHalf4_GrSLType};
+ static constexpr Attribute kInTextureCoords =
+ {"inTextureCoords", kUShort2_GrVertexAttribType, kUShort2_GrSLType};
GR_DECLARE_GEOMETRY_PROCESSOR_TEST
@@ -175,9 +177,12 @@
TextureSampler fTextureSamplers[kMaxTextures];
SkISize fAtlasSize; // size for all textures used with fTextureSamplers[].
uint32_t fFlags;
- static constexpr Attribute kInPosition = {"inPosition", kFloat2_GrVertexAttribType};
- static constexpr Attribute kInColor = {"inColor", kUByte4_norm_GrVertexAttribType};
- static constexpr Attribute kInTextureCoords = {"inTextureCoords", kUShort2_GrVertexAttribType};
+ static constexpr Attribute kInPosition =
+ {"inPosition", kFloat2_GrVertexAttribType, kFloat2_GrSLType};
+ static constexpr Attribute kInColor =
+ {"inColor", kUByte4_norm_GrVertexAttribType, kHalf4_GrSLType};
+ static constexpr Attribute kInTextureCoords =
+ {"inTextureCoords", kUShort2_GrVertexAttribType, kUShort2_GrSLType};
GR_DECLARE_GEOMETRY_PROCESSOR_TEST
@@ -253,8 +258,10 @@
Attribute fInPosition;
uint32_t fFlags;
- static constexpr Attribute kInColor = {"inColor", kUByte4_norm_GrVertexAttribType};
- static constexpr Attribute kInTextureCoords = {"inTextureCoords", kUShort2_GrVertexAttribType};
+ static constexpr Attribute kInColor =
+ {"inColor", kUByte4_norm_GrVertexAttribType, kHalf4_GrSLType};
+ static constexpr Attribute kInTextureCoords =
+ {"inTextureCoords", kUShort2_GrVertexAttribType, kUShort2_GrSLType};
GR_DECLARE_GEOMETRY_PROCESSOR_TEST
diff --git a/src/gpu/effects/GrShadowGeoProc.h b/src/gpu/effects/GrShadowGeoProc.h
index a8880a2..8380015 100644
--- a/src/gpu/effects/GrShadowGeoProc.h
+++ b/src/gpu/effects/GrShadowGeoProc.h
@@ -43,9 +43,12 @@
GrColor fColor;
- static constexpr Attribute kInPosition = {"inPosition", kFloat2_GrVertexAttribType};
- static constexpr Attribute kInColor = {"inColor", kUByte4_norm_GrVertexAttribType};
- static constexpr Attribute kInShadowParams = {"inShadowParams", kHalf3_GrVertexAttribType};
+ static constexpr Attribute kInPosition =
+ {"inPosition", kFloat2_GrVertexAttribType, kFloat2_GrSLType};
+ static constexpr Attribute kInColor =
+ {"inColor", kUByte4_norm_GrVertexAttribType, kHalf4_GrSLType};
+ static constexpr Attribute kInShadowParams =
+ {"inShadowParams", kFloat3_GrVertexAttribType, kHalf3_GrSLType};
GR_DECLARE_GEOMETRY_PROCESSOR_TEST