aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/glsl
diff options
context:
space:
mode:
authorGravatar Brian Salomon <bsalomon@google.com>2017-06-02 11:01:10 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-06-02 19:44:18 +0000
commite23bffd65b379aeeb6bb614de81369c130623e92 (patch)
tree7ed966359438344027ffd20d58b5afdb4bb5b3fe /src/gpu/glsl
parent219b4e81db683d943da0261438bfdc6139d8f061 (diff)
Remove support in GPU backend for distance vector field.
Also, remvoes SkNormalBevelSource as this was the last use case for the distance vector field. Change-Id: Ib0176c78e500e6b5130310934253a75860245812 Reviewed-on: https://skia-review.googlesource.com/18482 Reviewed-by: Greg Daniel <egdaniel@google.com> Commit-Queue: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'src/gpu/glsl')
-rw-r--r--src/gpu/glsl/GrGLSLFragmentProcessor.cpp3
-rw-r--r--src/gpu/glsl/GrGLSLFragmentProcessor.h28
-rw-r--r--src/gpu/glsl/GrGLSLFragmentShaderBuilder.cpp4
-rw-r--r--src/gpu/glsl/GrGLSLFragmentShaderBuilder.h6
-rw-r--r--src/gpu/glsl/GrGLSLPrimitiveProcessor.h3
-rw-r--r--src/gpu/glsl/GrGLSLProgramBuilder.cpp15
6 files changed, 13 insertions, 46 deletions
diff --git a/src/gpu/glsl/GrGLSLFragmentProcessor.cpp b/src/gpu/glsl/GrGLSLFragmentProcessor.cpp
index 28e5a211a8..006fe587f7 100644
--- a/src/gpu/glsl/GrGLSLFragmentProcessor.cpp
+++ b/src/gpu/glsl/GrGLSLFragmentProcessor.cpp
@@ -59,8 +59,7 @@ void GrGLSLFragmentProcessor::internalEmitChild(int childIndex, const char* inpu
coordVars,
textureSamplers,
texelBuffers,
- imageStorages,
- args.fGpImplementsDistanceVector);
+ imageStorages);
this->childProcessor(childIndex)->emitCode(childArgs);
fragBuilder->codeAppend("}\n");
diff --git a/src/gpu/glsl/GrGLSLFragmentProcessor.h b/src/gpu/glsl/GrGLSLFragmentProcessor.h
index fe7775a9c4..355d490225 100644
--- a/src/gpu/glsl/GrGLSLFragmentProcessor.h
+++ b/src/gpu/glsl/GrGLSLFragmentProcessor.h
@@ -105,9 +105,6 @@ public:
@param imageStorages Contains one entry for each ImageStorageAccess of the GrProcessor.
These can be passed to the builder to emit image loads and stores
in the generated code.
- @param gpImplementsDistanceVector
- Does the GrGeometryProcessor implement the feature where it
- provides a vector to the nearest edge of the shape being rendered.
*/
struct EmitArgs {
EmitArgs(GrGLSLFPFragmentBuilder* fragBuilder,
@@ -119,19 +116,17 @@ public:
const TransformedCoordVars& transformedCoordVars,
const TextureSamplers& textureSamplers,
const TexelBuffers& texelBuffers,
- const ImageStorages& imageStorages,
- bool gpImplementsDistanceVector)
- : fFragBuilder(fragBuilder)
- , fUniformHandler(uniformHandler)
- , fShaderCaps(caps)
- , fFp(fp)
- , fOutputColor(outputColor)
- , fInputColor(inputColor)
- , fTransformedCoords(transformedCoordVars)
- , fTexSamplers(textureSamplers)
- , fTexelBuffers(texelBuffers)
- , fImageStorages(imageStorages)
- , fGpImplementsDistanceVector(gpImplementsDistanceVector) {}
+ const ImageStorages& imageStorages)
+ : fFragBuilder(fragBuilder)
+ , fUniformHandler(uniformHandler)
+ , fShaderCaps(caps)
+ , fFp(fp)
+ , fOutputColor(outputColor)
+ , fInputColor(inputColor)
+ , fTransformedCoords(transformedCoordVars)
+ , fTexSamplers(textureSamplers)
+ , fTexelBuffers(texelBuffers)
+ , fImageStorages(imageStorages) {}
GrGLSLFPFragmentBuilder* fFragBuilder;
GrGLSLUniformHandler* fUniformHandler;
const GrShaderCaps* fShaderCaps;
@@ -142,7 +137,6 @@ public:
const TextureSamplers& fTexSamplers;
const TexelBuffers& fTexelBuffers;
const ImageStorages& fImageStorages;
- bool fGpImplementsDistanceVector;
};
virtual void emitCode(EmitArgs&) = 0;
diff --git a/src/gpu/glsl/GrGLSLFragmentShaderBuilder.cpp b/src/gpu/glsl/GrGLSLFragmentShaderBuilder.cpp
index 484bd78211..4fd886b4fb 100644
--- a/src/gpu/glsl/GrGLSLFragmentShaderBuilder.cpp
+++ b/src/gpu/glsl/GrGLSLFragmentShaderBuilder.cpp
@@ -124,10 +124,6 @@ SkString GrGLSLFragmentShaderBuilder::ensureCoords2D(const GrShaderVar& coords)
return coords2D;
}
-const char* GrGLSLFragmentShaderBuilder::distanceVectorName() const {
- return "fsDistanceVector";
-}
-
void GrGLSLFragmentShaderBuilder::appendOffsetToSample(const char* sampleIdx, Coordinates coords) {
SkASSERT(fProgramBuilder->header().fSamplePatternKey);
SkDEBUGCODE(fUsedProcessorFeatures |= GrProcessor::kSampleLocations_RequiredFeature);
diff --git a/src/gpu/glsl/GrGLSLFragmentShaderBuilder.h b/src/gpu/glsl/GrGLSLFragmentShaderBuilder.h
index 65bcb8dae6..73fe51f171 100644
--- a/src/gpu/glsl/GrGLSLFragmentShaderBuilder.h
+++ b/src/gpu/glsl/GrGLSLFragmentShaderBuilder.h
@@ -89,10 +89,6 @@ public:
*/
virtual void maskSampleCoverage(const char* mask, bool invert = false) = 0;
- /** Returns a variable name that represents a vector to the nearest edge of the shape, in source
- space coordinates. */
- virtual const char* distanceVectorName() const = 0;
-
/**
* Overrides the default precision for the entire fragment program. Processors that require
* high precision input (eg from incoming texture samples) may use this. For calculations that
@@ -168,7 +164,6 @@ public:
// Shared GrGLSLFragmentBuilder interface.
bool enableFeature(GLSLFeature) override;
virtual SkString ensureCoords2D(const GrShaderVar&) override;
- const char* distanceVectorName() const override;
// GrGLSLFPFragmentBuilder interface.
void appendOffsetToSample(const char* sampleIdx, Coordinates) override;
@@ -239,7 +234,6 @@ private:
bool fHasSecondaryOutput;
uint8_t fUsedSampleOffsetArrays;
bool fHasInitializedSampleMask;
- SkString fDistanceVectorOutput;
GrSLPrecision fDefaultPrecision;
#ifdef SK_DEBUG
diff --git a/src/gpu/glsl/GrGLSLPrimitiveProcessor.h b/src/gpu/glsl/GrGLSLPrimitiveProcessor.h
index 2443f4745e..c4f3115f5a 100644
--- a/src/gpu/glsl/GrGLSLPrimitiveProcessor.h
+++ b/src/gpu/glsl/GrGLSLPrimitiveProcessor.h
@@ -75,7 +75,6 @@ public:
const GrPrimitiveProcessor& gp,
const char* outputColor,
const char* outputCoverage,
- const char* distanceVectorName,
const char* rtAdjustName,
const SamplerHandle* texSamplers,
const TexelBufferHandle* texelBuffers,
@@ -90,7 +89,6 @@ public:
, fGP(gp)
, fOutputColor(outputColor)
, fOutputCoverage(outputCoverage)
- , fDistanceVectorName(distanceVectorName)
, fRTAdjustName(rtAdjustName)
, fTexSamplers(texSamplers)
, fTexelBuffers(texelBuffers)
@@ -105,7 +103,6 @@ public:
const GrPrimitiveProcessor& fGP;
const char* fOutputColor;
const char* fOutputCoverage;
- const char* fDistanceVectorName;
const char* fRTAdjustName;
const SamplerHandle* fTexSamplers;
const TexelBufferHandle* fTexelBuffers;
diff --git a/src/gpu/glsl/GrGLSLProgramBuilder.cpp b/src/gpu/glsl/GrGLSLProgramBuilder.cpp
index 337ee6d0ea..0d87c4f5a2 100644
--- a/src/gpu/glsl/GrGLSLProgramBuilder.cpp
+++ b/src/gpu/glsl/GrGLSLProgramBuilder.cpp
@@ -76,17 +76,6 @@ void GrGLSLProgramBuilder::emitAndInstallPrimProc(const GrPrimitiveProcessor& pr
this->nameExpression(outputColor, "outputColor");
this->nameExpression(outputCoverage, "outputCoverage");
- const char* distanceVectorName = nullptr;
- if (this->fPipeline.usesDistanceVectorField() && proc.implementsDistanceVector()) {
- // Each individual user (FP) of the distance vector must be able to handle having this
- // variable be undeclared. There is no single default value that will yield a reasonable
- // result for all users.
- distanceVectorName = fFS.distanceVectorName();
- fFS.codeAppend( "// Normalized vector to the closest geometric edge (in device space)\n");
- fFS.codeAppend( "// Distance to the edge encoded in the z-component\n");
- fFS.codeAppendf("vec4 %s;", distanceVectorName);
- }
-
SkASSERT(!fUniformHandles.fRTAdjustmentUni.isValid());
GrShaderFlags rtAdjustVisibility = kVertex_GrShaderFlag;
if (proc.willUseGeoShader()) {
@@ -124,7 +113,6 @@ void GrGLSLProgramBuilder::emitAndInstallPrimProc(const GrPrimitiveProcessor& pr
proc,
outputColor->c_str(),
outputCoverage->c_str(),
- distanceVectorName,
rtAdjustName,
texSamplers.begin(),
texelBuffers.begin(),
@@ -199,8 +187,7 @@ SkString GrGLSLProgramBuilder::emitAndInstallFragProc(const GrFragmentProcessor&
coords,
textureSamplers,
texelBuffers,
- imageStorages,
- this->primitiveProcessor().implementsDistanceVector());
+ imageStorages);
fragProc->emitCode(args);