Revert "Change how vertex/instance attributes are handled in geometry processors."
This reverts commit 19c1233c447f625c2522e7ecd0a0adecc629bb2f.
Reason for revert: want to make sure Google3 can roll
Original change's description:
> Change how vertex/instance attributes are handled in geometry processors.
>
> * No longer register vertex/instance attributes on base class, just counts
>
> * Separate instance and vertex attributes and remove InputRate and offset
>
> * Make attributes constexpr where possible
>
> Change-Id: I1f1d5e772fa177a96d2aeb805aab7b69f35bfae6
> Reviewed-on: https://skia-review.googlesource.com/132405
> Commit-Queue: Brian Salomon <bsalomon@google.com>
> Reviewed-by: Chris Dalton <csmartdalton@google.com>
TBR=egdaniel@google.com,bsalomon@google.com,csmartdalton@google.com
Change-Id: I4800632515e14fbf54af52826928ac915657b59f
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/135661
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
diff --git a/src/gpu/effects/GrBitmapTextGeoProc.cpp b/src/gpu/effects/GrBitmapTextGeoProc.cpp
index 2594f40..4089555 100644
--- a/src/gpu/effects/GrBitmapTextGeoProc.cpp
+++ b/src/gpu/effects/GrBitmapTextGeoProc.cpp
@@ -40,7 +40,7 @@
GrGLSLVarying uv(kFloat2_GrSLType);
GrSLType texIdxType = args.fShaderCaps->integerSupport() ? kInt_GrSLType : kFloat_GrSLType;
GrGLSLVarying texIdx(texIdxType);
- append_index_uv_varyings(args, btgp.inTextureCoords().name(), atlasSizeInvName, &uv,
+ append_index_uv_varyings(args, btgp.inTextureCoords()->name(), atlasSizeInvName, &uv,
&texIdx, nullptr);
GrGLSLFPFragmentBuilder* fragBuilder = args.fFragBuilder;
@@ -53,13 +53,13 @@
}
// Setup position
- gpArgs->fPositionVar = btgp.inPosition().asShaderVar();
+ gpArgs->fPositionVar = btgp.inPosition()->asShaderVar();
// emit transforms
this->emitTransforms(vertBuilder,
varyingHandler,
uniformHandler,
- btgp.inPosition().asShaderVar(),
+ btgp.inPosition()->asShaderVar(),
btgp.localMatrix(),
args.fFPCoordTransformHandler);
@@ -129,26 +129,23 @@
, fColor(color)
, fLocalMatrix(localMatrix)
, fUsesW(usesW)
+ , fInColor(nullptr)
, fMaskFormat(format) {
SkASSERT(numActiveProxies <= kMaxTextures);
if (usesW) {
- fInPosition = {"inPosition", kFloat3_GrVertexAttribType};
+ fInPosition = &this->addVertexAttrib("inPosition", kFloat3_GrVertexAttribType);
} else {
- fInPosition = {"inPosition", kFloat2_GrVertexAttribType};
+ fInPosition = &this->addVertexAttrib("inPosition", kFloat2_GrVertexAttribType);
}
- fInTextureCoords = {"inTextureCoords", kUShort2_GrVertexAttribType};
- int cnt = 2;
bool hasVertexColor = kA8_GrMaskFormat == fMaskFormat ||
kA565_GrMaskFormat == fMaskFormat;
if (hasVertexColor) {
- fInColor = {"inColor", kUByte4_norm_GrVertexAttribType};
- ++cnt;
+ fInColor = &this->addVertexAttrib("inColor", kUByte4_norm_GrVertexAttribType);
}
- this->setVertexAttributeCnt(cnt);
-
+ fInTextureCoords = &this->addVertexAttrib("inTextureCoords", kUShort2_GrVertexAttribType);
for (int i = 0; i < numActiveProxies; ++i) {
SkASSERT(proxies[i]);
@@ -157,10 +154,6 @@
}
}
-const GrPrimitiveProcessor::Attribute& GrBitmapTextGeoProc::onVertexAttribute(int i) const {
- return IthInitializedAttribute(i, fInPosition, fInColor, fInTextureCoords);
-}
-
void GrBitmapTextGeoProc::addNewProxies(const sk_sp<GrTextureProxy>* proxies,
int numActiveProxies,
const GrSamplerState& params) {