Move GrTessellationPathFlags to their own header (GrTessTypes.h)
Having this enum on GrTessellationPathRenderer forced it to be over-#included and was blocking making GrTessellationPathRenderer.h v1-only. Bug: skia:11837 Change-Id: I80660ed659946d7aa555057c9f4fd1136b44cca0 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/440536 Reviewed-by: Greg Daniel <egdaniel@google.com> Commit-Queue: Robert Phillips <robertphillips@google.com>
This commit is contained in:
parent
dfadba8bbf
commit
832f3fbcae
@ -340,7 +340,7 @@ skia_gpu_sources = [
|
||||
"$_src/gpu/tessellate/GrStrokeHardwareTessellator.h",
|
||||
"$_src/gpu/tessellate/GrStrokeIterator.h",
|
||||
"$_src/gpu/tessellate/GrStrokeTessellator.h",
|
||||
"$_src/gpu/tessellate/GrTessellationPathRenderer.h",
|
||||
"$_src/gpu/tessellate/GrTessTypes.h",
|
||||
"$_src/gpu/tessellate/GrVectorXform.h",
|
||||
|
||||
# tessellate/shaders
|
||||
@ -582,6 +582,7 @@ skia_skgpu_v1_sources = [
|
||||
"$_src/gpu/tessellate/GrStrokeTessellateOp.cpp",
|
||||
"$_src/gpu/tessellate/GrStrokeTessellateOp.h",
|
||||
"$_src/gpu/tessellate/GrTessellationPathRenderer.cpp",
|
||||
"$_src/gpu/tessellate/GrTessellationPathRenderer.h",
|
||||
|
||||
# v1
|
||||
"$_src/gpu/v1/ClipStack.cpp",
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include "src/gpu/ops/GrSimpleMeshDrawOpHelper.h"
|
||||
#include "src/gpu/tessellate/GrPathCurveTessellator.h"
|
||||
#include "src/gpu/tessellate/GrPathWedgeTessellator.h"
|
||||
#include "src/gpu/tessellate/GrTessellationPathRenderer.h"
|
||||
#include "src/gpu/tessellate/shaders/GrPathTessellationShader.h"
|
||||
#include "src/gpu/v1/SurfaceDrawContext_v1.h"
|
||||
|
||||
|
@ -979,7 +979,7 @@ GrAtlasPathRenderer* GrDrawingManager::getAtlasPathRenderer() {
|
||||
return fPathRendererChain->getAtlasPathRenderer();
|
||||
}
|
||||
|
||||
GrTessellationPathRenderer* GrDrawingManager::getTessellationPathRenderer() {
|
||||
GrPathRenderer* GrDrawingManager::getTessellationPathRenderer() {
|
||||
if (!fPathRendererChain) {
|
||||
fPathRendererChain = std::make_unique<GrPathRendererChain>(fContext,
|
||||
fOptionsForPathRendererChain);
|
||||
|
@ -37,7 +37,6 @@ class GrRenderTask;
|
||||
class GrResourceAllocator;
|
||||
class GrSemaphore;
|
||||
class GrSurfaceProxyView;
|
||||
class GrTessellationPathRenderer;
|
||||
class GrTextureResolveRenderTask;
|
||||
class SkDeferredDisplayList;
|
||||
namespace skgpu { namespace v1 { class SoftwarePathRenderer; }}
|
||||
@ -125,7 +124,7 @@ public:
|
||||
|
||||
// Returns a direct pointer to the tessellation path renderer, or null if it is not supported
|
||||
// and turned on.
|
||||
GrTessellationPathRenderer* getTessellationPathRenderer();
|
||||
GrPathRenderer* getTessellationPathRenderer();
|
||||
#endif
|
||||
|
||||
void flushIfNecessary();
|
||||
|
@ -56,7 +56,7 @@ public:
|
||||
|
||||
/** Returns a direct pointer to the tessellation path renderer, or null if it is not in the
|
||||
chain. */
|
||||
GrTessellationPathRenderer* getTessellationPathRenderer() {
|
||||
GrPathRenderer* getTessellationPathRenderer() {
|
||||
return fTessellationPathRenderer;
|
||||
}
|
||||
|
||||
@ -64,9 +64,9 @@ private:
|
||||
enum {
|
||||
kPreAllocCount = 8,
|
||||
};
|
||||
SkSTArray<kPreAllocCount, sk_sp<GrPathRenderer>> fChain;
|
||||
GrAtlasPathRenderer* fAtlasPathRenderer = nullptr;
|
||||
GrTessellationPathRenderer* fTessellationPathRenderer = nullptr;
|
||||
SkSTArray<kPreAllocCount, sk_sp<GrPathRenderer>> fChain;
|
||||
GrAtlasPathRenderer* fAtlasPathRenderer = nullptr;
|
||||
GrPathRenderer* fTessellationPathRenderer = nullptr;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -99,7 +99,7 @@ GrRenderTask::ExpectedOutcome GrAtlasRenderTask::onMakeClosed(GrRecordingContext
|
||||
pathList->pathCount(),
|
||||
GrPaint(),
|
||||
GrAAType::kMSAA,
|
||||
GrTessellationPathRenderer::PathFlags::kStencilOnly,
|
||||
GrTessellationPathFlags::kStencilOnly,
|
||||
drawRect);
|
||||
this->addAtlasDrawOp(std::move(op), caps);
|
||||
}
|
||||
|
@ -5,8 +5,8 @@
|
||||
* found in the LICENSE file.
|
||||
*/
|
||||
|
||||
#ifndef GrGrAtlasRenderTask_DEFINED
|
||||
#define GrGrAtlasRenderTask_DEFINED
|
||||
#ifndef GrAtlasRenderTask_DEFINED
|
||||
#define GrAtlasRenderTask_DEFINED
|
||||
|
||||
#include "include/core/SkPath.h"
|
||||
#include "src/gpu/GrDynamicAtlas.h"
|
||||
|
@ -14,10 +14,9 @@
|
||||
#include "src/gpu/GrResourceProvider.h"
|
||||
#include "src/gpu/glsl/GrGLSLVertexGeoBuilder.h"
|
||||
#include "src/gpu/tessellate/GrPathCurveTessellator.h"
|
||||
#include "src/gpu/tessellate/GrTessellationPathRenderer.h"
|
||||
#include "src/gpu/tessellate/shaders/GrPathTessellationShader.h"
|
||||
|
||||
using PathFlags = GrTessellationPathRenderer::PathFlags;
|
||||
using PathFlags = GrTessellationPathFlags;
|
||||
|
||||
namespace {
|
||||
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
#include "src/gpu/geometry/GrInnerFanTriangulator.h"
|
||||
#include "src/gpu/ops/GrDrawOp.h"
|
||||
#include "src/gpu/tessellate/GrTessellationPathRenderer.h"
|
||||
#include "src/gpu/tessellate/GrTessTypes.h"
|
||||
#include "src/gpu/tessellate/shaders/GrTessellationShader.h"
|
||||
|
||||
class GrPathCurveTessellator;
|
||||
@ -28,8 +28,8 @@ private:
|
||||
DEFINE_OP_CLASS_ID
|
||||
|
||||
GrPathInnerTriangulateOp(const SkMatrix& viewMatrix, const SkPath& path, GrPaint&& paint,
|
||||
GrAAType aaType, GrTessellationPathRenderer::PathFlags pathFlags,
|
||||
const SkRect& drawBounds)
|
||||
GrAAType aaType, GrTessellationPathFlags pathFlags,
|
||||
const SkRect& drawBounds)
|
||||
: GrDrawOp(ClassID())
|
||||
, fPathFlags(pathFlags)
|
||||
, fViewMatrix(viewMatrix)
|
||||
@ -57,7 +57,7 @@ private:
|
||||
void onPrepare(GrOpFlushState*) override;
|
||||
void onExecute(GrOpFlushState*, const SkRect& chainBounds) override;
|
||||
|
||||
const GrTessellationPathRenderer::PathFlags fPathFlags;
|
||||
const GrTessellationPathFlags fPathFlags;
|
||||
const SkMatrix fViewMatrix;
|
||||
const SkPath fPath;
|
||||
const GrAAType fAAType;
|
||||
|
@ -19,10 +19,9 @@
|
||||
#include "src/gpu/tessellate/GrMiddleOutPolygonTriangulator.h"
|
||||
#include "src/gpu/tessellate/GrPathCurveTessellator.h"
|
||||
#include "src/gpu/tessellate/GrPathWedgeTessellator.h"
|
||||
#include "src/gpu/tessellate/GrTessellationPathRenderer.h"
|
||||
#include "src/gpu/tessellate/shaders/GrPathTessellationShader.h"
|
||||
|
||||
using PathFlags = GrTessellationPathRenderer::PathFlags;
|
||||
using PathFlags = GrTessellationPathFlags;
|
||||
|
||||
namespace {
|
||||
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
#include "src/gpu/ops/GrDrawOp.h"
|
||||
#include "src/gpu/tessellate/GrPathTessellator.h"
|
||||
#include "src/gpu/tessellate/GrTessellationPathRenderer.h"
|
||||
#include "src/gpu/tessellate/GrTessTypes.h"
|
||||
#include "src/gpu/tessellate/shaders/GrTessellationShader.h"
|
||||
|
||||
// Draws paths using a standard Redbook "stencil then cover" method. Curves get linearized by either
|
||||
@ -29,7 +29,7 @@ private:
|
||||
const SkPath& path,
|
||||
GrPaint&& paint,
|
||||
GrAAType aaType,
|
||||
GrTessellationPathRenderer::PathFlags pathFlags,
|
||||
GrTessellationPathFlags pathFlags,
|
||||
const SkRect& drawBounds)
|
||||
: GrDrawOp(ClassID())
|
||||
, fPathDrawList(arena->make<PathDrawList>(viewMatrix, path))
|
||||
@ -51,7 +51,7 @@ private:
|
||||
int pathCount,
|
||||
GrPaint&& paint,
|
||||
GrAAType aaType,
|
||||
GrTessellationPathRenderer::PathFlags pathFlags,
|
||||
GrTessellationPathFlags pathFlags,
|
||||
const SkRect& drawBounds)
|
||||
: GrDrawOp(ClassID())
|
||||
, fPathDrawList(pathDrawList)
|
||||
@ -87,7 +87,7 @@ private:
|
||||
const PathDrawList* fPathDrawList;
|
||||
const int fTotalCombinedPathVerbCnt;
|
||||
const int fPathCount;
|
||||
const GrTessellationPathRenderer::PathFlags fPathFlags;
|
||||
const GrTessellationPathFlags fPathFlags;
|
||||
const GrAAType fAAType;
|
||||
SkPMColor4f fColor;
|
||||
GrProcessorSet fProcessors;
|
||||
|
22
src/gpu/tessellate/GrTessTypes.h
Normal file
22
src/gpu/tessellate/GrTessTypes.h
Normal file
@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Copyright 2021 Google LLC
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license that can be
|
||||
* found in the LICENSE file.
|
||||
*/
|
||||
|
||||
#ifndef GrTessTypes_DEFINED
|
||||
#define GrTessTypes_DEFINED
|
||||
|
||||
#include "include/gpu/GrTypes.h"
|
||||
|
||||
// We send these flags to the internal path filling Ops to control how a path gets rendered.
|
||||
enum class GrTessellationPathFlags {
|
||||
kNone = 0,
|
||||
kStencilOnly = (1 << 0),
|
||||
kWireframe = (1 << 1)
|
||||
};
|
||||
|
||||
GR_MAKE_BITFIELD_CLASS_OPS(GrTessellationPathFlags)
|
||||
|
||||
#endif
|
@ -64,7 +64,7 @@ GrPathRenderer::CanDrawPath GrTessellationPathRenderer::onCanDrawPath(
|
||||
|
||||
static GrOp::Owner make_non_convex_fill_op(GrRecordingContext* rContext,
|
||||
SkArenaAlloc* arena,
|
||||
GrTessellationPathRenderer::PathFlags pathFlags,
|
||||
GrTessellationPathFlags pathFlags,
|
||||
GrAAType aaType,
|
||||
const SkRect& drawBounds,
|
||||
const SkMatrix& viewMatrix,
|
||||
@ -144,7 +144,7 @@ bool GrTessellationPathRenderer::onDrawPath(const DrawPathArgs& args) {
|
||||
: pathDevBounds;
|
||||
auto op = make_non_convex_fill_op(args.fContext,
|
||||
args.fSurfaceDrawContext->arenaAlloc(),
|
||||
PathFlags::kNone,
|
||||
GrTessellationPathFlags::kNone,
|
||||
args.fAAType,
|
||||
drawBounds,
|
||||
*args.fViewMatrix,
|
||||
@ -188,7 +188,7 @@ void GrTessellationPathRenderer::onStencilPath(const StencilPathArgs& args) {
|
||||
|
||||
auto op = make_non_convex_fill_op(args.fContext,
|
||||
args.fSurfaceDrawContext->arenaAlloc(),
|
||||
PathFlags::kStencilOnly,
|
||||
GrTessellationPathFlags::kStencilOnly,
|
||||
aaType,
|
||||
pathDevBounds,
|
||||
*args.fViewMatrix,
|
||||
|
@ -9,54 +9,25 @@
|
||||
#define GrTessellationPathRenderer_DEFINED
|
||||
|
||||
#include "include/gpu/GrTypes.h"
|
||||
#include "src/gpu/GrPathRenderer.h"
|
||||
|
||||
class GrCaps;
|
||||
|
||||
#if SK_GPU_V1
|
||||
|
||||
#include "src/gpu/GrPathRenderer.h"
|
||||
|
||||
// This is the tie-in point for path rendering via GrPathTessellateOp. This path renderer draws
|
||||
// paths using a hybrid Red Book "stencil, then cover" method. Curves get linearized by GPU
|
||||
// tessellation shaders. This path renderer doesn't apply analytic AA, so it requires MSAA if AA is
|
||||
// desired.
|
||||
class GrTessellationPathRenderer : public GrPathRenderer {
|
||||
class GrTessellationPathRenderer final : public GrPathRenderer {
|
||||
public:
|
||||
// We send these flags to the internal path filling Ops to control how a path gets rendered.
|
||||
enum class PathFlags {
|
||||
kNone = 0,
|
||||
kStencilOnly = (1 << 0),
|
||||
kWireframe = (1 << 1)
|
||||
};
|
||||
|
||||
static bool IsSupported(const GrCaps&);
|
||||
|
||||
const char* name() const final { return "GrTessellationPathRenderer"; }
|
||||
const char* name() const override { return "Tessellation"; }
|
||||
|
||||
private:
|
||||
StencilSupport onGetStencilSupport(const GrStyledShape&) const override;
|
||||
CanDrawPath onCanDrawPath(const CanDrawPathArgs&) const override;
|
||||
bool onDrawPath(const DrawPathArgs&) override;
|
||||
void onStencilPath(const StencilPathArgs&) override;
|
||||
};
|
||||
|
||||
GR_MAKE_BITFIELD_CLASS_OPS(GrTessellationPathRenderer::PathFlags)
|
||||
|
||||
#else // SK_GPU_V1
|
||||
|
||||
class GrTessellationPathRenderer {
|
||||
public:
|
||||
// We send these flags to the internal path filling Ops to control how a path gets rendered.
|
||||
enum class PathFlags {
|
||||
kNone = 0,
|
||||
kStencilOnly = (1 << 0),
|
||||
kWireframe = (1 << 1)
|
||||
};
|
||||
|
||||
static bool IsSupported(const GrCaps&) { return false; }
|
||||
|
||||
};
|
||||
|
||||
GR_MAKE_BITFIELD_CLASS_OPS(GrTessellationPathRenderer::PathFlags)
|
||||
|
||||
#endif // SK_GPU_V1
|
||||
|
||||
#endif
|
||||
|
@ -56,9 +56,9 @@ GrPathTessellationShader* GrPathTessellationShader::MakeSimpleTriangleShader(
|
||||
const GrPipeline* GrPathTessellationShader::MakeStencilOnlyPipeline(
|
||||
const ProgramArgs& args,
|
||||
GrAAType aaType,
|
||||
GrTessellationPathRenderer::PathFlags pathFlags,
|
||||
GrTessellationPathFlags pathFlags,
|
||||
const GrAppliedHardClip& hardClip) {
|
||||
using PathFlags = GrTessellationPathRenderer::PathFlags;
|
||||
using PathFlags = GrTessellationPathFlags;
|
||||
GrPipeline::InitArgs pipelineArgs;
|
||||
if (aaType == GrAAType::kMSAA) {
|
||||
pipelineArgs.fInputFlags |= GrPipeline::InputFlags::kHWAntialias;
|
||||
|
@ -8,7 +8,7 @@
|
||||
#ifndef GrPathTessellationShader_DEFINED
|
||||
#define GrPathTessellationShader_DEFINED
|
||||
|
||||
#include "src/gpu/tessellate/GrTessellationPathRenderer.h"
|
||||
#include "src/gpu/tessellate/GrTessTypes.h"
|
||||
#include "src/gpu/tessellate/shaders/GrTessellationShader.h"
|
||||
|
||||
// This is the base class for shaders in the GPU tessellator that fill paths.
|
||||
@ -154,7 +154,7 @@ public:
|
||||
// Creates a pipeline that does not write to the color buffer.
|
||||
static const GrPipeline* MakeStencilOnlyPipeline(const ProgramArgs&,
|
||||
GrAAType,
|
||||
GrTessellationPathRenderer::PathFlags,
|
||||
GrTessellationPathFlags,
|
||||
const GrAppliedHardClip&);
|
||||
|
||||
protected:
|
||||
|
@ -13,7 +13,6 @@
|
||||
#include "include/core/SkStrokeRec.h"
|
||||
#include "src/gpu/GrVx.h"
|
||||
#include "src/gpu/glsl/GrGLSLVarying.h"
|
||||
#include "src/gpu/tessellate/GrTessellationPathRenderer.h"
|
||||
|
||||
// Tessellates a batch of stroke patches directly to the canvas. Tessellated stroking works by
|
||||
// creating stroke-width, orthogonal edges at set locations along the curve and then connecting them
|
||||
|
@ -67,7 +67,6 @@
|
||||
#include "src/gpu/ops/GrShadowRRectOp.h"
|
||||
#include "src/gpu/ops/GrStrokeRectOp.h"
|
||||
#include "src/gpu/ops/GrTextureOp.h"
|
||||
#include "src/gpu/tessellate/GrTessellationPathRenderer.h"
|
||||
#include "src/gpu/text/GrSDFTControl.h"
|
||||
#include "src/gpu/text/GrTextBlobCache.h"
|
||||
|
||||
|
@ -32,7 +32,6 @@
|
||||
#include "src/gpu/GrPersistentCacheUtils.h"
|
||||
#include "src/gpu/GrShaderUtils.h"
|
||||
#include "src/gpu/ops/GrAtlasPathRenderer.h"
|
||||
#include "src/gpu/tessellate/GrTessellationPathRenderer.h"
|
||||
#include "src/image/SkImage_Base.h"
|
||||
#include "src/sksl/SkSLCompiler.h"
|
||||
#include "src/utils/SkJSONWriter.h"
|
||||
@ -54,6 +53,10 @@
|
||||
#include "tools/viewer/SlideDir.h"
|
||||
#include "tools/viewer/SvgSlide.h"
|
||||
|
||||
#if SK_GPU_V1
|
||||
#include "src/gpu/tessellate/GrTessellationPathRenderer.h"
|
||||
#endif
|
||||
|
||||
#include <cstdlib>
|
||||
#include <map>
|
||||
|
||||
@ -1975,15 +1978,17 @@ void Viewer::drawImGui() {
|
||||
if (!ctx) {
|
||||
ImGui::RadioButton("Software", true);
|
||||
} else {
|
||||
const auto* caps = ctx->priv().caps();
|
||||
prButton(GpuPathRenderers::kDefault);
|
||||
if (fWindow->sampleCount() > 1 || FLAGS_dmsaa) {
|
||||
if (GrAtlasPathRenderer::IsSupported(ctx)) {
|
||||
prButton(GpuPathRenderers::kAtlas);
|
||||
}
|
||||
#if SK_GPU_V1
|
||||
const auto* caps = ctx->priv().caps();
|
||||
if (GrTessellationPathRenderer::IsSupported(*caps)) {
|
||||
prButton(GpuPathRenderers::kTessellation);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
if (1 == fWindow->sampleCount()) {
|
||||
prButton(GpuPathRenderers::kSmall);
|
||||
@ -2814,17 +2819,19 @@ void Viewer::updateUIState() {
|
||||
if (!ctx) {
|
||||
writer.appendString("Software");
|
||||
} else {
|
||||
const auto* caps = ctx->priv().caps();
|
||||
writer.appendString(gPathRendererNames[GpuPathRenderers::kDefault].c_str());
|
||||
if (fWindow->sampleCount() > 1 || FLAGS_dmsaa) {
|
||||
if (GrAtlasPathRenderer::IsSupported(ctx)) {
|
||||
writer.appendString(
|
||||
gPathRendererNames[GpuPathRenderers::kAtlas].c_str());
|
||||
}
|
||||
#if SK_GPU_V1
|
||||
const auto* caps = ctx->priv().caps();
|
||||
if (GrTessellationPathRenderer::IsSupported(*caps)) {
|
||||
writer.appendString(
|
||||
gPathRendererNames[GpuPathRenderers::kTessellation].c_str());
|
||||
}
|
||||
#endif
|
||||
}
|
||||
if (1 == fWindow->sampleCount()) {
|
||||
writer.appendString(gPathRendererNames[GpuPathRenderers::kSmall].c_str());
|
||||
|
Loading…
Reference in New Issue
Block a user