Remove redundant before/after child proc mangling calls.
writeProcessorFunction() is already making these calls, no need for GrGLSLFragmentProcessor to also make them. Makes the names of child proc functions slightly easier to parse for humans. Also makes them and one other function private to GrGLSLFPFragmentProcessor. Devirtualizes fucntion writeProcessorFunction (no overloads) Change-Id: I47b416c7aa29f6dd2739151a586dcd4c887f997f Reviewed-on: https://skia-review.googlesource.com/c/skia/+/283944 Reviewed-by: Brian Osman <brianosman@google.com> Commit-Queue: Brian Salomon <bsalomon@google.com>
This commit is contained in:
parent
c80026c640
commit
f3178a5a60
@ -53,8 +53,6 @@ SkString GrGLSLFragmentProcessor::invokeChild(int childIndex, const char* inputC
|
||||
|
||||
// Emit the child's helper function if this is the first time we've seen a call
|
||||
if (fFunctionNames[childIndex].size() == 0) {
|
||||
fragBuilder->onBeforeChildProcEmitCode(); // call first so mangleString is updated
|
||||
|
||||
TransformedCoordVars coordVars = args.fTransformedCoords.childInputs(childIndex);
|
||||
TextureSamplers textureSamplers = args.fTexSamplers.childInputs(childIndex);
|
||||
|
||||
@ -68,8 +66,6 @@ SkString GrGLSLFragmentProcessor::invokeChild(int childIndex, const char* inputC
|
||||
textureSamplers);
|
||||
fFunctionNames[childIndex] =
|
||||
fragBuilder->writeProcessorFunction(this->childProcessor(childIndex), childArgs);
|
||||
|
||||
fragBuilder->onAfterChildProcEmitCode();
|
||||
}
|
||||
|
||||
// Produce a string containing the call to the helper function
|
||||
@ -94,8 +90,6 @@ SkString GrGLSLFragmentProcessor::invokeChildWithMatrix(int childIndex, const ch
|
||||
|
||||
// Emit the child's helper function if this is the first time we've seen a call
|
||||
if (fFunctionNames[childIndex].size() == 0) {
|
||||
fragBuilder->onBeforeChildProcEmitCode(); // call first so mangleString is updated
|
||||
|
||||
TransformedCoordVars coordVars = args.fTransformedCoords.childInputs(childIndex);
|
||||
TextureSamplers textureSamplers = args.fTexSamplers.childInputs(childIndex);
|
||||
|
||||
@ -109,8 +103,6 @@ SkString GrGLSLFragmentProcessor::invokeChildWithMatrix(int childIndex, const ch
|
||||
textureSamplers);
|
||||
fFunctionNames[childIndex] =
|
||||
fragBuilder->writeProcessorFunction(this->childProcessor(childIndex), childArgs);
|
||||
|
||||
fragBuilder->onAfterChildProcEmitCode();
|
||||
}
|
||||
|
||||
// Produce a string containing the call to the helper function
|
||||
|
@ -94,21 +94,19 @@ public:
|
||||
*/
|
||||
virtual void applyFnToMultisampleMask(const char* fn, const char* grad, ScopeFlags) = 0;
|
||||
|
||||
/**
|
||||
* Fragment procs with child procs should call these functions before/after calling emitCode
|
||||
* on a child proc.
|
||||
*/
|
||||
virtual void onBeforeChildProcEmitCode() = 0;
|
||||
virtual void onAfterChildProcEmitCode() = 0;
|
||||
|
||||
virtual SkString writeProcessorFunction(GrGLSLFragmentProcessor* fp,
|
||||
GrGLSLFragmentProcessor::EmitArgs& args);
|
||||
|
||||
virtual const SkString& getMangleString() const = 0;
|
||||
SkString writeProcessorFunction(GrGLSLFragmentProcessor*, GrGLSLFragmentProcessor::EmitArgs&);
|
||||
|
||||
virtual void forceHighPrecision() = 0;
|
||||
|
||||
private:
|
||||
/**
|
||||
* These are called before/after calling emitCode on a child proc to update mangling.
|
||||
*/
|
||||
virtual void onBeforeChildProcEmitCode() = 0;
|
||||
virtual void onAfterChildProcEmitCode() = 0;
|
||||
|
||||
virtual const SkString& getMangleString() const = 0;
|
||||
|
||||
// WARNING: LIke GrRenderTargetProxy, changes to this can cause issues in ASAN. This is caused
|
||||
// by GrGLSLProgramBuilder's GrTAllocators requiring 16 byte alignment, but since
|
||||
// GrGLSLFragmentShaderBuilder has a virtual diamond hierarchy, ASAN requires all this pointers
|
||||
@ -160,9 +158,6 @@ public:
|
||||
const char* sampleOffsets() override;
|
||||
void maskOffMultisampleCoverage(const char* mask, ScopeFlags) override;
|
||||
void applyFnToMultisampleMask(const char* fn, const char* grad, ScopeFlags) override;
|
||||
const SkString& getMangleString() const override { return fMangleString; }
|
||||
void onBeforeChildProcEmitCode() override;
|
||||
void onAfterChildProcEmitCode() override;
|
||||
void forceHighPrecision() override { fForceHighPrecision = true; }
|
||||
|
||||
// GrGLSLXPFragmentBuilder interface.
|
||||
@ -174,6 +169,11 @@ public:
|
||||
private:
|
||||
using CustomFeatures = GrProcessor::CustomFeatures;
|
||||
|
||||
// GrGLSLFPFragmentBuilder private interface.
|
||||
void onBeforeChildProcEmitCode() override;
|
||||
void onAfterChildProcEmitCode() override;
|
||||
const SkString& getMangleString() const override { return fMangleString; }
|
||||
|
||||
// Private public interface, used by GrGLProgramBuilder to build a fragment shader
|
||||
void enableCustomOutput();
|
||||
void enableSecondaryOutput();
|
||||
|
Loading…
Reference in New Issue
Block a user