#include "src/gpu/ganesh/GrDefaultGeoProcFactory.h"
#include "include/core/SkMatrix.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/SkSLTypeShared.h"
#include "src/gpu/KeyBuilder.h"
#include "src/gpu/ganesh/GrColor.h"
#include "src/gpu/ganesh/GrGeometryProcessor.h"
#include "src/gpu/ganesh/GrProcessorUnitTest.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/gpu/ganesh/glsl/GrGLSLVarying.h"
#include "src/gpu/ganesh/glsl/GrGLSLVertexGeoBuilder.h"
#include <memory>
struct GrShaderCaps;
enum GPFlag { … };
class DefaultGeoProc : public GrGeometryProcessor { … };
GR_DEFINE_GEOMETRY_PROCESSOR_TEST(…)
#if defined(GPU_TEST_UTILS)
GrGeometryProcessor* DefaultGeoProc::TestCreate(GrProcessorTestData* d) {
uint32_t flags = 0;
if (d->fRandom->nextBool()) {
flags |= kColorAttribute_GPFlag;
}
if (d->fRandom->nextBool()) {
flags |= kColorAttributeIsWide_GPFlag;
}
if (d->fRandom->nextBool()) {
flags |= kCoverageAttribute_GPFlag;
if (d->fRandom->nextBool()) {
flags |= (d->fRandom->nextBool()) ? kCoverageAttributeTweak_GPFlag
: kCoverageAttributeUnclamped_GPFlag;
}
}
if (d->fRandom->nextBool()) {
flags |= kLocalCoordAttribute_GPFlag;
}
GrColor color = GrTest::RandomColor(d->fRandom);
SkMatrix viewMtx = GrTest::TestMatrix(d->fRandom);
SkMatrix localMtx = GrTest::TestMatrix(d->fRandom);
bool readsLocalCoords = d->fRandom->nextBool();
uint8_t coverage = GrTest::RandomCoverage(d->fRandom);
return DefaultGeoProc::Make(d->allocator(),
flags,
SkPMColor4f::FromBytes_RGBA(color),
viewMtx,
localMtx,
readsLocalCoords,
coverage);
}
#endif
GrGeometryProcessor* GrDefaultGeoProcFactory::Make(SkArenaAlloc* arena,
const Color& color,
const Coverage& coverage,
const LocalCoords& localCoords,
const SkMatrix& viewMatrix) { … }
GrGeometryProcessor* GrDefaultGeoProcFactory::MakeForDeviceSpace(SkArenaAlloc* arena,
const Color& color,
const Coverage& coverage,
const LocalCoords& localCoords,
const SkMatrix& viewMatrix) { … }