476 {
477 auto dContext = ctxInfo.directContext();
478
479 constexpr bool kUnder = true;
480 constexpr bool kOver =
false;
481 constexpr size_t kRGBA64Bytes = 4 * 64 * 64;
482 const ProxyParams kProxy64 = {64, kRT,
kRGBA,
kE, 1,
kB, kDeferred};
483 const ProxyParams kProxy64NotBudgeted = {64, kRT,
kRGBA,
kE, 1, kNotB, kDeferred};
484 const ProxyParams kProxy64Lazy = {64, kRT,
kRGBA,
kE, 1,
kB, kLazy};
485 const ProxyParams kProxy64FullyLazy = {64, kRT,
kRGBA,
kE, 1,
kB, kFullyLazy};
486 const ProxyParams kProxy32Instantiated = {32, kRT,
kRGBA,
kE, 1,
kB, kInstantiated};
487 const ProxyParams kProxy64Instantiated = {64, kRT,
kRGBA,
kE, 1,
kB, kInstantiated};
488
490 {"empty DAG", kUnder, 0, {}, {}, {}},
491 {"unbudgeted", kUnder, 0, {}, {}, {{kProxy64NotBudgeted, 0, 2}}},
492 {"basic", kUnder, kRGBA64Bytes, {}, {}, {{kProxy64, 0, 2}}},
493 {
"basic, over",
kOver, kRGBA64Bytes - 1, {}, {}, {{kProxy64, 0, 2}}},
494 {"shared", kUnder, kRGBA64Bytes, {}, {},
495 {
496 {kProxy64, 0, 2},
497 {kProxy64, 3, 5},
498 }},
499 {"retrieved from cache", kUnder, kRGBA64Bytes,
500 {kProxy64Instantiated},
501 {},
502 {
503 {kProxy64, 0, 2}
504 }},
505 {"purge 4", kUnder, kRGBA64Bytes,
506 {
507 kProxy32Instantiated,
508 kProxy32Instantiated,
509 kProxy32Instantiated,
510 kProxy32Instantiated
511 },
512 {},
513 {
514 {kProxy64, 0, 2}
515 }},
516 {
"dont purge what we've reserved",
kOver, kRGBA64Bytes,
517 {kProxy64Instantiated},
518 {},
519 {
520 {kProxy64, 0, 2},
521 {kProxy64, 1, 3}
522 }},
523 {
"unpurgeable",
kOver, kRGBA64Bytes,
524 {},
525 {kProxy64Instantiated},
526 {
527 {kProxy64, 0, 2}
528 }},
529 {"lazy", kUnder, kRGBA64Bytes,
530 {},
531 {},
532 {
533 {kProxy64Lazy, 0, 2}
534 }},
535 {
"lazy, over",
kOver, kRGBA64Bytes - 1,
536 {},
537 {},
538 {
539 {kProxy64Lazy, 0, 2}
540 }},
541 {"fully-lazy", kUnder, kRGBA64Bytes,
542 {},
543 {},
544 {
545 {kProxy64FullyLazy, 0, 2}
546 }},
547 {
"fully-lazy, over",
kOver, kRGBA64Bytes - 1,
548 {},
549 {},
550 {
551 {kProxy64FullyLazy, 0, 2}
552 }},
553 };
555 for (
size_t i = 0; i < std::size(
tests); i++) {
558
560 interval.fProxy =
make_proxy(dContext, interval.fParams);
561 }
565 }
566 }
567}
static bool match(const char *needle, const char *haystack)
static sk_sp< GrSurfaceProxy > make_proxy(GrDirectContext *dContext, const ProxyParams &p)
static void memory_budget_test(skiatest::Reporter *reporter, GrDirectContext *dContext, const TestCase &test)