#include "src/gpu/ganesh/effects/GrPerlinNoise2Effect.h"
#include "include/core/SkRefCnt.h"
#include "include/core/SkScalar.h"
#include "include/core/SkSize.h"
#include "include/effects/SkPerlinNoiseShader.h"
#include "include/private/gpu/ganesh/GrTypesPriv.h"
#include "src/base/SkRandom.h"
#include "src/core/SkSLTypeShared.h"
#include "src/gpu/KeyBuilder.h"
#include "src/gpu/ganesh/GrFragmentProcessor.h"
#include "src/gpu/ganesh/GrFragmentProcessors.h"
#include "src/gpu/ganesh/GrProcessorUnitTest.h"
#include "src/gpu/ganesh/GrShaderCaps.h"
#include "src/gpu/ganesh/GrShaderVar.h"
#include "src/gpu/ganesh/GrTestUtils.h"
#include "src/gpu/ganesh/glsl/GrGLSLFragmentShaderBuilder.h"
#include "src/gpu/ganesh/glsl/GrGLSLProgramDataManager.h"
#include "src/gpu/ganesh/glsl/GrGLSLUniformHandler.h"
#include "src/shaders/SkPerlinNoiseShaderType.h"
#include <cstdint>
#include <iterator>
class SkShader;
GR_DEFINE_FRAGMENT_PROCESSOR_TEST(…)
#if defined(GPU_TEST_UTILS)
std::unique_ptr<GrFragmentProcessor> GrPerlinNoise2Effect::TestCreate(GrProcessorTestData* d) {
int numOctaves = d->fRandom->nextRangeU(2, 10);
bool stitchTiles = d->fRandom->nextBool();
SkScalar seed = SkIntToScalar(d->fRandom->nextU());
SkISize tileSize;
tileSize.fWidth = d->fRandom->nextRangeU(4, 4096);
tileSize.fHeight = d->fRandom->nextRangeU(4, 4096);
SkScalar baseFrequencyX = d->fRandom->nextRangeScalar(0.01f, 0.99f);
SkScalar baseFrequencyY = d->fRandom->nextRangeScalar(0.01f, 0.99f);
sk_sp<SkShader> shader(d->fRandom->nextBool()
? SkShaders::MakeFractalNoise(baseFrequencyX,
baseFrequencyY,
numOctaves,
seed,
stitchTiles ? &tileSize : nullptr)
: SkShaders::MakeTurbulence(baseFrequencyX,
baseFrequencyY,
numOctaves,
seed,
stitchTiles ? &tileSize : nullptr));
GrTest::TestAsFPArgs asFPArgs(d);
return GrFragmentProcessors::Make(
shader.get(), asFPArgs.args(), GrTest::TestMatrix(d->fRandom));
}
#endif
SkString GrPerlinNoise2Effect::Impl::emitHelper(EmitArgs& args) { … }
void GrPerlinNoise2Effect::Impl::emitCode(EmitArgs& args) { … }
void GrPerlinNoise2Effect::Impl::onSetData(const GrGLSLProgramDataManager& pdman,
const GrFragmentProcessor& processor) { … }
void GrPerlinNoise2Effect::onAddToKey(const GrShaderCaps& caps, skgpu::KeyBuilder* b) const { … }