#include "src/gpu/ganesh/effects/GrSkSLFP.h"
#include "include/core/SkAlphaType.h"
#include "include/core/SkColor.h"
#include "include/core/SkData.h"
#include "include/core/SkString.h"
#include "include/core/SkSurfaceProps.h"
#include "include/effects/SkOverdrawColorFilter.h"
#include "include/effects/SkRuntimeEffect.h"
#include "include/private/SkSLSampleUsage.h"
#include "include/private/base/SkMalloc.h"
#include "include/private/base/SkTo.h"
#include "include/private/gpu/ganesh/GrTypesPriv.h"
#include "src/base/SkArenaAlloc.h"
#include "src/base/SkRandom.h"
#include "src/core/SkColorSpacePriv.h"
#include "src/core/SkRasterPipeline.h"
#include "src/core/SkRasterPipelineOpContexts.h"
#include "src/core/SkRasterPipelineOpList.h"
#include "src/core/SkRuntimeEffectPriv.h"
#include "src/core/SkSLTypeShared.h"
#include "src/gpu/KeyBuilder.h"
#include "src/gpu/ganesh/GrColorInfo.h"
#include "src/gpu/ganesh/GrColorSpaceXform.h"
#include "src/gpu/ganesh/GrFragmentProcessors.h"
#include "src/gpu/ganesh/GrShaderVar.h"
#include "src/gpu/ganesh/glsl/GrGLSLFragmentShaderBuilder.h"
#include "src/gpu/ganesh/glsl/GrGLSLUniformHandler.h"
#include "src/sksl/SkSLString.h"
#include "src/sksl/SkSLUtil.h"
#include "src/sksl/codegen/SkSLPipelineStageCodeGenerator.h"
#include "src/sksl/codegen/SkSLRasterPipelineBuilder.h"
#include "src/sksl/ir/SkSLProgram.h"
#include "src/sksl/ir/SkSLType.h"
#include "src/sksl/ir/SkSLVarDeclarations.h"
#include "src/sksl/ir/SkSLVariable.h"
#include <algorithm>
namespace SkSL { class Context; }
struct GrShaderCaps;
class GrSkSLFP::Impl : public ProgramImpl { … };
std::unique_ptr<GrSkSLFP> GrSkSLFP::MakeWithData(
sk_sp<SkRuntimeEffect> effect,
const char* name,
sk_sp<SkColorSpace> dstColorSpace,
std::unique_ptr<GrFragmentProcessor> inputFP,
std::unique_ptr<GrFragmentProcessor> destColorFP,
const sk_sp<const SkData>& uniforms,
SkSpan<std::unique_ptr<GrFragmentProcessor>> childFPs) { … }
GrFragmentProcessor::OptimizationFlags GrSkSLFP::DetermineOptimizationFlags(
OptFlags of, SkRuntimeEffect* effect) { … }
GrSkSLFP::GrSkSLFP(sk_sp<SkRuntimeEffect> effect, const char* name, OptFlags optFlags)
: … { … }
GrSkSLFP::GrSkSLFP(const GrSkSLFP& other)
: … { … }
void GrSkSLFP::addChild(std::unique_ptr<GrFragmentProcessor> child, bool mergeOptFlags) { … }
void GrSkSLFP::setInput(std::unique_ptr<GrFragmentProcessor> input) { … }
void GrSkSLFP::setDestColorFP(std::unique_ptr<GrFragmentProcessor> destColorFP) { … }
void GrSkSLFP::addColorTransformChildren(SkColorSpace* dstColorSpace) { … }
std::unique_ptr<GrFragmentProcessor::ProgramImpl> GrSkSLFP::onMakeProgramImpl() const { … }
void GrSkSLFP::onAddToKey(const GrShaderCaps& caps, skgpu::KeyBuilder* b) const { … }
bool GrSkSLFP::onIsEqual(const GrFragmentProcessor& other) const { … }
std::unique_ptr<GrFragmentProcessor> GrSkSLFP::clone() const { … }
SkPMColor4f GrSkSLFP::constantOutputForConstantInput(const SkPMColor4f& inputColor) const { … }
GR_DEFINE_FRAGMENT_PROCESSOR_TEST(…)
#if defined(GPU_TEST_UTILS)
std::unique_ptr<GrFragmentProcessor> GrSkSLFP::TestCreate(GrProcessorTestData* d) {
SkColor colors[SkOverdrawColorFilter::kNumColors];
for (SkColor& c : colors) {
c = d->fRandom->nextU();
}
auto filter = SkOverdrawColorFilter::MakeWithSkColors(colors);
SkSurfaceProps props;
auto [success, fp] = GrFragmentProcessors::Make(
d->context(), filter.get(), nullptr, GrColorInfo{}, props);
SkASSERT(success);
return std::move(fp);
}
#endif