Remove (unused) shader caps from default GP factory functions

Change-Id: Id3313169be2fecfb8a11045f08a55490fbec9b9e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/276486
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
This commit is contained in:
Brian Osman 2020-03-12 09:28:44 -04:00 committed by Skia Commit-Bot
parent 9b449b73d3
commit f0aee749bf
14 changed files with 17 additions and 44 deletions

View File

@ -36,7 +36,6 @@ enum GPFlag {
class DefaultGeoProc : public GrGeometryProcessor { class DefaultGeoProc : public GrGeometryProcessor {
public: public:
static GrGeometryProcessor* Make(SkArenaAlloc* arena, static GrGeometryProcessor* Make(SkArenaAlloc* arena,
const GrShaderCaps* shaderCaps,
uint32_t gpTypeFlags, uint32_t gpTypeFlags,
const SkPMColor4f& color, const SkPMColor4f& color,
sk_sp<GrColorSpaceXform> colorSpaceXform, sk_sp<GrColorSpaceXform> colorSpaceXform,
@ -44,9 +43,9 @@ public:
const SkMatrix& localMatrix, const SkMatrix& localMatrix,
bool localCoordsWillBeRead, bool localCoordsWillBeRead,
uint8_t coverage) { uint8_t coverage) {
return arena->make<DefaultGeoProc>(shaderCaps, gpTypeFlags, color, return arena->make<DefaultGeoProc>(gpTypeFlags, color, std::move(colorSpaceXform),
std::move(colorSpaceXform), viewMatrix, localMatrix, viewMatrix, localMatrix, coverage,
coverage, localCoordsWillBeRead); localCoordsWillBeRead);
} }
const char* name() const override { return "DefaultGeometryProcessor"; } const char* name() const override { return "DefaultGeometryProcessor"; }
@ -230,8 +229,7 @@ public:
private: private:
friend class ::SkArenaAlloc; // for access to ctor friend class ::SkArenaAlloc; // for access to ctor
DefaultGeoProc(const GrShaderCaps* shaderCaps, DefaultGeoProc(uint32_t gpTypeFlags,
uint32_t gpTypeFlags,
const SkPMColor4f& color, const SkPMColor4f& color,
sk_sp<GrColorSpaceXform> colorSpaceXform, sk_sp<GrColorSpaceXform> colorSpaceXform,
const SkMatrix& viewMatrix, const SkMatrix& viewMatrix,
@ -302,7 +300,7 @@ GrGeometryProcessor* DefaultGeoProc::TestCreate(GrProcessorTestData* d) {
flags |= kLocalCoordAttribute_GPFlag; flags |= kLocalCoordAttribute_GPFlag;
} }
return DefaultGeoProc::Make(d->allocator(), d->caps()->shaderCaps(), return DefaultGeoProc::Make(d->allocator(),
flags, flags,
SkPMColor4f::FromBytes_RGBA(GrRandomColor(d->fRandom)), SkPMColor4f::FromBytes_RGBA(GrRandomColor(d->fRandom)),
GrTest::TestColorXform(d->fRandom), GrTest::TestColorXform(d->fRandom),
@ -314,7 +312,6 @@ GrGeometryProcessor* DefaultGeoProc::TestCreate(GrProcessorTestData* d) {
#endif #endif
GrGeometryProcessor* GrDefaultGeoProcFactory::Make(SkArenaAlloc* arena, GrGeometryProcessor* GrDefaultGeoProcFactory::Make(SkArenaAlloc* arena,
const GrShaderCaps* shaderCaps,
const Color& color, const Color& color,
const Coverage& coverage, const Coverage& coverage,
const LocalCoords& localCoords, const LocalCoords& localCoords,
@ -338,7 +335,6 @@ GrGeometryProcessor* GrDefaultGeoProcFactory::Make(SkArenaAlloc* arena,
bool localCoordsWillBeRead = localCoords.fType != LocalCoords::kUnused_Type; bool localCoordsWillBeRead = localCoords.fType != LocalCoords::kUnused_Type;
return DefaultGeoProc::Make(arena, return DefaultGeoProc::Make(arena,
shaderCaps,
flags, flags,
color.fColor, color.fColor,
color.fColorSpaceXform, color.fColorSpaceXform,
@ -349,7 +345,6 @@ GrGeometryProcessor* GrDefaultGeoProcFactory::Make(SkArenaAlloc* arena,
} }
GrGeometryProcessor* GrDefaultGeoProcFactory::MakeForDeviceSpace(SkArenaAlloc* arena, GrGeometryProcessor* GrDefaultGeoProcFactory::MakeForDeviceSpace(SkArenaAlloc* arena,
const GrShaderCaps* shaderCaps,
const Color& color, const Color& color,
const Coverage& coverage, const Coverage& coverage,
const LocalCoords& localCoords, const LocalCoords& localCoords,
@ -367,5 +362,5 @@ GrGeometryProcessor* GrDefaultGeoProcFactory::MakeForDeviceSpace(SkArenaAlloc* a
} }
LocalCoords inverted(LocalCoords::kUsePosition_Type, &invert); LocalCoords inverted(LocalCoords::kUsePosition_Type, &invert);
return Make(arena, shaderCaps, color, coverage, inverted, SkMatrix::I()); return Make(arena, color, coverage, inverted, SkMatrix::I());
} }

View File

@ -10,7 +10,6 @@
#include "src/gpu/GrColorSpaceXform.h" #include "src/gpu/GrColorSpaceXform.h"
#include "src/gpu/GrGeometryProcessor.h" #include "src/gpu/GrGeometryProcessor.h"
#include "src/gpu/GrShaderCaps.h"
/* /*
* A factory for creating default Geometry Processors which simply multiply position by the uniform * A factory for creating default Geometry Processors which simply multiply position by the uniform
@ -77,7 +76,6 @@ namespace GrDefaultGeoProcFactory {
}; };
GrGeometryProcessor* Make(SkArenaAlloc*, GrGeometryProcessor* Make(SkArenaAlloc*,
const GrShaderCaps*,
const Color&, const Color&,
const Coverage&, const Coverage&,
const LocalCoords&, const LocalCoords&,
@ -89,7 +87,6 @@ namespace GrDefaultGeoProcFactory {
* coordinates for GrFragmentProcessors. It may fail if the view matrix is not invertible. * coordinates for GrFragmentProcessors. It may fail if the view matrix is not invertible.
*/ */
GrGeometryProcessor* MakeForDeviceSpace(SkArenaAlloc*, GrGeometryProcessor* MakeForDeviceSpace(SkArenaAlloc*,
const GrShaderCaps*,
const Color&, const Color&,
const Coverage&, const Coverage&,
const LocalCoords&, const LocalCoords&,

View File

@ -7,7 +7,6 @@
#include "src/gpu/GrTessellator.h" #include "src/gpu/GrTessellator.h"
#include "src/gpu/GrDefaultGeoProcFactory.h"
#include "src/gpu/GrEagerVertexAllocator.h" #include "src/gpu/GrEagerVertexAllocator.h"
#include "src/gpu/GrVertexWriter.h" #include "src/gpu/GrVertexWriter.h"
#include "src/gpu/geometry/GrPathUtils.h" #include "src/gpu/geometry/GrPathUtils.h"

View File

@ -944,7 +944,6 @@ GrGeometryProcessor* AAHairlineOp::makeLineGP(const GrCaps& caps, SkArenaAlloc*
localCoords.fMatrix = geometryProcessorLocalM; localCoords.fMatrix = geometryProcessorLocalM;
GrGeometryProcessor* lineGP = GrDefaultGeoProcFactory::Make(arena, GrGeometryProcessor* lineGP = GrDefaultGeoProcFactory::Make(arena,
caps.shaderCaps(),
color, color,
Coverage::kAttribute_Type, Coverage::kAttribute_Type,
localCoords, localCoords,

View File

@ -97,7 +97,6 @@ static void extract_verts(const GrAAConvexTessellator& tess,
} }
static GrGeometryProcessor* create_lines_only_gp(SkArenaAlloc* arena, static GrGeometryProcessor* create_lines_only_gp(SkArenaAlloc* arena,
const GrShaderCaps* shaderCaps,
bool tweakAlphaForCoverage, bool tweakAlphaForCoverage,
const SkMatrix& viewMatrix, const SkMatrix& viewMatrix,
bool usesLocalCoords, bool usesLocalCoords,
@ -111,8 +110,7 @@ static GrGeometryProcessor* create_lines_only_gp(SkArenaAlloc* arena,
Color::Type colorType = Color::Type colorType =
wideColor ? Color::kPremulWideColorAttribute_Type : Color::kPremulGrColorAttribute_Type; wideColor ? Color::kPremulWideColorAttribute_Type : Color::kPremulGrColorAttribute_Type;
return MakeForDeviceSpace(arena, shaderCaps, colorType, coverageType, return MakeForDeviceSpace(arena, colorType, coverageType, localCoordsType, viewMatrix);
localCoordsType, viewMatrix);
} }
namespace { namespace {
@ -241,7 +239,6 @@ private:
void onPrepareDraws(Target* target) override { void onPrepareDraws(Target* target) override {
// Setup GrGeometryProcessor // Setup GrGeometryProcessor
GrGeometryProcessor* gp = create_lines_only_gp(target->allocator(), GrGeometryProcessor* gp = create_lines_only_gp(target->allocator(),
target->caps().shaderCaps(),
fHelper.compatibleWithCoverageAsAlpha(), fHelper.compatibleWithCoverageAsAlpha(),
this->viewMatrix(), this->viewMatrix(),
fHelper.usesLocalCoords(), fHelper.usesLocalCoords(),

View File

@ -345,7 +345,6 @@ private:
LocalCoords::Type localCoordsType = LocalCoords::Type localCoordsType =
fUsesLocalCoords ? LocalCoords::kUsePosition_Type : LocalCoords::kUnused_Type; fUsesLocalCoords ? LocalCoords::kUsePosition_Type : LocalCoords::kUnused_Type;
gp = MakeForDeviceSpace(arena, gp = MakeForDeviceSpace(arena,
caps->shaderCaps(),
color, color,
Coverage::kSolid_Type, Coverage::kSolid_Type,
localCoordsType, localCoordsType,

View File

@ -439,7 +439,6 @@ private:
LocalCoords localCoords(fHelper.usesLocalCoords() ? LocalCoords::kUsePosition_Type LocalCoords localCoords(fHelper.usesLocalCoords() ? LocalCoords::kUsePosition_Type
: LocalCoords::kUnused_Type); : LocalCoords::kUnused_Type);
gp = GrDefaultGeoProcFactory::Make(arena, gp = GrDefaultGeoProcFactory::Make(arena,
caps->shaderCaps(),
color, color,
coverage, coverage,
localCoords, localCoords,

View File

@ -93,7 +93,6 @@ private:
}; };
static GrGeometryProcessor* make_gp(SkArenaAlloc* arena, static GrGeometryProcessor* make_gp(SkArenaAlloc* arena,
const GrShaderCaps* shaderCaps,
bool hasColors, bool hasColors,
const SkPMColor4f& color, const SkPMColor4f& color,
const SkMatrix& viewMatrix) { const SkMatrix& viewMatrix) {
@ -103,7 +102,7 @@ static GrGeometryProcessor* make_gp(SkArenaAlloc* arena,
gpColor.fType = Color::kPremulGrColorAttribute_Type; gpColor.fType = Color::kPremulGrColorAttribute_Type;
} }
return GrDefaultGeoProcFactory::Make(arena, shaderCaps, gpColor, Coverage::kSolid_Type, return GrDefaultGeoProcFactory::Make(arena, gpColor, Coverage::kSolid_Type,
LocalCoords::kHasExplicit_Type, viewMatrix); LocalCoords::kHasExplicit_Type, viewMatrix);
} }
@ -209,7 +208,6 @@ void DrawAtlasOp::onCreateProgramInfo(const GrCaps* caps,
const GrXferProcessor::DstProxyView& dstProxyView) { const GrXferProcessor::DstProxyView& dstProxyView) {
// Setup geometry processor // Setup geometry processor
GrGeometryProcessor* gp = make_gp(arena, GrGeometryProcessor* gp = make_gp(arena,
caps->shaderCaps(),
this->hasColors(), this->hasColors(),
this->color(), this->color(),
this->viewMatrix()); this->viewMatrix());

View File

@ -65,7 +65,7 @@ private:
void onPrepareDraws(Target*) override; void onPrepareDraws(Target*) override;
void onExecute(GrOpFlushState*, const SkRect& chainBounds) override; void onExecute(GrOpFlushState*, const SkRect& chainBounds) override;
GrGeometryProcessor* makeGP(SkArenaAlloc*, const GrShaderCaps*); GrGeometryProcessor* makeGP(SkArenaAlloc*);
GrPrimitiveType primitiveType() const { return fPrimitiveType; } GrPrimitiveType primitiveType() const { return fPrimitiveType; }
bool combinablePrimitive() const { bool combinablePrimitive() const {
@ -218,7 +218,7 @@ GrProcessorSet::Analysis DrawVerticesOp::finalize(
return result; return result;
} }
GrGeometryProcessor* DrawVerticesOp::makeGP(SkArenaAlloc* arena, const GrShaderCaps* shaderCaps) { GrGeometryProcessor* DrawVerticesOp::makeGP(SkArenaAlloc* arena) {
using namespace GrDefaultGeoProcFactory; using namespace GrDefaultGeoProcFactory;
LocalCoords::Type localCoordsType; LocalCoords::Type localCoordsType;
if (fHelper.usesLocalCoords()) { if (fHelper.usesLocalCoords()) {
@ -249,7 +249,6 @@ GrGeometryProcessor* DrawVerticesOp::makeGP(SkArenaAlloc* arena, const GrShaderC
fFlags |= kWasCharacterized_Flag; fFlags |= kWasCharacterized_Flag;
return GrDefaultGeoProcFactory::Make(arena, return GrDefaultGeoProcFactory::Make(arena,
shaderCaps,
color, color,
Coverage::kSolid_Type, Coverage::kSolid_Type,
localCoordsType, localCoordsType,
@ -261,7 +260,7 @@ void DrawVerticesOp::onCreateProgramInfo(const GrCaps* caps,
const GrSurfaceProxyView* outputView, const GrSurfaceProxyView* outputView,
GrAppliedClip&& appliedClip, GrAppliedClip&& appliedClip,
const GrXferProcessor::DstProxyView& dstProxyView) { const GrXferProcessor::DstProxyView& dstProxyView) {
GrGeometryProcessor* gp = this->makeGP(arena, caps->shaderCaps()); GrGeometryProcessor* gp = this->makeGP(arena);
fProgramInfo = fHelper.createProgramInfo(caps, arena, outputView, std::move(appliedClip), fProgramInfo = fHelper.createProgramInfo(caps, arena, outputView, std::move(appliedClip),
dstProxyView, gp, this->primitiveType()); dstProxyView, gp, this->primitiveType());

View File

@ -9,7 +9,6 @@
#include "include/core/SkRect.h" #include "include/core/SkRect.h"
#include "src/core/SkLatticeIter.h" #include "src/core/SkLatticeIter.h"
#include "src/core/SkMatrixPriv.h" #include "src/core/SkMatrixPriv.h"
#include "src/gpu/GrDefaultGeoProcFactory.h"
#include "src/gpu/GrDrawOpTest.h" #include "src/gpu/GrDrawOpTest.h"
#include "src/gpu/GrGpu.h" #include "src/gpu/GrGpu.h"
#include "src/gpu/GrOpFlushState.h" #include "src/gpu/GrOpFlushState.h"

View File

@ -20,13 +20,12 @@
#include "src/gpu/ops/GrSimpleMeshDrawOpHelperWithStencil.h" #include "src/gpu/ops/GrSimpleMeshDrawOpHelperWithStencil.h"
static GrGeometryProcessor* make_gp(SkArenaAlloc* arena, static GrGeometryProcessor* make_gp(SkArenaAlloc* arena,
const GrShaderCaps* shaderCaps,
const SkMatrix& viewMatrix, const SkMatrix& viewMatrix,
bool wideColor) { bool wideColor) {
using namespace GrDefaultGeoProcFactory; using namespace GrDefaultGeoProcFactory;
Color::Type colorType = wideColor ? Color::kPremulWideColorAttribute_Type Color::Type colorType = wideColor ? Color::kPremulWideColorAttribute_Type
: Color::kPremulGrColorAttribute_Type; : Color::kPremulGrColorAttribute_Type;
return GrDefaultGeoProcFactory::Make(arena, shaderCaps, colorType, Coverage::kSolid_Type, return GrDefaultGeoProcFactory::Make(arena, colorType, Coverage::kSolid_Type,
LocalCoords::kUsePosition_Type, viewMatrix); LocalCoords::kUsePosition_Type, viewMatrix);
} }
@ -104,7 +103,7 @@ private:
const GrSurfaceProxyView* outputView, const GrSurfaceProxyView* outputView,
GrAppliedClip&& appliedClip, GrAppliedClip&& appliedClip,
const GrXferProcessor::DstProxyView& dstProxyView) override { const GrXferProcessor::DstProxyView& dstProxyView) override {
GrGeometryProcessor* gp = make_gp(arena, caps->shaderCaps(), fViewMatrix, fWideColor); GrGeometryProcessor* gp = make_gp(arena, fViewMatrix, fWideColor);
if (!gp) { if (!gp) {
SkDebugf("Couldn't create GrGeometryProcessor\n"); SkDebugf("Couldn't create GrGeometryProcessor\n");
return; return;

View File

@ -193,8 +193,7 @@ private:
LocalCoords::Type localCoordsType = fHelper.usesLocalCoords() LocalCoords::Type localCoordsType = fHelper.usesLocalCoords()
? LocalCoords::kUsePosition_Type ? LocalCoords::kUsePosition_Type
: LocalCoords::kUnused_Type; : LocalCoords::kUnused_Type;
gp = GrDefaultGeoProcFactory::Make(arena, caps->shaderCaps(), gp = GrDefaultGeoProcFactory::Make(arena, color, Coverage::kSolid_Type, localCoordsType,
color, Coverage::kSolid_Type, localCoordsType,
fViewMatrix); fViewMatrix);
} }
@ -348,7 +347,6 @@ static void compute_aa_rects(SkRect* devOutside, SkRect* devOutsideAssist, SkRec
} }
static GrGeometryProcessor* create_aa_stroke_rect_gp(SkArenaAlloc* arena, static GrGeometryProcessor* create_aa_stroke_rect_gp(SkArenaAlloc* arena,
const GrShaderCaps* shaderCaps,
bool tweakAlphaForCoverage, bool tweakAlphaForCoverage,
const SkMatrix& viewMatrix, const SkMatrix& viewMatrix,
bool usesLocalCoords, bool usesLocalCoords,
@ -362,8 +360,7 @@ static GrGeometryProcessor* create_aa_stroke_rect_gp(SkArenaAlloc* arena,
Color::Type colorType = Color::Type colorType =
wideColor ? Color::kPremulWideColorAttribute_Type: Color::kPremulGrColorAttribute_Type; wideColor ? Color::kPremulWideColorAttribute_Type: Color::kPremulGrColorAttribute_Type;
return MakeForDeviceSpace(arena, shaderCaps, colorType, coverageType, return MakeForDeviceSpace(arena, colorType, coverageType, localCoordsType, viewMatrix);
localCoordsType, viewMatrix);
} }
class AAStrokeRectOp final : public GrMeshDrawOp { class AAStrokeRectOp final : public GrMeshDrawOp {
@ -541,7 +538,6 @@ void AAStrokeRectOp::onCreateProgramInfo(const GrCaps* caps,
const GrXferProcessor::DstProxyView& dstProxyView) { const GrXferProcessor::DstProxyView& dstProxyView) {
GrGeometryProcessor* gp = create_aa_stroke_rect_gp(arena, GrGeometryProcessor* gp = create_aa_stroke_rect_gp(arena,
caps->shaderCaps(),
fHelper.compatibleWithCoverageAsAlpha(), fHelper.compatibleWithCoverageAsAlpha(),
this->viewMatrix(), this->viewMatrix(),
fHelper.usesLocalCoords(), fHelper.usesLocalCoords(),

View File

@ -345,12 +345,10 @@ private:
coverageType = Coverage::kSolid_Type; coverageType = Coverage::kSolid_Type;
} }
if (fAntiAlias) { if (fAntiAlias) {
gp = GrDefaultGeoProcFactory::MakeForDeviceSpace(arena, caps->shaderCaps(), gp = GrDefaultGeoProcFactory::MakeForDeviceSpace(arena, color, coverageType,
color, coverageType,
localCoordsType, fViewMatrix); localCoordsType, fViewMatrix);
} else { } else {
gp = GrDefaultGeoProcFactory::Make(arena, caps->shaderCaps(), gp = GrDefaultGeoProcFactory::Make(arena, color, coverageType, localCoordsType,
color, coverageType, localCoordsType,
fViewMatrix); fViewMatrix);
} }
} }

View File

@ -106,7 +106,6 @@ private:
GrGeometryProcessor* gp = GrDefaultGeoProcFactory::Make( GrGeometryProcessor* gp = GrDefaultGeoProcFactory::Make(
arena, arena,
caps->shaderCaps(),
Color::kPremulGrColorAttribute_Type, Color::kPremulGrColorAttribute_Type,
Coverage::kSolid_Type, Coverage::kSolid_Type,
fHasLocalRect ? LocalCoords::kHasExplicit_Type fHasLocalRect ? LocalCoords::kHasExplicit_Type