#include "src/gpu/ganesh/GrFragmentProcessor.h"
#include "include/core/SkBlendMode.h"
#include "include/core/SkM44.h"
#include "include/core/SkRect.h"
#include "include/core/SkScalar.h"
#include "include/core/SkTypes.h"
#include "include/effects/SkRuntimeEffect.h"
#include "include/private/base/SkPoint_impl.h"
#include "src/core/SkRuntimeEffectPriv.h"
#include "src/core/SkSLTypeShared.h"
#include "src/gpu/KeyBuilder.h"
#include "src/gpu/Swizzle.h"
#include "src/gpu/ganesh/GrProcessorAnalysis.h"
#include "src/gpu/ganesh/GrSamplerState.h"
#include "src/gpu/ganesh/GrShaderCaps.h"
#include "src/gpu/ganesh/GrShaderVar.h"
#include "src/gpu/ganesh/GrSurfaceProxyView.h"
#include "src/gpu/ganesh/effects/GrBlendFragmentProcessor.h"
#include "src/gpu/ganesh/effects/GrSkSLFP.h"
#include "src/gpu/ganesh/effects/GrTextureEffect.h"
#include "src/gpu/ganesh/glsl/GrGLSLFragmentShaderBuilder.h"
#include "src/gpu/ganesh/glsl/GrGLSLProgramBuilder.h"
#include "src/gpu/ganesh/glsl/GrGLSLUniformHandler.h"
#include <algorithm>
#include <string>
bool GrFragmentProcessor::isEqual(const GrFragmentProcessor& that) const { … }
void GrFragmentProcessor::visitProxies(const GrVisitProxyFunc& func) const { … }
void GrFragmentProcessor::visitTextureEffects(
const std::function<void(const GrTextureEffect&)>& func) const { … }
void GrFragmentProcessor::visitWithImpls(
const std::function<void(const GrFragmentProcessor&, ProgramImpl&)>& f,
ProgramImpl& impl) const { … }
GrTextureEffect* GrFragmentProcessor::asTextureEffect() { … }
const GrTextureEffect* GrFragmentProcessor::asTextureEffect() const { … }
#if defined(GPU_TEST_UTILS)
static void recursive_dump_tree_info(const GrFragmentProcessor& fp,
SkString indent,
SkString* text) {
for (int index = 0; index < fp.numChildProcessors(); ++index) {
text->appendf("\n%s(#%d) -> ", indent.c_str(), index);
if (const GrFragmentProcessor* childFP = fp.childProcessor(index)) {
text->append(childFP->dumpInfo());
indent.append("\t");
recursive_dump_tree_info(*childFP, indent, text);
} else {
text->append("null");
}
}
}
SkString GrFragmentProcessor::dumpTreeInfo() const {
SkString text = this->dumpInfo();
recursive_dump_tree_info(*this, SkString("\t"), &text);
text.append("\n");
return text;
}
#endif
std::unique_ptr<GrFragmentProcessor::ProgramImpl> GrFragmentProcessor::makeProgramImpl() const { … }
int GrFragmentProcessor::numNonNullChildProcessors() const { … }
#ifdef SK_DEBUG
bool GrFragmentProcessor::isInstantiated() const { … }
#endif
void GrFragmentProcessor::registerChild(std::unique_ptr<GrFragmentProcessor> child,
SkSL::SampleUsage sampleUsage) { … }
void GrFragmentProcessor::cloneAndRegisterAllChildProcessors(const GrFragmentProcessor& src) { … }
std::unique_ptr<GrFragmentProcessor> GrFragmentProcessor::MakeColor(SkPMColor4f color) { … }
std::unique_ptr<GrFragmentProcessor> GrFragmentProcessor::MulInputByChildAlpha(
std::unique_ptr<GrFragmentProcessor> fp) { … }
std::unique_ptr<GrFragmentProcessor> GrFragmentProcessor::ApplyPaintAlpha(
std::unique_ptr<GrFragmentProcessor> child) { … }
std::unique_ptr<GrFragmentProcessor> GrFragmentProcessor::ModulateRGBA(
std::unique_ptr<GrFragmentProcessor> inputFP, const SkPMColor4f& color) { … }
std::unique_ptr<GrFragmentProcessor> GrFragmentProcessor::ClampOutput(
std::unique_ptr<GrFragmentProcessor> fp) { … }
std::unique_ptr<GrFragmentProcessor> GrFragmentProcessor::SwizzleOutput(
std::unique_ptr<GrFragmentProcessor> fp, const skgpu::Swizzle& swizzle) { … }
std::unique_ptr<GrFragmentProcessor> GrFragmentProcessor::OverrideInput(
std::unique_ptr<GrFragmentProcessor> fp, const SkPMColor4f& color) { … }
std::unique_ptr<GrFragmentProcessor> GrFragmentProcessor::DisableCoverageAsAlpha(
std::unique_ptr<GrFragmentProcessor> fp) { … }
std::unique_ptr<GrFragmentProcessor> GrFragmentProcessor::DestColor() { … }
std::unique_ptr<GrFragmentProcessor> GrFragmentProcessor::Compose(
std::unique_ptr<GrFragmentProcessor> f, std::unique_ptr<GrFragmentProcessor> g) { … }
std::unique_ptr<GrFragmentProcessor> GrFragmentProcessor::ColorMatrix(
std::unique_ptr<GrFragmentProcessor> child,
const float matrix[20],
bool unpremulInput,
bool clampRGBOutput,
bool premulOutput) { … }
std::unique_ptr<GrFragmentProcessor> GrFragmentProcessor::SurfaceColor() { … }
std::unique_ptr<GrFragmentProcessor> GrFragmentProcessor::DeviceSpace(
std::unique_ptr<GrFragmentProcessor> fp) { … }
#define CLIP_EDGE_SKSL …
static_assert …;
static_assert …;
static_assert …;
static_assert …;
std::unique_ptr<GrFragmentProcessor> GrFragmentProcessor::Rect(
std::unique_ptr<GrFragmentProcessor> inputFP, GrClipEdgeType edgeType, SkRect rect) { … }
GrFPResult GrFragmentProcessor::Circle(std::unique_ptr<GrFragmentProcessor> inputFP,
GrClipEdgeType edgeType,
SkPoint center,
float radius) { … }
GrFPResult GrFragmentProcessor::Ellipse(std::unique_ptr<GrFragmentProcessor> inputFP,
GrClipEdgeType edgeType,
SkPoint center,
SkPoint radii,
const GrShaderCaps& caps) { … }
std::unique_ptr<GrFragmentProcessor> GrFragmentProcessor::HighPrecision(
std::unique_ptr<GrFragmentProcessor> fp) { … }
ProgramImpl;
void ProgramImpl::setData(const GrGLSLProgramDataManager& pdman,
const GrFragmentProcessor& processor) { … }
SkString ProgramImpl::invokeChild(int childIndex,
const char* inputColor,
const char* destColor,
EmitArgs& args,
std::string_view skslCoords) { … }
SkString ProgramImpl::invokeChildWithMatrix(int childIndex,
const char* inputColor,
const char* destColor,
EmitArgs& args) { … }