494 {
496 "Use skpbench.py instead. "
497 "You usually don't want to use this program directly.");
499
500 if (!FLAGS_suppressHeader) {
502 }
503 if (FLAGS_duration <= 0) {
505 }
506
507
511 if (
configs.size() != 1 || !(config =
configs[0]->asConfigGpu())) {
513 join(FLAGS_config).c_str());
514 }
515
516
517 if (FLAGS_src.size() != 1) {
519 "invalid input '%s': must specify a single .skp or .svg file, or 'warmup'",
520 join(FLAGS_src).c_str());
521 }
522
524
526 std::unique_ptr<MultiFrameSkp> mskp;
528 if (0 == strcmp(FLAGS_src[0], "warmup")) {
530 srcname = "warmup";
531 } else {
534 if (!srcstream) {
536 }
537 if (srcfile.endsWith(".svg")) {
539 } else if (srcfile.endsWith(".mskp")) {
541
542 skp = mskp->frame(0);
543 } else {
545 }
548 }
550 }
553 if (FLAGS_verbosity >= 3 &&
555 fprintf(stderr, "%s is too large (%ix%i), cropping to %ix%i.\n",
558 }
559 if (FLAGS_scale != 1) {
560 width *= FLAGS_scale;
562 if (FLAGS_verbosity >= 3) {
563 fprintf(stderr, "Scale factor of %.2f: scaling to %ix%i.\n",
565 }
566 }
567
571 }
572
573
580 if (!ctx) {
583 }
587 }
592 }
593 int supportedSampleCount = ctx->priv().caps()->getRenderTargetSampleCount(
595 if (supportedSampleCount != config->
getSamples()) {
598 }
600 if (!testCtx) {
602 }
605 }
606
607
616 }
617
618
619 std::vector<Sample> samples;
620 if (FLAGS_sampleMs > 0) {
621
622 samples.reserve(1 + (FLAGS_duration + FLAGS_sampleMs - 1) / FLAGS_sampleMs);
623 } else {
624 samples.reserve(2 * FLAGS_duration);
625 }
628 if (FLAGS_scale != 1) {
629 canvas->
scale(FLAGS_scale, FLAGS_scale);
630 }
631 if (!FLAGS_gpuClock) {
632 if (FLAGS_ddl) {
634 } else if (!mskp) {
635 auto s = std::make_unique<StaticSkp>(
skp);
637 } else {
639 }
640 } else {
641 if (FLAGS_ddl) {
643 }
646 }
648 }
650
651
652 if (!FLAGS_png.isEmpty()) {
655 if (!
surface->getCanvas()->readPixels(bmp, 0, 0)) {
657 }
660 }
663 }
664 }
665
666 return(0);
667}
void ParseConfigs(const CommandLineFlags::StringArray &configs, SkCommandLineConfigArray *outResult)
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
#define SkScalarCeilToInt(x)
static void Parse(int argc, const char *const *argv)
static void SetUsage(const char *usage)
static std::unique_ptr< MultiFrameSkp > MakeFromFile(const SkString &path)
void allocPixels(const SkImageInfo &info, size_t rowBytes)
void translate(SkScalar dx, SkScalar dy)
void scale(SkScalar sx, SkScalar sy)
SurfType getSurfType() const
ContextType getContextType() const
ContextOverrides getContextOverrides() const
SkColorType getColorType() const
SkAlphaType getAlphaType() const
uint32_t getSurfaceFlags() const
sk_sp< SkColorSpace > refColorSpace() const
const SkString & getTag() const
static SkString Basename(const char *fullPath)
static SkString Dirname(const char *fullPath)
static sk_sp< SkPicture > MakeFromStream(SkStream *stream, const SkDeserialProcs *procs=nullptr)
static std::unique_ptr< SkStreamAsset > MakeFromFile(const char path[])
const char * c_str() const
GrDirectContext * directContext() const
TestContext * testContext() const
bool gpuTimingSupport() const
GpuTimer * gpuTimer() const
bool fenceSyncSupport() const
static float max(float r, float g, float b)
static float min(float r, float g, float b)
void SetCtxOptions(struct GrContextOptions *)
std::string printf(const char *fmt,...) SK_PRINTF_LIKE(1
SK_API sk_sp< SkSurface > RenderTarget(GrRecordingContext *context, skgpu::Budgeted budgeted, const SkImageInfo &imageInfo, int sampleCount, GrSurfaceOrigin surfaceOrigin, const SkSurfaceProps *surfaceProps, bool shouldCreateWithMips=false, bool isProtected=false)
static const char header[]
static bool mkdir_p(const SkString &name)
static SkString join(const CommandLineFlags::StringArray &)
static void run_benchmark(GrDirectContext *context, sk_sp< SkSurface > surface, SkpProducer *skpp, std::vector< Sample > *samples)
void print_result(const std::vector< Sample > &samples, const char *config, const char *bench)
static void run_gpu_time_benchmark(sk_gpu_test::GpuTimer *gpuTimer, GrDirectContext *context, sk_sp< SkSurface > surface, const SkPicture *skp, std::vector< Sample > *samples)
static void run_ddl_benchmark(sk_gpu_test::TestContext *testContext, GrDirectContext *dContext, sk_sp< SkSurface > dstSurface, SkPicture *inputPicture, std::vector< Sample > *samples)
static sk_sp< SkPicture > create_skp_from_svg(SkStream *, const char *filename)
static sk_sp< SkPicture > create_warmup_skp()
static SkImageInfo Make(int width, int height, SkColorType ct, SkAlphaType at)