34 GrMockOptions::ConfigOptions::Renderability::kMSAA;
48 float x = std::ldexp(rand.
nextF(), (
i % maxPow2)) / 1e3f;
49 path.cubicTo(111.625f*
x, 308.188f*
x, 764.62f*
x, -435.688f*
x, 742.63f*
x, 85.187f*
x);
50 path.cubicTo(764.62f*
x, -435.688f*
x, 111.625f*
x, 308.188f*
x, 0, 0);
59 for (
int j = -10; j <= 10; j++) {
60 const float x = std::ldexp(rand.
nextF(), (
i % 18)) / 1e3f;
61 const float w = std::ldexp(1 + rand.
nextF(), j);
62 path.conicTo(111.625f *
x, 308.188f *
x, 764.62f *
x, -435.688f *
x,
w);
72 float x = std::ldexp(rand.
nextF(), (
i % maxPow2)) / 1e3f;
73 path.quadTo(111.625f *
x, 308.188f *
x, 764.62f *
x, -435.688f *
x);
82 float x = std::ldexp(rand.
nextF(), (
i % maxPow2)) / 1e3f;
83 path.lineTo(764.62f *
x, -435.688f *
x);
106 SkDebugf(
"ERROR: could not create mock context.");
109 for (
int i = 0;
i < loops; ++
i) {
123#define DEF_PATH_TESS_BENCH(NAME, PATH, MATRIX) \
124 class PathTessellateBenchmark_##NAME : public PathTessellateBenchmark { \
126 PathTessellateBenchmark_##NAME() : PathTessellateBenchmark(#NAME, (PATH), (MATRIX)) {} \
127 void runBench() override; \
129 DEF_BENCH( return new PathTessellateBenchmark_##NAME(); ); \
130 void PathTessellateBenchmark_##NAME::runBench()
133 1.0001f, 0.0001f, 0.0001f,
134 -.0001f, 0.9999f, -.0001f,
142 fTarget->caps().shaderCaps()->fInfinitySupport);
143 tess->prepare(fTarget.get(),
145 {gAlmostIdentity, fPath, SK_PMColor4fTRANSPARENT},
154 fTarget->caps().shaderCaps()->fInfinitySupport);
155 tess->prepare(fTarget.get(),
157 {gAlmostIdentity, fPath, SK_PMColor4fTRANSPARENT},
237 for (
auto [p0, p1, p2] : it.nextStack()) {
238 vertexWriter <<
m.map2Points(p0, p1) <<
m.mapPoint(p2);
249 path.cubicTo(100, 0, 50, 100, 100, 100);
250 path.cubicTo(0, -100, 200, 100, 0, 0);
260 std::vector<PathStrokeList> pathStrokes;
262 for (
int i = 0;
i < 8702; ++
i) {
267 for (
int j = 0; j < numVerbs; ++j) {
268 switch (rand.
nextU() & 3) {
276 auto [
x,
y] = (
path.isEmpty())
288 float y = (
path.isEmpty())
319 : fMakePathStrokesFn(makePathStrokesFn)
320 , fPatchAttribs(attribs)
321 , fMatrixScale(matrixScale) {
326 const char* onGetName()
override {
return fName.
c_str(); }
329 void onDelayedSetup()
override {
331 if (!fTarget->mockContext()) {
332 SkDebugf(
"ERROR: could not create mock context.");
336 fPathStrokes = fMakePathStrokesFn();
337 for (
size_t i = 0;
i < fPathStrokes.size(); ++
i) {
338 if (
i + 1 < fPathStrokes.size()) {
339 fPathStrokes[
i].fNext = &fPathStrokes[
i + 1];
341 fTotalVerbCount += fPathStrokes[
i].fPath.countVerbs();
344 fTessellator = std::make_unique<StrokeTessellator>(fPatchAttribs);
347 void onDraw(
int loops,
SkCanvas*)
final {
348 for (
int i = 0;
i < loops; ++
i) {
349 fTessellator->prepare(fTarget.get(),
353 fTarget->resetAllocator();
361 std::unique_ptr<GrMockOpTarget> fTarget;
362 std::vector<PathStrokeList> fPathStrokes;
363 std::unique_ptr<StrokeTessellator> fTessellator;
365 int fTotalVerbCount = 0;
370 "GrStrokeFixedCountTessellator");
375 "GrStrokeFixedCountTessellator_one_chop");
380 "GrStrokeFixedCountTessellator_motionmark");
static const int strokeWidth
#define SK_ABORT(message,...)
@ kSrcOver
r = s + (1-sa)*d
constexpr SkPMColor4f SK_PMColor4fWHITE
void SK_SPI SkDebugf(const char format[],...) SK_PRINTF_LIKE(1
static int SkNextLog2(uint32_t value)
@ kCubic
SkPath::RawIter returns 4 points.
@ kConic
SkPath::RawIter returns 3 points + 1 weight.
static sk_sp< GrDirectContext > MakeMock(const GrMockOptions *, const GrContextOptions &)
static SkMatrix Scale(SkScalar sx, SkScalar sy)
static SkMatrix MakeAll(SkScalar scaleX, SkScalar skewX, SkScalar transX, SkScalar skewY, SkScalar scaleY, SkScalar transY, SkScalar pers0, SkScalar pers1, SkScalar pers2)
static const SkMatrix & I()
@ kButt_Cap
no stroke extension
@ kMiter_Join
extends to miter limit
@ kBevel_Join
connects outside edges
static const SkPoint * PointData(const SkPath &path)
SkPath & moveTo(SkScalar x, SkScalar y)
uint32_t nextULessThan(uint32_t count)
float nextRangeF(float min, float max)
uint32_t nextRangeU(uint32_t min, uint32_t max)
void printf(const char format[],...) SK_PRINTF_LIKE(2
const char * c_str() const
static constexpr Swizzle RGBA()
static PathCurveTessellator * Make(SkArenaAlloc *arena, bool infinitySupport, PatchAttribs attribs=PatchAttribs::kNone)
PathTessellateBenchmark(const char *subName, const SkPath &p, const SkMatrix &m)
const char * onGetName() override
virtual void runBench()=0
void onDraw(int loops, SkCanvas *) final
std::unique_ptr< GrMockOpTarget > fTarget
bool isSuitableFor(Backend backend) final
void onDelayedSetup() override
static PathWedgeTessellator * Make(SkArenaAlloc *arena, bool infinitySupport, PatchAttribs attribs=PatchAttribs::kNone)
TessPrepareBench(MakePathStrokesFn makePathStrokesFn, PatchAttribs attribs, float matrixScale, const char *suffix)
unsigned useCenter Optional< SkMatrix > matrix
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir path
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not defaults to or::depending on whether ipv6 is specified vm service A custom Dart VM Service port The default is to pick a randomly available open port disable vm Disable the Dart VM Service The Dart VM Service is never available in release mode disable vm service Disable mDNS Dart VM Service publication Bind to the IPv6 localhost address for the Dart VM Service Ignored if vm service host is set endless trace buffer
static TessellatorLibtess tess
DEF_BENCH(return new TessPrepareBench(make_simple_cubic_path, PatchAttribs::kNone, 1, "GrStrokeFixedCountTessellator");) DEF_BENCH(return new TessPrepareBench(make_simple_cubic_path
static SkPath make_line_path(int maxPow2)
tess::PatchAttribs PatchAttribs
static void benchmark_wangs_formula_conic_log2(const SkMatrix &matrix, const SkPath &path)
StrokeTessellator::PathStrokeList PathStrokeList
static SkPath make_cubic_path(int maxPow2)
static constexpr int kNumCubicsInChalkboard
static SkPath make_quad_path(int maxPow2)
static std::vector< PathStrokeList > make_simple_cubic_path()
static void benchmark_wangs_formula_cubic_log2(const SkMatrix &matrix, const SkPath &path)
std::vector< PathStrokeList >(*)() MakePathStrokesFn
static sk_sp< GrDirectContext > make_mock_context()
static const SkMatrix gAlmostIdentity
static void benchmark_wangs_formula_conic(const SkMatrix &matrix, const SkPath &path)
static SkPath make_conic_path()
static std::vector< PathStrokeList > make_motionmark_paths()
DEF_PATH_TESS_BENCH(GrPathCurveTessellator, make_cubic_path(8), SkMatrix::I())
bool fDrawInstancedSupport
ConfigOptions fConfigOptions[kGrColorTypeCnt]
static constexpr SkRect MakeWH(float w, float h)