Splitup GrSimpleMeshDrawOpHelper.h
Change-Id: Ie3d05053633176ba27e55cc2de61eeba1e9f45d6 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/273981 Reviewed-by: Greg Daniel <egdaniel@google.com> Commit-Queue: Robert Phillips <robertphillips@google.com>
This commit is contained in:
parent
888ba8b3da
commit
55f681faf3
@ -289,6 +289,8 @@ skia_gpu_sources = [
|
||||
"$_src/gpu/ops/GrShadowRRectOp.h",
|
||||
"$_src/gpu/ops/GrSimpleMeshDrawOpHelper.cpp",
|
||||
"$_src/gpu/ops/GrSimpleMeshDrawOpHelper.h",
|
||||
"$_src/gpu/ops/GrSimpleMeshDrawOpHelperWithStencil.cpp",
|
||||
"$_src/gpu/ops/GrSimpleMeshDrawOpHelperWithStencil.h",
|
||||
"$_src/gpu/ops/GrSmallPathRenderer.cpp",
|
||||
"$_src/gpu/ops/GrSmallPathRenderer.h",
|
||||
"$_src/gpu/ops/GrStrokeRectOp.cpp",
|
||||
|
@ -27,7 +27,7 @@
|
||||
#include "src/gpu/glsl/GrGLSLVertexGeoBuilder.h"
|
||||
#include "src/gpu/ops/GrAAConvexPathRenderer.h"
|
||||
#include "src/gpu/ops/GrMeshDrawOp.h"
|
||||
#include "src/gpu/ops/GrSimpleMeshDrawOpHelper.h"
|
||||
#include "src/gpu/ops/GrSimpleMeshDrawOpHelperWithStencil.h"
|
||||
|
||||
GrAAConvexPathRenderer::GrAAConvexPathRenderer() {
|
||||
}
|
||||
|
@ -27,7 +27,7 @@
|
||||
#include "src/gpu/geometry/GrShape.h"
|
||||
#include "src/gpu/ops/GrAAHairLinePathRenderer.h"
|
||||
#include "src/gpu/ops/GrMeshDrawOp.h"
|
||||
#include "src/gpu/ops/GrSimpleMeshDrawOpHelper.h"
|
||||
#include "src/gpu/ops/GrSimpleMeshDrawOpHelperWithStencil.h"
|
||||
|
||||
#define PREALLOC_PTARRAY(N) SkSTArray<(N),SkPoint, true>
|
||||
|
||||
|
@ -25,7 +25,7 @@
|
||||
#include "src/gpu/ops/GrAAConvexTessellator.h"
|
||||
#include "src/gpu/ops/GrAALinearizingConvexPathRenderer.h"
|
||||
#include "src/gpu/ops/GrMeshDrawOp.h"
|
||||
#include "src/gpu/ops/GrSimpleMeshDrawOpHelper.h"
|
||||
#include "src/gpu/ops/GrSimpleMeshDrawOpHelperWithStencil.h"
|
||||
|
||||
static const int DEFAULT_BUFFER_SIZE = 100;
|
||||
|
||||
|
@ -25,7 +25,7 @@
|
||||
#include "src/gpu/geometry/GrPathUtils.h"
|
||||
#include "src/gpu/geometry/GrShape.h"
|
||||
#include "src/gpu/ops/GrMeshDrawOp.h"
|
||||
#include "src/gpu/ops/GrSimpleMeshDrawOpHelper.h"
|
||||
#include "src/gpu/ops/GrSimpleMeshDrawOpHelperWithStencil.h"
|
||||
|
||||
GrDefaultPathRenderer::GrDefaultPathRenderer() {
|
||||
}
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include "src/gpu/glsl/GrGLSLVarying.h"
|
||||
#include "src/gpu/ops/GrMeshDrawOp.h"
|
||||
#include "src/gpu/ops/GrQuadPerEdgeAA.h"
|
||||
#include "src/gpu/ops/GrSimpleMeshDrawOpHelperWithStencil.h"
|
||||
|
||||
namespace {
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
||||
#include "src/gpu/GrResourceProvider.h"
|
||||
#include "src/gpu/GrVertexWriter.h"
|
||||
#include "src/gpu/ops/GrMeshDrawOp.h"
|
||||
#include "src/gpu/ops/GrSimpleMeshDrawOpHelper.h"
|
||||
#include "src/gpu/ops/GrSimpleMeshDrawOpHelperWithStencil.h"
|
||||
|
||||
static GrGeometryProcessor* make_gp(SkArenaAlloc* arena,
|
||||
const GrShaderCaps* shaderCaps,
|
||||
|
@ -186,58 +186,3 @@ SkString GrSimpleMeshDrawOpHelper::dumpInfo() const {
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
|
||||
const GrPipeline* GrSimpleMeshDrawOpHelperWithStencil::createPipelineWithStencil(
|
||||
GrOpFlushState* flushState) {
|
||||
return GrSimpleMeshDrawOpHelper::CreatePipeline(&flushState->caps(),
|
||||
flushState->allocator(),
|
||||
flushState->view(),
|
||||
flushState->detachAppliedClip(),
|
||||
flushState->dstProxyView(),
|
||||
this->detachProcessorSet(),
|
||||
this->pipelineFlags(),
|
||||
this->stencilSettings());
|
||||
}
|
||||
|
||||
GrSimpleMeshDrawOpHelperWithStencil::GrSimpleMeshDrawOpHelperWithStencil(
|
||||
const MakeArgs& args, GrAAType aaType, const GrUserStencilSettings* stencilSettings,
|
||||
InputFlags inputFlags)
|
||||
: INHERITED(args, aaType, inputFlags)
|
||||
, fStencilSettings(stencilSettings ? stencilSettings : &GrUserStencilSettings::kUnused) {}
|
||||
|
||||
GrDrawOp::FixedFunctionFlags GrSimpleMeshDrawOpHelperWithStencil::fixedFunctionFlags() const {
|
||||
GrDrawOp::FixedFunctionFlags flags = INHERITED::fixedFunctionFlags();
|
||||
if (fStencilSettings != &GrUserStencilSettings::kUnused) {
|
||||
flags |= GrDrawOp::FixedFunctionFlags::kUsesStencil;
|
||||
}
|
||||
return flags;
|
||||
}
|
||||
|
||||
GrProcessorSet::Analysis GrSimpleMeshDrawOpHelperWithStencil::finalizeProcessors(
|
||||
const GrCaps& caps, const GrAppliedClip* clip, bool hasMixedSampledCoverage,
|
||||
GrClampType clampType, GrProcessorAnalysisCoverage geometryCoverage,
|
||||
SkPMColor4f* geometryColor, bool* wideColor) {
|
||||
GrProcessorAnalysisColor color = *geometryColor;
|
||||
auto result = this->finalizeProcessors(
|
||||
caps, clip, hasMixedSampledCoverage, clampType, geometryCoverage, &color);
|
||||
color.isConstant(geometryColor);
|
||||
if (wideColor) {
|
||||
*wideColor = !geometryColor->fitsInBytes();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
bool GrSimpleMeshDrawOpHelperWithStencil::isCompatible(
|
||||
const GrSimpleMeshDrawOpHelperWithStencil& that, const GrCaps& caps,
|
||||
const SkRect& thisBounds, const SkRect& thatBounds, bool ignoreAAType) const {
|
||||
return INHERITED::isCompatible(that, caps, thisBounds, thatBounds, ignoreAAType) &&
|
||||
fStencilSettings == that.fStencilSettings;
|
||||
}
|
||||
|
||||
#ifdef SK_DEBUG
|
||||
SkString GrSimpleMeshDrawOpHelperWithStencil::dumpInfo() const {
|
||||
SkString result = INHERITED::dumpInfo();
|
||||
result.appendf("Stencil settings: %s\n", (fStencilSettings ? "yes" : "no"));
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
|
@ -161,70 +161,6 @@ protected:
|
||||
SkDEBUGCODE(unsigned fDidAnalysis : 1;)
|
||||
};
|
||||
|
||||
/**
|
||||
* This class extends GrSimpleMeshDrawOpHelper to support an optional GrUserStencilSettings. This
|
||||
* uses private inheritance because it non-virtually overrides methods in the base class and should
|
||||
* never be used with a GrSimpleMeshDrawOpHelper pointer or reference.
|
||||
*/
|
||||
class GrSimpleMeshDrawOpHelperWithStencil : private GrSimpleMeshDrawOpHelper {
|
||||
public:
|
||||
using MakeArgs = GrSimpleMeshDrawOpHelper::MakeArgs;
|
||||
using InputFlags = GrSimpleMeshDrawOpHelper::InputFlags;
|
||||
|
||||
using GrSimpleMeshDrawOpHelper::visitProxies;
|
||||
|
||||
const GrPipeline* createPipelineWithStencil(GrOpFlushState* flushState);
|
||||
|
||||
// using declarations can't be templated, so this is a pass through function instead.
|
||||
template <typename Op, typename... OpArgs>
|
||||
static std::unique_ptr<GrDrawOp> FactoryHelper(GrRecordingContext* context, GrPaint&& paint,
|
||||
OpArgs... opArgs) {
|
||||
return GrSimpleMeshDrawOpHelper::FactoryHelper<Op, OpArgs...>(
|
||||
context, std::move(paint), std::forward<OpArgs>(opArgs)...);
|
||||
}
|
||||
|
||||
GrSimpleMeshDrawOpHelperWithStencil(const MakeArgs&, GrAAType, const GrUserStencilSettings*,
|
||||
InputFlags = InputFlags::kNone);
|
||||
|
||||
GrDrawOp::FixedFunctionFlags fixedFunctionFlags() const;
|
||||
|
||||
GrProcessorSet::Analysis finalizeProcessors(
|
||||
const GrCaps& caps, const GrAppliedClip* clip, bool hasMixedSampledCoverage,
|
||||
GrClampType clampType, GrProcessorAnalysisCoverage geometryCoverage,
|
||||
GrProcessorAnalysisColor* geometryColor) {
|
||||
return this->INHERITED::finalizeProcessors(
|
||||
caps, clip, fStencilSettings, hasMixedSampledCoverage, clampType, geometryCoverage,
|
||||
geometryColor);
|
||||
}
|
||||
|
||||
GrProcessorSet::Analysis finalizeProcessors(
|
||||
const GrCaps&, const GrAppliedClip*, bool hasMixedSampledCoverage, GrClampType,
|
||||
GrProcessorAnalysisCoverage geometryCoverage, SkPMColor4f* geometryColor, bool*
|
||||
wideColor);
|
||||
|
||||
using GrSimpleMeshDrawOpHelper::aaType;
|
||||
using GrSimpleMeshDrawOpHelper::setAAType;
|
||||
using GrSimpleMeshDrawOpHelper::isTrivial;
|
||||
using GrSimpleMeshDrawOpHelper::usesLocalCoords;
|
||||
using GrSimpleMeshDrawOpHelper::compatibleWithCoverageAsAlpha;
|
||||
using GrSimpleMeshDrawOpHelper::detachProcessorSet;
|
||||
using GrSimpleMeshDrawOpHelper::pipelineFlags;
|
||||
|
||||
bool isCompatible(const GrSimpleMeshDrawOpHelperWithStencil& that, const GrCaps&,
|
||||
const SkRect& thisBounds, const SkRect& thatBounds,
|
||||
bool ignoreAAType = false) const;
|
||||
|
||||
#ifdef SK_DEBUG
|
||||
SkString dumpInfo() const;
|
||||
#endif
|
||||
|
||||
const GrUserStencilSettings* stencilSettings() const { return fStencilSettings; }
|
||||
|
||||
private:
|
||||
const GrUserStencilSettings* fStencilSettings;
|
||||
typedef GrSimpleMeshDrawOpHelper INHERITED;
|
||||
};
|
||||
|
||||
template <typename Op, typename... OpArgs>
|
||||
std::unique_ptr<GrDrawOp> GrSimpleMeshDrawOpHelper::FactoryHelper(GrRecordingContext* context,
|
||||
GrPaint&& paint,
|
||||
|
63
src/gpu/ops/GrSimpleMeshDrawOpHelperWithStencil.cpp
Normal file
63
src/gpu/ops/GrSimpleMeshDrawOpHelperWithStencil.cpp
Normal file
@ -0,0 +1,63 @@
|
||||
/*
|
||||
* Copyright 2020 Google Inc.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license that can be
|
||||
* found in the LICENSE file.
|
||||
*/
|
||||
|
||||
#include "src/gpu/ops/GrSimpleMeshDrawOpHelperWithStencil.h"
|
||||
|
||||
const GrPipeline* GrSimpleMeshDrawOpHelperWithStencil::createPipelineWithStencil(
|
||||
GrOpFlushState* flushState) {
|
||||
return GrSimpleMeshDrawOpHelper::CreatePipeline(&flushState->caps(),
|
||||
flushState->allocator(),
|
||||
flushState->view(),
|
||||
flushState->detachAppliedClip(),
|
||||
flushState->dstProxyView(),
|
||||
this->detachProcessorSet(),
|
||||
this->pipelineFlags(),
|
||||
this->stencilSettings());
|
||||
}
|
||||
|
||||
GrSimpleMeshDrawOpHelperWithStencil::GrSimpleMeshDrawOpHelperWithStencil(
|
||||
const MakeArgs& args, GrAAType aaType, const GrUserStencilSettings* stencilSettings,
|
||||
InputFlags inputFlags)
|
||||
: INHERITED(args, aaType, inputFlags)
|
||||
, fStencilSettings(stencilSettings ? stencilSettings : &GrUserStencilSettings::kUnused) {}
|
||||
|
||||
GrDrawOp::FixedFunctionFlags GrSimpleMeshDrawOpHelperWithStencil::fixedFunctionFlags() const {
|
||||
GrDrawOp::FixedFunctionFlags flags = INHERITED::fixedFunctionFlags();
|
||||
if (fStencilSettings != &GrUserStencilSettings::kUnused) {
|
||||
flags |= GrDrawOp::FixedFunctionFlags::kUsesStencil;
|
||||
}
|
||||
return flags;
|
||||
}
|
||||
|
||||
GrProcessorSet::Analysis GrSimpleMeshDrawOpHelperWithStencil::finalizeProcessors(
|
||||
const GrCaps& caps, const GrAppliedClip* clip, bool hasMixedSampledCoverage,
|
||||
GrClampType clampType, GrProcessorAnalysisCoverage geometryCoverage,
|
||||
SkPMColor4f* geometryColor, bool* wideColor) {
|
||||
GrProcessorAnalysisColor color = *geometryColor;
|
||||
auto result = this->finalizeProcessors(
|
||||
caps, clip, hasMixedSampledCoverage, clampType, geometryCoverage, &color);
|
||||
color.isConstant(geometryColor);
|
||||
if (wideColor) {
|
||||
*wideColor = !geometryColor->fitsInBytes();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
bool GrSimpleMeshDrawOpHelperWithStencil::isCompatible(
|
||||
const GrSimpleMeshDrawOpHelperWithStencil& that, const GrCaps& caps,
|
||||
const SkRect& thisBounds, const SkRect& thatBounds, bool ignoreAAType) const {
|
||||
return INHERITED::isCompatible(that, caps, thisBounds, thatBounds, ignoreAAType) &&
|
||||
fStencilSettings == that.fStencilSettings;
|
||||
}
|
||||
|
||||
#ifdef SK_DEBUG
|
||||
SkString GrSimpleMeshDrawOpHelperWithStencil::dumpInfo() const {
|
||||
SkString result = INHERITED::dumpInfo();
|
||||
result.appendf("Stencil settings: %s\n", (fStencilSettings ? "yes" : "no"));
|
||||
return result;
|
||||
}
|
||||
#endif
|
77
src/gpu/ops/GrSimpleMeshDrawOpHelperWithStencil.h
Normal file
77
src/gpu/ops/GrSimpleMeshDrawOpHelperWithStencil.h
Normal file
@ -0,0 +1,77 @@
|
||||
/*
|
||||
* Copyright 2020 Google Inc.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license that can be
|
||||
* found in the LICENSE file.
|
||||
*/
|
||||
|
||||
#ifndef GrSimpleMeshDrawOpHelperWithStencil_DEFINED
|
||||
#define GrSimpleMeshDrawOpHelperWithStencil_DEFINED
|
||||
|
||||
#include "src/gpu/ops/GrSimpleMeshDrawOpHelper.h"
|
||||
|
||||
/**
|
||||
* This class extends GrSimpleMeshDrawOpHelper to support an optional GrUserStencilSettings. This
|
||||
* uses private inheritance because it non-virtually overrides methods in the base class and should
|
||||
* never be used with a GrSimpleMeshDrawOpHelper pointer or reference.
|
||||
*/
|
||||
class GrSimpleMeshDrawOpHelperWithStencil : private GrSimpleMeshDrawOpHelper {
|
||||
public:
|
||||
using MakeArgs = GrSimpleMeshDrawOpHelper::MakeArgs;
|
||||
using InputFlags = GrSimpleMeshDrawOpHelper::InputFlags;
|
||||
|
||||
using GrSimpleMeshDrawOpHelper::visitProxies;
|
||||
|
||||
const GrPipeline* createPipelineWithStencil(GrOpFlushState* flushState);
|
||||
|
||||
// using declarations can't be templated, so this is a pass through function instead.
|
||||
template <typename Op, typename... OpArgs>
|
||||
static std::unique_ptr<GrDrawOp> FactoryHelper(GrRecordingContext* context, GrPaint&& paint,
|
||||
OpArgs... opArgs) {
|
||||
return GrSimpleMeshDrawOpHelper::FactoryHelper<Op, OpArgs...>(
|
||||
context, std::move(paint), std::forward<OpArgs>(opArgs)...);
|
||||
}
|
||||
|
||||
GrSimpleMeshDrawOpHelperWithStencil(const MakeArgs&, GrAAType, const GrUserStencilSettings*,
|
||||
InputFlags = InputFlags::kNone);
|
||||
|
||||
GrDrawOp::FixedFunctionFlags fixedFunctionFlags() const;
|
||||
|
||||
GrProcessorSet::Analysis finalizeProcessors(
|
||||
const GrCaps& caps, const GrAppliedClip* clip, bool hasMixedSampledCoverage,
|
||||
GrClampType clampType, GrProcessorAnalysisCoverage geometryCoverage,
|
||||
GrProcessorAnalysisColor* geometryColor) {
|
||||
return this->INHERITED::finalizeProcessors(
|
||||
caps, clip, fStencilSettings, hasMixedSampledCoverage, clampType, geometryCoverage,
|
||||
geometryColor);
|
||||
}
|
||||
|
||||
GrProcessorSet::Analysis finalizeProcessors(
|
||||
const GrCaps&, const GrAppliedClip*, bool hasMixedSampledCoverage, GrClampType,
|
||||
GrProcessorAnalysisCoverage geometryCoverage, SkPMColor4f* geometryColor, bool*
|
||||
wideColor);
|
||||
|
||||
using GrSimpleMeshDrawOpHelper::aaType;
|
||||
using GrSimpleMeshDrawOpHelper::setAAType;
|
||||
using GrSimpleMeshDrawOpHelper::isTrivial;
|
||||
using GrSimpleMeshDrawOpHelper::usesLocalCoords;
|
||||
using GrSimpleMeshDrawOpHelper::compatibleWithCoverageAsAlpha;
|
||||
using GrSimpleMeshDrawOpHelper::detachProcessorSet;
|
||||
using GrSimpleMeshDrawOpHelper::pipelineFlags;
|
||||
|
||||
bool isCompatible(const GrSimpleMeshDrawOpHelperWithStencil& that, const GrCaps&,
|
||||
const SkRect& thisBounds, const SkRect& thatBounds,
|
||||
bool ignoreAAType = false) const;
|
||||
|
||||
#ifdef SK_DEBUG
|
||||
SkString dumpInfo() const;
|
||||
#endif
|
||||
|
||||
const GrUserStencilSettings* stencilSettings() const { return fStencilSettings; }
|
||||
|
||||
private:
|
||||
const GrUserStencilSettings* fStencilSettings;
|
||||
typedef GrSimpleMeshDrawOpHelper INHERITED;
|
||||
};
|
||||
|
||||
#endif
|
@ -27,7 +27,7 @@
|
||||
#include "src/gpu/effects/GrDistanceFieldGeoProc.h"
|
||||
#include "src/gpu/geometry/GrQuad.h"
|
||||
#include "src/gpu/ops/GrMeshDrawOp.h"
|
||||
#include "src/gpu/ops/GrSimpleMeshDrawOpHelper.h"
|
||||
#include "src/gpu/ops/GrSimpleMeshDrawOpHelperWithStencil.h"
|
||||
|
||||
static constexpr size_t kMaxAtlasTextureBytes = 2048 * 2048;
|
||||
static constexpr size_t kPlotWidth = 512;
|
||||
|
@ -23,7 +23,7 @@
|
||||
#include "src/gpu/geometry/GrPathUtils.h"
|
||||
#include "src/gpu/geometry/GrShape.h"
|
||||
#include "src/gpu/ops/GrMeshDrawOp.h"
|
||||
#include "src/gpu/ops/GrSimpleMeshDrawOpHelper.h"
|
||||
#include "src/gpu/ops/GrSimpleMeshDrawOpHelperWithStencil.h"
|
||||
|
||||
#ifndef GR_AA_TESSELLATOR_MAX_VERB_COUNT
|
||||
#define GR_AA_TESSELLATOR_MAX_VERB_COUNT 10
|
||||
|
Loading…
Reference in New Issue
Block a user