From 8a030557bd9cd66860d605578d4c54651ff02383 Mon Sep 17 00:00:00 2001 From: Brian Osman Date: Tue, 23 May 2017 15:03:18 -0400 Subject: Fix flag collision in GrDrawVerticesOp We were setting a flag meant for Mesh.fFlags on the Op's fFlags. Switch the Mesh's flags to be a pair of bools, to avoid this in the future. Bug: skia: Change-Id: Ib660f3bc9c54874d088a85251f629758c365c8c6 Reviewed-on: https://skia-review.googlesource.com/17766 Reviewed-by: Brian Salomon Commit-Queue: Brian Osman --- src/gpu/ops/GrDrawVerticesOp.cpp | 9 +++++---- src/gpu/ops/GrDrawVerticesOp.h | 15 +++++---------- 2 files changed, 10 insertions(+), 14 deletions(-) (limited to 'src/gpu') diff --git a/src/gpu/ops/GrDrawVerticesOp.cpp b/src/gpu/ops/GrDrawVerticesOp.cpp index 557bb320cf..dafd4dc7c7 100644 --- a/src/gpu/ops/GrDrawVerticesOp.cpp +++ b/src/gpu/ops/GrDrawVerticesOp.cpp @@ -44,7 +44,7 @@ std::unique_ptr GrDrawVerticesOp::Make(GrColor color, GrDrawVerticesOp::GrDrawVerticesOp(sk_sp vertices, GrPrimitiveType primitiveType, GrColor color, GrRenderTargetContext::ColorArrayType colorArrayType, - const SkMatrix& viewMatrix, uint32_t flags) + const SkMatrix& viewMatrix) : INHERITED(ClassID()), fColorArrayType(colorArrayType) { SkASSERT(vertices); @@ -56,7 +56,8 @@ GrDrawVerticesOp::GrDrawVerticesOp(sk_sp vertices, GrPrimitiveType p mesh.fColor = color; mesh.fViewMatrix = viewMatrix; mesh.fVertices = std::move(vertices); - mesh.fFlags = flags; + mesh.fIgnoreTexCoords = false; + mesh.fIgnoreColors = false; fFlags = 0; if (mesh.hasPerVertexColors()) { @@ -90,14 +91,14 @@ void GrDrawVerticesOp::applyPipelineOptimizations(const PipelineOptimizations& o GrColor overrideColor; if (optimizations.getOverrideColorIfSet(&overrideColor)) { fMeshes[0].fColor = overrideColor; - fMeshes[0].fFlags |= kIgnoreColors_VerticesFlag; + fMeshes[0].fIgnoreColors = true; fFlags &= ~kRequiresPerVertexColors_Flag; fColorArrayType = GrRenderTargetContext::ColorArrayType::kPremulGrColor; } if (optimizations.readsLocalCoords()) { fFlags |= kPipelineRequiresLocalCoords_Flag; } else { - fFlags |= kIgnoreTexCoords_VerticesFlag; + fMeshes[0].fIgnoreTexCoords = true; fFlags &= ~kAnyMeshHasExplicitLocalCoords; } } diff --git a/src/gpu/ops/GrDrawVerticesOp.h b/src/gpu/ops/GrDrawVerticesOp.h index 4bd14afad3..009c5e0415 100644 --- a/src/gpu/ops/GrDrawVerticesOp.h +++ b/src/gpu/ops/GrDrawVerticesOp.h @@ -25,11 +25,6 @@ class GrDrawVerticesOp final : public GrLegacyMeshDrawOp { public: DEFINE_OP_CLASS_ID - enum { - kIgnoreTexCoords_VerticesFlag = 1 << 0, - kIgnoreColors_VerticesFlag = 1 << 1, - }; - /** * The 'color' param is used if the 'colors' array is null. 'bounds' is the bounds of the * 'positions' array (in local space prior to application of 'viewMatrix'). If 'indices' is null @@ -66,8 +61,7 @@ public: private: GrDrawVerticesOp(sk_sp, GrPrimitiveType, GrColor, - GrRenderTargetContext::ColorArrayType, const SkMatrix& viewMatrix, - uint32_t flags = 0); + GrRenderTargetContext::ColorArrayType, const SkMatrix& viewMatrix); void getProcessorAnalysisInputs(GrProcessorAnalysisColor* color, GrProcessorAnalysisCoverage* coverage) const override; @@ -89,14 +83,15 @@ private: GrColor fColor; // Used if this->hasPerVertexColors() is false. sk_sp fVertices; SkMatrix fViewMatrix; - uint32_t fFlags; + bool fIgnoreTexCoords; + bool fIgnoreColors; bool hasExplicitLocalCoords() const { - return fVertices->hasTexCoords() && !(kIgnoreTexCoords_VerticesFlag & fFlags); + return fVertices->hasTexCoords() && !fIgnoreTexCoords; } bool hasPerVertexColors() const { - return fVertices->hasColors() && !(kIgnoreColors_VerticesFlag & fFlags); + return fVertices->hasColors() && !fIgnoreColors; } }; -- cgit v1.2.3