diff options
Diffstat (limited to 'src/gpu')
-rw-r--r-- | src/gpu/GrFragmentProcessor.cpp | 3 | ||||
-rw-r--r-- | src/gpu/GrPipeline.cpp | 3 | ||||
-rw-r--r-- | src/gpu/GrPipeline.h | 6 | ||||
-rw-r--r-- | src/gpu/GrPipelineBuilder.cpp | 2 | ||||
-rw-r--r-- | src/gpu/GrPipelineBuilder.h | 10 | ||||
-rw-r--r-- | src/gpu/GrPrimitiveProcessor.h | 4 | ||||
-rw-r--r-- | src/gpu/glsl/GrGLSLFragmentProcessor.cpp | 3 | ||||
-rw-r--r-- | src/gpu/glsl/GrGLSLFragmentProcessor.h | 7 | ||||
-rw-r--r-- | src/gpu/glsl/GrGLSLFragmentShaderBuilder.cpp | 4 | ||||
-rw-r--r-- | src/gpu/glsl/GrGLSLFragmentShaderBuilder.h | 6 | ||||
-rw-r--r-- | src/gpu/glsl/GrGLSLPrimitiveProcessor.h | 4 | ||||
-rw-r--r-- | src/gpu/glsl/GrGLSLProgramBuilder.cpp | 12 |
12 files changed, 7 insertions, 57 deletions
diff --git a/src/gpu/GrFragmentProcessor.cpp b/src/gpu/GrFragmentProcessor.cpp index a8a4898e78..fdba610356 100644 --- a/src/gpu/GrFragmentProcessor.cpp +++ b/src/gpu/GrFragmentProcessor.cpp @@ -106,9 +106,6 @@ int GrFragmentProcessor::registerChildProcessor(sk_sp<GrFragmentProcessor> child if (child->usesLocalCoords()) { fUsesLocalCoords = true; } - if (child->usesDistanceVectorField()) { - fUsesDistanceVectorField = true; - } int index = fChildProcessors.count(); fChildProcessors.push_back(child.release()); diff --git a/src/gpu/GrPipeline.cpp b/src/gpu/GrPipeline.cpp index c60a94be7e..7767bf220d 100644 --- a/src/gpu/GrPipeline.cpp +++ b/src/gpu/GrPipeline.cpp @@ -48,9 +48,6 @@ GrPipeline* GrPipeline::CreateAt(void* memory, const CreateArgs& args, if (builder.getAllowSRGBInputs()) { pipeline->fFlags |= kAllowSRGBInputs_Flag; } - if (builder.getUsesDistanceVectorField()) { - pipeline->fFlags |= kUsesDistanceVectorField_Flag; - } if (args.fHasStencilClip) { pipeline->fFlags |= kHasStencilClip_Flag; } diff --git a/src/gpu/GrPipeline.h b/src/gpu/GrPipeline.h index 1457dbc3f5..5ec572d0ae 100644 --- a/src/gpu/GrPipeline.h +++ b/src/gpu/GrPipeline.h @@ -160,9 +160,6 @@ public: bool getAllowSRGBInputs() const { return SkToBool(fFlags & kAllowSRGBInputs_Flag); } - bool usesDistanceVectorField() const { - return SkToBool(fFlags & kUsesDistanceVectorField_Flag); - } bool hasStencilClip() const { return SkToBool(fFlags & kHasStencilClip_Flag); } @@ -209,8 +206,7 @@ private: kSnapVertices_Flag = 0x2, kDisableOutputConversionToSRGB_Flag = 0x4, kAllowSRGBInputs_Flag = 0x8, - kUsesDistanceVectorField_Flag = 0x10, - kHasStencilClip_Flag = 0x20, + kHasStencilClip_Flag = 0x10 }; typedef GrPendingIOResource<GrRenderTarget, kWrite_GrIOType> RenderTarget; diff --git a/src/gpu/GrPipelineBuilder.cpp b/src/gpu/GrPipelineBuilder.cpp index 864d6f1bc6..60cbc62cf2 100644 --- a/src/gpu/GrPipelineBuilder.cpp +++ b/src/gpu/GrPipelineBuilder.cpp @@ -41,8 +41,6 @@ GrPipelineBuilder::GrPipelineBuilder(const GrPaint& paint, bool useHWAA) paint.getDisableOutputConversionToSRGB()); this->setState(GrPipelineBuilder::kAllowSRGBInputs_Flag, paint.getAllowSRGBInputs()); - this->setState(GrPipelineBuilder::kUsesDistanceVectorField_Flag, - paint.usesDistanceVectorField()); } //////////////////////////////////////////////////////////////////////////////s diff --git a/src/gpu/GrPipelineBuilder.h b/src/gpu/GrPipelineBuilder.h index 0c33eb344f..dca7f36034 100644 --- a/src/gpu/GrPipelineBuilder.h +++ b/src/gpu/GrPipelineBuilder.h @@ -221,13 +221,7 @@ public: */ kAllowSRGBInputs_Flag = 0x08, - /** - * Signals that one or more FPs need access to the distance vector field to the nearest - * edge - */ - kUsesDistanceVectorField_Flag = 0x10, - - kLast_Flag = kUsesDistanceVectorField_Flag, + kLast_Flag = kAllowSRGBInputs_Flag, }; bool isHWAntialias() const { return SkToBool(fFlags & kHWAntialias_Flag); } @@ -237,8 +231,6 @@ public: return SkToBool(fFlags & kDisableOutputConversionToSRGB_Flag); } bool getAllowSRGBInputs() const { return SkToBool(fFlags & kAllowSRGBInputs_Flag); } - bool getUsesDistanceVectorField() const { - return SkToBool(fFlags & kUsesDistanceVectorField_Flag); } /** * Enable render state settings. diff --git a/src/gpu/GrPrimitiveProcessor.h b/src/gpu/GrPrimitiveProcessor.h index d27a6f31c7..0d5280fbd3 100644 --- a/src/gpu/GrPrimitiveProcessor.h +++ b/src/gpu/GrPrimitiveProcessor.h @@ -221,10 +221,6 @@ public: return 0.0; } - /* Sub-class should override and return true if this primitive processor implements the distance - * vector field, a field of vectors to the nearest point in the edge of the shape. */ - virtual bool implementsDistanceVector() const { return false; } - protected: GrPrimitiveProcessor() : fVertexStride(0) {} diff --git a/src/gpu/glsl/GrGLSLFragmentProcessor.cpp b/src/gpu/glsl/GrGLSLFragmentProcessor.cpp index 46945bdc6b..9533d5a8cb 100644 --- a/src/gpu/glsl/GrGLSLFragmentProcessor.cpp +++ b/src/gpu/glsl/GrGLSLFragmentProcessor.cpp @@ -107,8 +107,7 @@ void GrGLSLFragmentProcessor::internalEmitChild(int childIndex, const char* inpu inputColor, childCoords, childTexSamplers, - childBufferSamplers, - args.fGpImplementsDistanceVector); + childBufferSamplers); this->childProcessor(childIndex)->emitCode(childArgs); fragBuilder->codeAppend("}\n"); diff --git a/src/gpu/glsl/GrGLSLFragmentProcessor.h b/src/gpu/glsl/GrGLSLFragmentProcessor.h index c6eb016a32..43614f2279 100644 --- a/src/gpu/glsl/GrGLSLFragmentProcessor.h +++ b/src/gpu/glsl/GrGLSLFragmentProcessor.h @@ -61,8 +61,7 @@ public: const char* inputColor, const GrGLSLTransformedCoordsArray& coords, const SamplerHandle* texSamplers, - const SamplerHandle* bufferSamplers, - bool gpImplementsDistanceVector) + const SamplerHandle* bufferSamplers) : fFragBuilder(fragBuilder) , fUniformHandler(uniformHandler) , fGLSLCaps(caps) @@ -71,8 +70,7 @@ public: , fInputColor(inputColor) , fCoords(coords) , fTexSamplers(texSamplers) - , fBufferSamplers(bufferSamplers) - , fGpImplementsDistanceVector(gpImplementsDistanceVector){} + , fBufferSamplers(bufferSamplers) {} GrGLSLFPFragmentBuilder* fFragBuilder; GrGLSLUniformHandler* fUniformHandler; const GrGLSLCaps* fGLSLCaps; @@ -82,7 +80,6 @@ public: const GrGLSLTransformedCoordsArray& fCoords; const SamplerHandle* fTexSamplers; const SamplerHandle* fBufferSamplers; - bool fGpImplementsDistanceVector; }; virtual void emitCode(EmitArgs&) = 0; diff --git a/src/gpu/glsl/GrGLSLFragmentShaderBuilder.cpp b/src/gpu/glsl/GrGLSLFragmentShaderBuilder.cpp index e6ecf8c171..5d1ba511b7 100644 --- a/src/gpu/glsl/GrGLSLFragmentShaderBuilder.cpp +++ b/src/gpu/glsl/GrGLSLFragmentShaderBuilder.cpp @@ -189,10 +189,6 @@ const char* GrGLSLFragmentShaderBuilder::fragmentPosition() { } } -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 6845376261..614b04f54b 100644 --- a/src/gpu/glsl/GrGLSLFragmentShaderBuilder.h +++ b/src/gpu/glsl/GrGLSLFragmentShaderBuilder.h @@ -96,10 +96,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; - /** * Fragment procs with child procs should call these functions before/after calling emitCode * on a child proc. @@ -170,7 +166,6 @@ public: virtual SkString ensureFSCoords2D(const GrGLSLTransformedCoordsArray& coords, int index) override; const char* fragmentPosition() override; - const char* distanceVectorName() const override; // GrGLSLFPFragmentBuilder interface. void appendOffsetToSample(const char* sampleIdx, Coordinates) override; @@ -240,7 +235,6 @@ private: bool fHasSecondaryOutput; uint8_t fUsedSampleOffsetArrays; bool fHasInitializedSampleMask; - SkString fDistanceVectorOutput; #ifdef SK_DEBUG // some state to verify shaders and effects are consistent, this is reset between effects by diff --git a/src/gpu/glsl/GrGLSLPrimitiveProcessor.h b/src/gpu/glsl/GrGLSLPrimitiveProcessor.h index a94099656b..d726027686 100644 --- a/src/gpu/glsl/GrGLSLPrimitiveProcessor.h +++ b/src/gpu/glsl/GrGLSLPrimitiveProcessor.h @@ -42,7 +42,6 @@ public: const GrPrimitiveProcessor& gp, const char* outputColor, const char* outputCoverage, - const char* distanceVectorName, const SamplerHandle* texSamplers, const SamplerHandle* bufferSamplers, const TransformsIn& transformsIn, @@ -55,7 +54,6 @@ public: , fGP(gp) , fOutputColor(outputColor) , fOutputCoverage(outputCoverage) - , fDistanceVectorName(distanceVectorName) , fTexSamplers(texSamplers) , fBufferSamplers(bufferSamplers) , fTransformsIn(transformsIn) @@ -68,7 +66,6 @@ public: const GrPrimitiveProcessor& fGP; const char* fOutputColor; const char* fOutputCoverage; - const char* fDistanceVectorName; const SamplerHandle* fTexSamplers; const SamplerHandle* fBufferSamplers; const TransformsIn& fTransformsIn; @@ -81,6 +78,7 @@ public: */ virtual void emitCode(EmitArgs&) = 0; + /** A GrGLSLPrimitiveProcessor instance can be reused with any GrGLSLPrimitiveProcessor that produces the same stage key; this function reads data from a GrGLSLPrimitiveProcessor and uploads any uniform variables required by the shaders created in emitCode(). The diff --git a/src/gpu/glsl/GrGLSLProgramBuilder.cpp b/src/gpu/glsl/GrGLSLProgramBuilder.cpp index 1f28f19bb9..64bc0640b9 100644 --- a/src/gpu/glsl/GrGLSLProgramBuilder.cpp +++ b/src/gpu/glsl/GrGLSLProgramBuilder.cpp @@ -87,13 +87,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()) { - distanceVectorName = fFS.distanceVectorName(); - fFS.codeAppend( "// Un-normalized vector to the closed geometric edge (in source space)\n"); - fFS.codeAppendf("vec2 %s;", distanceVectorName); - } - // Enclose custom code in a block to avoid namespace conflicts SkString openBrace; openBrace.printf("{ // Stage %d, %s\n", fStageIndex, proc.name()); @@ -115,7 +108,6 @@ void GrGLSLProgramBuilder::emitAndInstallPrimProc(const GrPrimitiveProcessor& pr proc, outputColor->c_str(), outputCoverage->c_str(), - distanceVectorName, texSamplers.begin(), bufferSamplers.begin(), fCoordTransforms, @@ -169,9 +161,7 @@ void GrGLSLProgramBuilder::emitAndInstallFragProc(const GrFragmentProcessor& fp, input.isOnes() ? nullptr : input.c_str(), fOutCoords[index], texSamplers.begin(), - bufferSamplers.begin(), - this->primitiveProcessor().implementsDistanceVector()); - + bufferSamplers.begin()); fragProc->emitCode(args); // We have to check that effects and the code they emit are consistent, ie if an effect |