aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/gl
diff options
context:
space:
mode:
authorGravatar Ben Wagner <bungeman@google.com>2018-03-29 11:46:24 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-03-29 17:18:05 +0000
commit3746ac21df90e44ed1ed9ec2f1e4694fbcd1d840 (patch)
treede1fff31711fa4c41e849d0281c8a2c5b400db88 /src/gpu/gl
parentc3bc425bd4d630f4c6b69f38473fc69b77a1d5b9 (diff)
Remove path ranges from gpu.
These appear to have been added to handle glyph paths with nvpr and no longer appear to be used. Change-Id: Id75e2e85ab837a5808e7641873d217c844cd827c Reviewed-on: https://skia-review.googlesource.com/117103 Reviewed-by: Chris Dalton <csmartdalton@google.com> Commit-Queue: Ben Wagner <bungeman@google.com>
Diffstat (limited to 'src/gpu/gl')
-rw-r--r--src/gpu/gl/GrGLPathRange.cpp110
-rw-r--r--src/gpu/gl/GrGLPathRange.h66
-rw-r--r--src/gpu/gl/GrGLPathRendering.cpp72
-rw-r--r--src/gpu/gl/GrGLPathRendering.h11
4 files changed, 0 insertions, 259 deletions
diff --git a/src/gpu/gl/GrGLPathRange.cpp b/src/gpu/gl/GrGLPathRange.cpp
deleted file mode 100644
index da1e9fe709..0000000000
--- a/src/gpu/gl/GrGLPathRange.cpp
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * Copyright 2014 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "GrGLPathRange.h"
-#include "GrGLPath.h"
-#include "GrGLPathRendering.h"
-#include "GrGLGpu.h"
-
-GrGLPathRange::GrGLPathRange(GrGLGpu* gpu, PathGenerator* pathGenerator, const GrStyle& style)
- : INHERITED(gpu, pathGenerator),
- fStyle(style),
- fBasePathID(gpu->glPathRendering()->genPaths(this->getNumPaths())),
- fGpuMemorySize(0) {
- this->init();
- this->registerWithCache(SkBudgeted::kYes);
-}
-
-GrGLPathRange::GrGLPathRange(GrGLGpu* gpu,
- GrGLuint basePathID,
- int numPaths,
- size_t gpuMemorySize,
- const GrStyle& style)
- : INHERITED(gpu, numPaths),
- fStyle(style),
- fBasePathID(basePathID),
- fGpuMemorySize(gpuMemorySize) {
- this->init();
- this->registerWithCache(SkBudgeted::kYes);
-}
-
-void GrGLPathRange::init() {
- const SkStrokeRec& stroke = fStyle.strokeRec();
- // Must force fill:
- // * dashing: NVPR stroke dashing is different to Skia.
- // * end caps: NVPR stroking degenerate contours with end caps is different to Skia.
- bool forceFill = fStyle.pathEffect() ||
- (stroke.needToApply() && stroke.getCap() != SkPaint::kButt_Cap);
-
- if (forceFill) {
- fShouldStroke = false;
- fShouldFill = true;
- } else {
- fShouldStroke = stroke.needToApply();
- fShouldFill = stroke.isFillStyle() ||
- stroke.getStyle() == SkStrokeRec::kStrokeAndFill_Style;
- }
-}
-
-void GrGLPathRange::onInitPath(int index, const SkPath& origSkPath) const {
- GrGLGpu* gpu = static_cast<GrGLGpu*>(this->getGpu());
- if (nullptr == gpu) {
- return;
- }
- // Make sure the path at this index hasn't been initted already.
- SkDEBUGCODE(
- GrGLboolean isPath;
- GR_GL_CALL_RET(gpu->glInterface(), isPath, IsPath(fBasePathID + index)));
- SkASSERT(GR_GL_FALSE == isPath);
-
- if (origSkPath.isEmpty()) {
- GrGLPath::InitPathObjectEmptyPath(gpu, fBasePathID + index);
- } else if (fShouldStroke) {
- GrGLPath::InitPathObjectPathData(gpu, fBasePathID + index, origSkPath);
- GrGLPath::InitPathObjectStroke(gpu, fBasePathID + index, fStyle.strokeRec());
- } else {
- const SkPath* skPath = &origSkPath;
- SkTLazy<SkPath> tmpPath;
- if (!fStyle.isSimpleFill()) {
- SkStrokeRec::InitStyle fill;
- // The path effect must be applied to the path. However, if a path effect is present,
- // we must convert all the paths to fills. The path effect application may leave
- // simple paths as strokes but converts other paths to fills.
- // Thus we must stroke the strokes here, so that all paths in the
- // path range are using the same style.
- if (!fStyle.applyToPath(tmpPath.init(), &fill, *skPath, SK_Scalar1)) {
- return;
- }
- // We shouldn't have allowed hairlines or arbitrary path effect styles to get here
- // so after application we better have a filled path.
- SkASSERT(SkStrokeRec::kFill_InitStyle == fill);
- skPath = tmpPath.get();
-
- }
- GrGLPath::InitPathObjectPathData(gpu, fBasePathID + index, *skPath);
- }
- // TODO: Use a better approximation for the individual path sizes.
- fGpuMemorySize += 100;
-}
-
-void GrGLPathRange::onRelease() {
- SkASSERT(this->getGpu());
-
- if (0 != fBasePathID) {
- static_cast<GrGLGpu*>(this->getGpu())->glPathRendering()->deletePaths(fBasePathID,
- this->getNumPaths());
- fBasePathID = 0;
- }
-
- INHERITED::onRelease();
-}
-
-void GrGLPathRange::onAbandon() {
- fBasePathID = 0;
-
- INHERITED::onAbandon();
-}
diff --git a/src/gpu/gl/GrGLPathRange.h b/src/gpu/gl/GrGLPathRange.h
deleted file mode 100644
index 7d920105a0..0000000000
--- a/src/gpu/gl/GrGLPathRange.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Copyright 2014 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#ifndef GrGLPathRange_DEFINED
-#define GrGLPathRange_DEFINED
-
-#include "../GrPathRange.h"
-#include "GrStyle.h"
-#include "gl/GrGLTypes.h"
-
-class GrGLGpu;
-
-/**
- * Currently this represents a range of GL_NV_path_rendering Path IDs. If we
- * support other GL path extensions then this would have to have a type enum
- * and/or be subclassed.
- */
-
-class GrGLPathRange : public GrPathRange {
-public:
- /**
- * Initialize a GL path range from a PathGenerator. This class will allocate
- * the GPU path objects and initialize them lazily.
- */
- GrGLPathRange(GrGLGpu*, PathGenerator*, const GrStyle&);
-
- /**
- * Initialize a GL path range from an existing range of pre-initialized GPU
- * path objects. This class assumes ownership of the GPU path objects and
- * will delete them when done.
- */
- GrGLPathRange(GrGLGpu*,
- GrGLuint basePathID,
- int numPaths,
- size_t gpuMemorySize,
- const GrStyle&);
-
- GrGLuint basePathID() const { return fBasePathID; }
-
- bool shouldStroke() const { return fShouldStroke; }
- bool shouldFill() const { return fShouldFill; }
-
-protected:
- void onInitPath(int index, const SkPath&) const override;
-
- void onRelease() override;
- void onAbandon() override;
-
-private:
- void init();
- size_t onGpuMemorySize() const override { return fGpuMemorySize; }
-
- const GrStyle fStyle;
- GrGLuint fBasePathID;
- mutable size_t fGpuMemorySize;
- bool fShouldStroke;
- bool fShouldFill;
-
- typedef GrPathRange INHERITED;
-};
-
-#endif
diff --git a/src/gpu/gl/GrGLPathRendering.cpp b/src/gpu/gl/GrGLPathRendering.cpp
index 8ff9da0d33..45bc018487 100644
--- a/src/gpu/gl/GrGLPathRendering.cpp
+++ b/src/gpu/gl/GrGLPathRendering.cpp
@@ -10,7 +10,6 @@
#include "gl/GrGLGpu.h"
#include "GrGLPath.h"
-#include "GrGLPathRange.h"
#include "GrGLPathRendering.h"
#include "SkStream.h"
@@ -23,25 +22,6 @@
// implementation. The call has a result value, and thus waiting for the call completion is needed.
static const GrGLsizei kPathIDPreallocationAmount = 65536;
-static const GrGLenum gIndexType2GLType[] = {
- GR_GL_UNSIGNED_BYTE,
- GR_GL_UNSIGNED_SHORT,
- GR_GL_UNSIGNED_INT
-};
-
-GR_STATIC_ASSERT(0 == GrPathRange::kU8_PathIndexType);
-GR_STATIC_ASSERT(1 == GrPathRange::kU16_PathIndexType);
-GR_STATIC_ASSERT(2 == GrPathRange::kU32_PathIndexType);
-GR_STATIC_ASSERT(GrPathRange::kU32_PathIndexType == GrPathRange::kLast_PathIndexType);
-
-static const GrGLenum gXformType2GLType[] = {
- GR_GL_NONE,
- GR_GL_TRANSLATE_X,
- GR_GL_TRANSLATE_Y,
- GR_GL_TRANSLATE_2D,
- GR_GL_TRANSPOSE_AFFINE_2D
-};
-
GR_STATIC_ASSERT(0 == GrPathRendering::kNone_PathTransformType);
GR_STATIC_ASSERT(1 == GrPathRendering::kTranslateX_PathTransformType);
GR_STATIC_ASSERT(2 == GrPathRendering::kTranslateY_PathTransformType);
@@ -50,13 +30,6 @@ GR_STATIC_ASSERT(4 == GrPathRendering::kAffine_PathTransformType);
GR_STATIC_ASSERT(GrPathRendering::kAffine_PathTransformType == GrPathRendering::kLast_PathTransformType);
#ifdef SK_DEBUG
-static const GrGLenum gXformType2ComponentCount[] = {
- 0,
- 1,
- 1,
- 2,
- 6
-};
static void verify_floats(const float* floats, int count) {
for (int i = 0; i < count; ++i) {
@@ -109,11 +82,6 @@ sk_sp<GrPath> GrGLPathRendering::createPath(const SkPath& inPath, const GrStyle&
return sk_make_sp<GrGLPath>(this->gpu(), inPath, style);
}
-sk_sp<GrPathRange> GrGLPathRendering::createPathRange(GrPathRange::PathGenerator* pathGenerator,
- const GrStyle& style) {
- return sk_make_sp<GrGLPathRange>(this->gpu(), pathGenerator, style);
-}
-
void GrGLPathRendering::onStencilPath(const StencilPathArgs& args, const GrPath* path) {
GrGLGpu* gpu = this->gpu();
SkASSERT(gpu->caps()->shaderCaps()->pathRenderingSupport());
@@ -171,46 +139,6 @@ void GrGLPathRendering::onDrawPath(const GrPipeline& pipeline,
}
}
-void GrGLPathRendering::onDrawPaths(const GrPipeline& pipeline,
- const GrPrimitiveProcessor& primProc,
- const GrStencilSettings& stencilPassSettings,
- const GrPathRange* pathRange, const void* indices,
- PathIndexType indexType, const float transformValues[],
- PathTransformType transformType, int count) {
- SkDEBUGCODE(verify_floats(transformValues, gXformType2ComponentCount[transformType] * count));
-
- if (!this->gpu()->flushGLState(pipeline, primProc, false)) {
- return;
- }
- this->flushPathStencilSettings(stencilPassSettings);
- SkASSERT(!fHWPathStencilSettings.isTwoSided());
-
-
- const GrGLPathRange* glPathRange = static_cast<const GrGLPathRange*>(pathRange);
-
- GrGLenum fillMode =
- gr_stencil_op_to_gl_path_rendering_fill_mode(fHWPathStencilSettings.front().fPassOp);
- GrGLint writeMask = fHWPathStencilSettings.front().fWriteMask;
-
- if (glPathRange->shouldStroke()) {
- if (glPathRange->shouldFill()) {
- GL_CALL(StencilFillPathInstanced(
- count, gIndexType2GLType[indexType], indices, glPathRange->basePathID(),
- fillMode, writeMask, gXformType2GLType[transformType],
- transformValues));
- }
- GL_CALL(StencilThenCoverStrokePathInstanced(
- count, gIndexType2GLType[indexType], indices, glPathRange->basePathID(),
- 0xffff, writeMask, GR_GL_BOUNDING_BOX_OF_BOUNDING_BOXES,
- gXformType2GLType[transformType], transformValues));
- } else {
- GL_CALL(StencilThenCoverFillPathInstanced(
- count, gIndexType2GLType[indexType], indices, glPathRange->basePathID(),
- fillMode, writeMask, GR_GL_BOUNDING_BOX_OF_BOUNDING_BOXES,
- gXformType2GLType[transformType], transformValues));
- }
-}
-
void GrGLPathRendering::setProgramPathFragmentInputTransform(GrGLuint program, GrGLint location,
GrGLenum genMode, GrGLint components,
const SkMatrix& matrix) {
diff --git a/src/gpu/gl/GrGLPathRendering.h b/src/gpu/gl/GrGLPathRendering.h
index 5b03435d7c..0c1d19286b 100644
--- a/src/gpu/gl/GrGLPathRendering.h
+++ b/src/gpu/gl/GrGLPathRendering.h
@@ -36,8 +36,6 @@ public:
// GrPathRendering implementations.
sk_sp<GrPath> createPath(const SkPath&, const GrStyle&) override;
- virtual sk_sp<GrPathRange> createPathRange(GrPathRange::PathGenerator*,
- const GrStyle&) override;
/* Called when the 3D context state is unknown. */
void resetContext();
@@ -71,15 +69,6 @@ protected:
const GrPrimitiveProcessor&,
const GrStencilSettings&,
const GrPath*) override;
- void onDrawPaths(const GrPipeline&,
- const GrPrimitiveProcessor&,
- const GrStencilSettings&,
- const GrPathRange*,
- const void* indices,
- PathIndexType,
- const float transformValues[],
- PathTransformType,
- int count) override;
private:
/**
* Mark certain functionality as not supported.