diff options
author | Brian Salomon <bsalomon@google.com> | 2018-06-19 14:33:47 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-06-19 20:01:29 +0000 |
commit | 92be2f74db81f0ed480b55c58cbde39270f9b772 (patch) | |
tree | d2b7135f511a318f10c5c86f2537c07051c922bd /src/gpu/effects/GrBitmapTextGeoProc.cpp | |
parent | f5ac906476cd26f2967a48340940e6af580fa71f (diff) |
Revert "Revert "Change how vertex/instance attributes are handled in geometry processors.""
This reverts commit 5045e501d2aec23e5f1e4b46346033ac3202c6b0.
TBR=csmartdalton@google.com
Change-Id: Ifbf5f1d8f8ef340fdc69653e931b6d68d4bf0854
Reviewed-on: https://skia-review.googlesource.com/135862
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'src/gpu/effects/GrBitmapTextGeoProc.cpp')
-rw-r--r-- | src/gpu/effects/GrBitmapTextGeoProc.cpp | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/src/gpu/effects/GrBitmapTextGeoProc.cpp b/src/gpu/effects/GrBitmapTextGeoProc.cpp index 4089555362..2594f40ee5 100644 --- a/src/gpu/effects/GrBitmapTextGeoProc.cpp +++ b/src/gpu/effects/GrBitmapTextGeoProc.cpp @@ -40,7 +40,7 @@ public: 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 @@ public: } // 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,23 +129,26 @@ GrBitmapTextGeoProc::GrBitmapTextGeoProc(GrColor color, , fColor(color) , fLocalMatrix(localMatrix) , fUsesW(usesW) - , fInColor(nullptr) , fMaskFormat(format) { SkASSERT(numActiveProxies <= kMaxTextures); if (usesW) { - fInPosition = &this->addVertexAttrib("inPosition", kFloat3_GrVertexAttribType); + fInPosition = {"inPosition", kFloat3_GrVertexAttribType}; } else { - fInPosition = &this->addVertexAttrib("inPosition", kFloat2_GrVertexAttribType); + fInPosition = {"inPosition", kFloat2_GrVertexAttribType}; } + fInTextureCoords = {"inTextureCoords", kUShort2_GrVertexAttribType}; + int cnt = 2; bool hasVertexColor = kA8_GrMaskFormat == fMaskFormat || kA565_GrMaskFormat == fMaskFormat; if (hasVertexColor) { - fInColor = &this->addVertexAttrib("inColor", kUByte4_norm_GrVertexAttribType); + fInColor = {"inColor", kUByte4_norm_GrVertexAttribType}; + ++cnt; } - fInTextureCoords = &this->addVertexAttrib("inTextureCoords", kUShort2_GrVertexAttribType); + this->setVertexAttributeCnt(cnt); + for (int i = 0; i < numActiveProxies; ++i) { SkASSERT(proxies[i]); @@ -154,6 +157,10 @@ GrBitmapTextGeoProc::GrBitmapTextGeoProc(GrColor color, } } +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) { |