Lines Matching refs:reporter
35 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ResourceCacheCache, reporter, ctxInfo) { in DEF_GPUTEST_FOR_RENDERING_CONTEXTS() argument
79 REPORTER_ASSERT(reporter, curCacheSize <= maxCacheSize); in DEF_GPUTEST_FOR_RENDERING_CONTEXTS()
120 DEF_GPUTEST_FOR_CONTEXTS(ResourceCacheStencilBuffers, &is_rendering_and_not_angle_es3, reporter,
130 REPORTER_ASSERT(reporter, smallRT0);
135 REPORTER_ASSERT(reporter, smallRT1);
137 REPORTER_ASSERT(reporter, get_SB(smallRT0.get()) == get_SB(smallRT1.get()));
143 REPORTER_ASSERT(reporter, smallRT2);
145 REPORTER_ASSERT(reporter, get_SB(smallRT0.get()) == get_SB(smallRT2.get()));
151 REPORTER_ASSERT(reporter, bigRT);
153 REPORTER_ASSERT(reporter, get_SB(smallRT0.get()) != get_SB(bigRT.get()));
168 REPORTER_ASSERT(reporter, smallMSAART0);
171 REPORTER_ASSERT(reporter, get_SB(smallRT0.get()) != get_SB(smallMSAART0.get()));
178 REPORTER_ASSERT(reporter, smallMSAART1);
180 REPORTER_ASSERT(reporter, get_SB(smallMSAART0.get()) == get_SB(smallMSAART1.get()));
191 REPORTER_ASSERT(reporter, smallMSAART2);
193 REPORTER_ASSERT(reporter, get_SB(smallMSAART0.get()) != get_SB(smallMSAART2.get()));
198 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ResourceCacheWrappedResources, reporter, ctxInfo) { in DEF_GPUTEST_FOR_RENDERING_CONTEXTS() argument
217 REPORTER_ASSERT(reporter, backendTextures[0].isValid()); in DEF_GPUTEST_FOR_RENDERING_CONTEXTS()
218 REPORTER_ASSERT(reporter, backendTextures[1].isValid()); in DEF_GPUTEST_FOR_RENDERING_CONTEXTS()
231 REPORTER_ASSERT(reporter, borrowed != nullptr && adopted != nullptr); in DEF_GPUTEST_FOR_RENDERING_CONTEXTS()
244 REPORTER_ASSERT(reporter, borrowedIsAlive); in DEF_GPUTEST_FOR_RENDERING_CONTEXTS()
245 REPORTER_ASSERT(reporter, !adoptedIsAlive); in DEF_GPUTEST_FOR_RENDERING_CONTEXTS()
372 static void test_no_key(skiatest::Reporter* reporter) { in test_no_key() argument
384 REPORTER_ASSERT(reporter, 4 == TestResource::NumAlive()); in test_no_key()
385 REPORTER_ASSERT(reporter, 4 == cache->getResourceCount()); in test_no_key()
386 REPORTER_ASSERT(reporter, a->gpuMemorySize() + b->gpuMemorySize() + c->gpuMemorySize() + in test_no_key()
391 REPORTER_ASSERT(reporter, 4 == TestResource::NumAlive()); in test_no_key()
396 REPORTER_ASSERT(reporter, 3 == TestResource::NumAlive()); in test_no_key()
397 REPORTER_ASSERT(reporter, 3 == cache->getResourceCount()); in test_no_key()
398 REPORTER_ASSERT(reporter, b->gpuMemorySize() + c->gpuMemorySize() + d->gpuMemorySize() == in test_no_key()
402 REPORTER_ASSERT(reporter, 2 == TestResource::NumAlive()); in test_no_key()
403 REPORTER_ASSERT(reporter, 2 == cache->getResourceCount()); in test_no_key()
404 REPORTER_ASSERT(reporter, b->gpuMemorySize() + d->gpuMemorySize() == in test_no_key()
408 REPORTER_ASSERT(reporter, 1 == TestResource::NumAlive()); in test_no_key()
409 REPORTER_ASSERT(reporter, 1 == cache->getResourceCount()); in test_no_key()
410 REPORTER_ASSERT(reporter, b->gpuMemorySize() == cache->getResourceBytes()); in test_no_key()
413 REPORTER_ASSERT(reporter, 0 == TestResource::NumAlive()); in test_no_key()
414 REPORTER_ASSERT(reporter, 0 == cache->getResourceCount()); in test_no_key()
415 REPORTER_ASSERT(reporter, 0 == cache->getResourceBytes()); in test_no_key()
426 static void test_purge_unlocked(skiatest::Reporter* reporter) { in test_purge_unlocked() argument
454 REPORTER_ASSERT(reporter, 4 == TestResource::NumAlive()); in test_purge_unlocked()
455 REPORTER_ASSERT(reporter, 4 == cache->getResourceCount()); in test_purge_unlocked()
456 REPORTER_ASSERT(reporter, a->gpuMemorySize() + b->gpuMemorySize() + c->gpuMemorySize() + in test_purge_unlocked()
461 REPORTER_ASSERT(reporter, 4 == TestResource::NumAlive()); in test_purge_unlocked()
469 REPORTER_ASSERT(reporter, 4 == TestResource::NumAlive()); in test_purge_unlocked()
470 REPORTER_ASSERT(reporter, 4 == cache->getResourceCount()); in test_purge_unlocked()
471 REPORTER_ASSERT(reporter, a->gpuMemorySize() + b->gpuMemorySize() + c->gpuMemorySize() + in test_purge_unlocked()
477 REPORTER_ASSERT(reporter, 2 == TestResource::NumAlive()); in test_purge_unlocked()
478 REPORTER_ASSERT(reporter, 2 == cache->getResourceCount()); in test_purge_unlocked()
479 REPORTER_ASSERT(reporter, b->gpuMemorySize() + d->gpuMemorySize() == in test_purge_unlocked()
485 REPORTER_ASSERT(reporter, 0 == TestResource::NumAlive()); in test_purge_unlocked()
486 REPORTER_ASSERT(reporter, 0 == cache->getResourceCount()); in test_purge_unlocked()
487 REPORTER_ASSERT(reporter, 0 == cache->getResourceBytes()); in test_purge_unlocked()
490 static void test_budgeting(skiatest::Reporter* reporter) { in test_budgeting() argument
517 REPORTER_ASSERT(reporter, wrappedCacheableViaKey); in test_budgeting()
519 REPORTER_ASSERT(reporter, wrappedUncacheableViaKey); in test_budgeting()
526 REPORTER_ASSERT(reporter, 5 == cache->getResourceCount()); in test_budgeting()
527 REPORTER_ASSERT(reporter, scratch->gpuMemorySize() + unique->gpuMemorySize() + in test_budgeting()
532 REPORTER_ASSERT(reporter, 2 == cache->getBudgetedResourceCount()); in test_budgeting()
533 REPORTER_ASSERT(reporter, scratch->gpuMemorySize() + unique->gpuMemorySize() == in test_budgeting()
535 REPORTER_ASSERT(reporter, 0 == cache->getPurgeableBytes()); in test_budgeting()
539 REPORTER_ASSERT(reporter, 5 == cache->getResourceCount()); in test_budgeting()
540 REPORTER_ASSERT(reporter, scratch->gpuMemorySize() + unique->gpuMemorySize() + in test_budgeting()
545 REPORTER_ASSERT(reporter, 2 == cache->getBudgetedResourceCount()); in test_budgeting()
546 REPORTER_ASSERT(reporter, scratch->gpuMemorySize() + unique->gpuMemorySize() == in test_budgeting()
548 REPORTER_ASSERT(reporter, 0 == cache->getPurgeableBytes()); in test_budgeting()
554 REPORTER_ASSERT(reporter, 4 == cache->getResourceCount()); in test_budgeting()
555 REPORTER_ASSERT(reporter, scratch->gpuMemorySize() + unique->gpuMemorySize() + in test_budgeting()
559 REPORTER_ASSERT(reporter, 0 == cache->getPurgeableBytes()); in test_budgeting()
564 REPORTER_ASSERT(reporter, 11 == cache->getPurgeableBytes()); in test_budgeting()
568 REPORTER_ASSERT(reporter, 4 == cache->getResourceCount()); in test_budgeting()
571 REPORTER_ASSERT(reporter, wrappedCacheableViaKey); in test_budgeting()
578 REPORTER_ASSERT(reporter, 3 == cache->getResourceCount()); in test_budgeting()
581 REPORTER_ASSERT(reporter, scratch->gpuMemorySize() + wrappedCacheable->gpuMemorySize() + in test_budgeting()
585 REPORTER_ASSERT(reporter, 1 == cache->getBudgetedResourceCount()); in test_budgeting()
586 REPORTER_ASSERT(reporter, scratch->gpuMemorySize() == cache->getBudgetedResourceBytes()); in test_budgeting()
587 REPORTER_ASSERT(reporter, 0 == cache->getPurgeableBytes()); in test_budgeting()
590 REPORTER_ASSERT(reporter, 10 == cache->getPurgeableBytes()); in test_budgeting()
592 REPORTER_ASSERT(reporter, 3 == cache->getResourceCount()); in test_budgeting()
593 REPORTER_ASSERT(reporter, unbudgeted->gpuMemorySize() + wrappedCacheable->gpuMemorySize() + in test_budgeting()
596 REPORTER_ASSERT(reporter, 0 == cache->getBudgetedResourceCount()); in test_budgeting()
597 REPORTER_ASSERT(reporter, 0 == cache->getBudgetedResourceBytes()); in test_budgeting()
598 REPORTER_ASSERT(reporter, 0 == cache->getPurgeableBytes()); in test_budgeting()
603 REPORTER_ASSERT(reporter, 1 == cache->getResourceCount()); in test_budgeting()
604 REPORTER_ASSERT(reporter, unbudgeted->gpuMemorySize() == cache->getResourceBytes()); in test_budgeting()
605 REPORTER_ASSERT(reporter, 0 == cache->getBudgetedResourceCount()); in test_budgeting()
606 REPORTER_ASSERT(reporter, 0 == cache->getBudgetedResourceBytes()); in test_budgeting()
607 REPORTER_ASSERT(reporter, 0 == cache->getPurgeableBytes()); in test_budgeting()
610 REPORTER_ASSERT(reporter, 0 == cache->getResourceCount()); in test_budgeting()
611 REPORTER_ASSERT(reporter, 0 == cache->getResourceBytes()); in test_budgeting()
612 REPORTER_ASSERT(reporter, 0 == cache->getBudgetedResourceCount()); in test_budgeting()
613 REPORTER_ASSERT(reporter, 0 == cache->getBudgetedResourceBytes()); in test_budgeting()
614 REPORTER_ASSERT(reporter, 0 == cache->getPurgeableBytes()); in test_budgeting()
617 static void test_unbudgeted(skiatest::Reporter* reporter) { in test_unbudgeted() argument
636 REPORTER_ASSERT(reporter, 1 == cache->getResourceCount()); in test_unbudgeted()
637 REPORTER_ASSERT(reporter, 10 == cache->getResourceBytes()); in test_unbudgeted()
638 REPORTER_ASSERT(reporter, 1 == cache->getBudgetedResourceCount()); in test_unbudgeted()
639 REPORTER_ASSERT(reporter, 10 == cache->getBudgetedResourceBytes()); in test_unbudgeted()
640 REPORTER_ASSERT(reporter, 10 == cache->getPurgeableBytes()); in test_unbudgeted()
645 REPORTER_ASSERT(reporter, 2 == cache->getResourceCount()); in test_unbudgeted()
646 REPORTER_ASSERT(reporter, 21 == cache->getResourceBytes()); in test_unbudgeted()
647 REPORTER_ASSERT(reporter, 2 == cache->getBudgetedResourceCount()); in test_unbudgeted()
648 REPORTER_ASSERT(reporter, 21 == cache->getBudgetedResourceBytes()); in test_unbudgeted()
649 REPORTER_ASSERT(reporter, 21 == cache->getPurgeableBytes()); in test_unbudgeted()
653 REPORTER_ASSERT(reporter, 3 == cache->getResourceCount()); in test_unbudgeted()
654 REPORTER_ASSERT(reporter, 21 + large == cache->getResourceBytes()); in test_unbudgeted()
655 REPORTER_ASSERT(reporter, 2 == cache->getBudgetedResourceCount()); in test_unbudgeted()
656 REPORTER_ASSERT(reporter, 21 == cache->getBudgetedResourceBytes()); in test_unbudgeted()
657 REPORTER_ASSERT(reporter, 21 == cache->getPurgeableBytes()); in test_unbudgeted()
660 REPORTER_ASSERT(reporter, 2 == cache->getResourceCount()); in test_unbudgeted()
661 REPORTER_ASSERT(reporter, 21 == cache->getResourceBytes()); in test_unbudgeted()
662 REPORTER_ASSERT(reporter, 2 == cache->getBudgetedResourceCount()); in test_unbudgeted()
663 REPORTER_ASSERT(reporter, 21 == cache->getBudgetedResourceBytes()); in test_unbudgeted()
664 REPORTER_ASSERT(reporter, 21 == cache->getPurgeableBytes()); in test_unbudgeted()
667 REPORTER_ASSERT(reporter, 3 == cache->getResourceCount()); in test_unbudgeted()
668 REPORTER_ASSERT(reporter, 21 + large == cache->getResourceBytes()); in test_unbudgeted()
669 REPORTER_ASSERT(reporter, 2 == cache->getBudgetedResourceCount()); in test_unbudgeted()
670 REPORTER_ASSERT(reporter, 21 == cache->getBudgetedResourceBytes()); in test_unbudgeted()
671 REPORTER_ASSERT(reporter, 21 == cache->getPurgeableBytes()); in test_unbudgeted()
674 REPORTER_ASSERT(reporter, 2 == cache->getResourceCount()); in test_unbudgeted()
675 REPORTER_ASSERT(reporter, 21 == cache->getResourceBytes()); in test_unbudgeted()
676 REPORTER_ASSERT(reporter, 2 == cache->getBudgetedResourceCount()); in test_unbudgeted()
677 REPORTER_ASSERT(reporter, 21 == cache->getBudgetedResourceBytes()); in test_unbudgeted()
678 REPORTER_ASSERT(reporter, 21 == cache->getPurgeableBytes()); in test_unbudgeted()
681 REPORTER_ASSERT(reporter, 0 == cache->getResourceCount()); in test_unbudgeted()
682 REPORTER_ASSERT(reporter, 0 == cache->getResourceBytes()); in test_unbudgeted()
683 REPORTER_ASSERT(reporter, 0 == cache->getBudgetedResourceCount()); in test_unbudgeted()
684 REPORTER_ASSERT(reporter, 0 == cache->getBudgetedResourceBytes()); in test_unbudgeted()
685 REPORTER_ASSERT(reporter, 0 == cache->getPurgeableBytes()); in test_unbudgeted()
689 void test_unbudgeted_to_scratch(skiatest::Reporter* reporter);
690 /*static*/ void test_unbudgeted_to_scratch(skiatest::Reporter* reporter) { in test_unbudgeted_to_scratch() argument
704 REPORTER_ASSERT(reporter, resource->resourcePriv().getScratchKey() == key); in test_unbudgeted_to_scratch()
705 REPORTER_ASSERT(reporter, !resource->cacheAccess().isScratch()); in test_unbudgeted_to_scratch()
706 REPORTER_ASSERT(reporter, GrBudgetedType::kUnbudgetedUncacheable == in test_unbudgeted_to_scratch()
708 …REPORTER_ASSERT(reporter, nullptr == cache->findAndRefScratchResource(key, TestResource::kDefaultS… in test_unbudgeted_to_scratch()
709 REPORTER_ASSERT(reporter, 1 == cache->getResourceCount()); in test_unbudgeted_to_scratch()
710 REPORTER_ASSERT(reporter, size == cache->getResourceBytes()); in test_unbudgeted_to_scratch()
711 REPORTER_ASSERT(reporter, 0 == cache->getBudgetedResourceCount()); in test_unbudgeted_to_scratch()
712 REPORTER_ASSERT(reporter, 0 == cache->getBudgetedResourceBytes()); in test_unbudgeted_to_scratch()
713 REPORTER_ASSERT(reporter, 0 == cache->getPurgeableBytes()); in test_unbudgeted_to_scratch()
717 REPORTER_ASSERT(reporter, 1 == cache->getResourceCount()); in test_unbudgeted_to_scratch()
718 REPORTER_ASSERT(reporter, size == cache->getResourceBytes()); in test_unbudgeted_to_scratch()
719 REPORTER_ASSERT(reporter, 1 == cache->getBudgetedResourceCount()); in test_unbudgeted_to_scratch()
720 REPORTER_ASSERT(reporter, size == cache->getBudgetedResourceBytes()); in test_unbudgeted_to_scratch()
721 REPORTER_ASSERT(reporter, size == cache->getPurgeableBytes()); in test_unbudgeted_to_scratch()
723 REPORTER_ASSERT(reporter, resource); in test_unbudgeted_to_scratch()
724 REPORTER_ASSERT(reporter, resource->resourcePriv().getScratchKey() == key); in test_unbudgeted_to_scratch()
725 REPORTER_ASSERT(reporter, resource->cacheAccess().isScratch()); in test_unbudgeted_to_scratch()
726 REPORTER_ASSERT(reporter, in test_unbudgeted_to_scratch()
736 REPORTER_ASSERT(reporter, 1 == cache->getResourceCount()); in test_unbudgeted_to_scratch()
737 REPORTER_ASSERT(reporter, size == cache->getResourceBytes()); in test_unbudgeted_to_scratch()
738 REPORTER_ASSERT(reporter, 1 == cache->getBudgetedResourceCount()); in test_unbudgeted_to_scratch()
739 REPORTER_ASSERT(reporter, size == cache->getBudgetedResourceBytes()); in test_unbudgeted_to_scratch()
740 REPORTER_ASSERT(reporter, 0 == cache->getPurgeableBytes()); in test_unbudgeted_to_scratch()
741 REPORTER_ASSERT(reporter, !resource->resourcePriv().getScratchKey().isValid()); in test_unbudgeted_to_scratch()
742 REPORTER_ASSERT(reporter, !resource->cacheAccess().isScratch()); in test_unbudgeted_to_scratch()
743 REPORTER_ASSERT(reporter, in test_unbudgeted_to_scratch()
748 REPORTER_ASSERT(reporter, 0 == cache->getResourceCount()); in test_unbudgeted_to_scratch()
749 REPORTER_ASSERT(reporter, 0 == cache->getResourceBytes()); in test_unbudgeted_to_scratch()
750 REPORTER_ASSERT(reporter, 0 == cache->getBudgetedResourceCount()); in test_unbudgeted_to_scratch()
751 REPORTER_ASSERT(reporter, 0 == cache->getBudgetedResourceBytes()); in test_unbudgeted_to_scratch()
752 REPORTER_ASSERT(reporter, 0 == cache->getPurgeableBytes()); in test_unbudgeted_to_scratch()
757 static void test_duplicate_scratch_key(skiatest::Reporter* reporter) { in test_duplicate_scratch_key() argument
773 …REPORTER_ASSERT(reporter, nullptr == cache->findAndRefScratchResource(scratchKey1, TestResource::k… in test_duplicate_scratch_key()
779 REPORTER_ASSERT(reporter, 2 == TestResource::NumAlive()); in test_duplicate_scratch_key()
780 SkDEBUGCODE(REPORTER_ASSERT(reporter, 2 == cache->countScratchEntriesForKey(scratchKey));) in test_duplicate_scratch_key()
781 REPORTER_ASSERT(reporter, 2 == cache->getResourceCount()); in test_duplicate_scratch_key()
782 REPORTER_ASSERT(reporter, a->gpuMemorySize() + b->gpuMemorySize() == in test_duplicate_scratch_key()
787 REPORTER_ASSERT(reporter, 2 == TestResource::NumAlive()); in test_duplicate_scratch_key()
788 REPORTER_ASSERT(reporter, 2 == cache->getResourceCount()); in test_duplicate_scratch_key()
793 REPORTER_ASSERT(reporter, 2 == TestResource::NumAlive()); in test_duplicate_scratch_key()
794 SkDEBUGCODE(REPORTER_ASSERT(reporter, 2 == cache->countScratchEntriesForKey(scratchKey));) in test_duplicate_scratch_key()
798 REPORTER_ASSERT(reporter, 0 == TestResource::NumAlive()); in test_duplicate_scratch_key()
799 REPORTER_ASSERT(reporter, 0 == cache->getResourceCount()); in test_duplicate_scratch_key()
800 SkDEBUGCODE(REPORTER_ASSERT(reporter, 0 == cache->countScratchEntriesForKey(scratchKey));) in test_duplicate_scratch_key()
803 static void test_remove_scratch_key(skiatest::Reporter* reporter) { in test_remove_scratch_key() argument
821 …REPORTER_ASSERT(reporter, cache->findAndRefScratchResource(scratchKey, TestResource::kDefaultSize,… in test_remove_scratch_key()
825 REPORTER_ASSERT(reporter, 2 == TestResource::NumAlive()); in test_remove_scratch_key()
826 SkDEBUGCODE(REPORTER_ASSERT(reporter, 2 == cache->countScratchEntriesForKey(scratchKey));) in test_remove_scratch_key()
827 REPORTER_ASSERT(reporter, 2 == cache->getResourceCount()); in test_remove_scratch_key()
834 REPORTER_ASSERT(reporter, 2 == TestResource::NumAlive()); in test_remove_scratch_key()
835 SkDEBUGCODE(REPORTER_ASSERT(reporter, 1 == cache->countScratchEntriesForKey(scratchKey));) in test_remove_scratch_key()
836 REPORTER_ASSERT(reporter, 2 == cache->getResourceCount()); in test_remove_scratch_key()
840 REPORTER_ASSERT(reporter, 1 == TestResource::NumAlive()); in test_remove_scratch_key()
841 SkDEBUGCODE(REPORTER_ASSERT(reporter, 1 == cache->countScratchEntriesForKey(scratchKey));) in test_remove_scratch_key()
842 REPORTER_ASSERT(reporter, 1 == cache->getResourceCount()); in test_remove_scratch_key()
847 REPORTER_ASSERT(reporter, 1 == TestResource::NumAlive()); in test_remove_scratch_key()
848 SkDEBUGCODE(REPORTER_ASSERT(reporter, 0 == cache->countScratchEntriesForKey(scratchKey));) in test_remove_scratch_key()
849 REPORTER_ASSERT(reporter, 1 == cache->getResourceCount()); in test_remove_scratch_key()
853 REPORTER_ASSERT(reporter, 1 == TestResource::NumAlive()); in test_remove_scratch_key()
854 SkDEBUGCODE(REPORTER_ASSERT(reporter, 0 == cache->countScratchEntriesForKey(scratchKey));) in test_remove_scratch_key()
855 REPORTER_ASSERT(reporter, 1 == cache->getResourceCount()); in test_remove_scratch_key()
858 REPORTER_ASSERT(reporter, 0 == TestResource::NumAlive()); in test_remove_scratch_key()
859 SkDEBUGCODE(REPORTER_ASSERT(reporter, 0 == cache->countScratchEntriesForKey(scratchKey));) in test_remove_scratch_key()
860 REPORTER_ASSERT(reporter, 0 == cache->getResourceCount()); in test_remove_scratch_key()
863 static void test_scratch_key_consistency(skiatest::Reporter* reporter) { in test_scratch_key_consistency() argument
883 REPORTER_ASSERT(reporter, scratchKey1.size() == TestResource::ExpectedScratchKeySize()); in test_scratch_key_consistency()
884 REPORTER_ASSERT(reporter, scratchKey1 != scratchKey2); in test_scratch_key_consistency()
885 REPORTER_ASSERT(reporter, scratchKey2 != scratchKey1); in test_scratch_key_consistency()
887 REPORTER_ASSERT(reporter, scratchKey.size() == TestResource::ExpectedScratchKeySize()); in test_scratch_key_consistency()
888 REPORTER_ASSERT(reporter, scratchKey1 == scratchKey); in test_scratch_key_consistency()
889 REPORTER_ASSERT(reporter, scratchKey == scratchKey1); in test_scratch_key_consistency()
890 REPORTER_ASSERT(reporter, scratchKey2 != scratchKey); in test_scratch_key_consistency()
891 REPORTER_ASSERT(reporter, scratchKey != scratchKey2); in test_scratch_key_consistency()
893 REPORTER_ASSERT(reporter, scratchKey.size() == TestResource::ExpectedScratchKeySize()); in test_scratch_key_consistency()
894 REPORTER_ASSERT(reporter, scratchKey1 != scratchKey); in test_scratch_key_consistency()
895 REPORTER_ASSERT(reporter, scratchKey != scratchKey1); in test_scratch_key_consistency()
896 REPORTER_ASSERT(reporter, scratchKey2 == scratchKey); in test_scratch_key_consistency()
897 REPORTER_ASSERT(reporter, scratchKey == scratchKey2); in test_scratch_key_consistency()
902 …REPORTER_ASSERT(reporter, cache->findAndRefScratchResource(scratchKey, TestResource::kDefaultSize,… in test_scratch_key_consistency()
907 REPORTER_ASSERT(reporter, find != nullptr); in test_scratch_key_consistency()
912 REPORTER_ASSERT(reporter, find != nullptr); in test_scratch_key_consistency()
913 REPORTER_ASSERT(reporter, find == a || find == b); in test_scratch_key_consistency()
916 REPORTER_ASSERT(reporter, find2 != nullptr); in test_scratch_key_consistency()
917 REPORTER_ASSERT(reporter, find2 == a || find2 == b); in test_scratch_key_consistency()
918 REPORTER_ASSERT(reporter, find2 != find); in test_scratch_key_consistency()
923 static void test_duplicate_unique_key(skiatest::Reporter* reporter) { in test_duplicate_unique_key() argument
937 REPORTER_ASSERT(reporter, a == cache->findAndRefUniqueResource(key)); in test_duplicate_unique_key()
942 REPORTER_ASSERT(reporter, a == cache->findAndRefUniqueResource(key)); in test_duplicate_unique_key()
944 REPORTER_ASSERT(reporter, 1 == cache->getResourceCount()); in test_duplicate_unique_key()
945 REPORTER_ASSERT(reporter, a->gpuMemorySize() == cache->getResourceBytes()); in test_duplicate_unique_key()
946 REPORTER_ASSERT(reporter, 1 == TestResource::NumAlive()); in test_duplicate_unique_key()
951 REPORTER_ASSERT(reporter, b == cache->findAndRefUniqueResource(key)); in test_duplicate_unique_key()
955 REPORTER_ASSERT(reporter, 2 == cache->getResourceCount()); in test_duplicate_unique_key()
956 REPORTER_ASSERT(reporter, a->gpuMemorySize() + b->gpuMemorySize() == cache->getResourceBytes()); in test_duplicate_unique_key()
957 REPORTER_ASSERT(reporter, 2 == TestResource::NumAlive()); in test_duplicate_unique_key()
961 REPORTER_ASSERT(reporter, 1 == cache->getResourceCount()); in test_duplicate_unique_key()
962 REPORTER_ASSERT(reporter, b->gpuMemorySize() == cache->getResourceBytes()); in test_duplicate_unique_key()
963 REPORTER_ASSERT(reporter, 1 == TestResource::NumAlive()); in test_duplicate_unique_key()
972 REPORTER_ASSERT(reporter, 2 == cache->getResourceCount()); in test_duplicate_unique_key()
973 REPORTER_ASSERT(reporter, b->gpuMemorySize() + c->gpuMemorySize() == cache->getResourceBytes()); in test_duplicate_unique_key()
974 REPORTER_ASSERT(reporter, 2 == TestResource::NumAlive()); in test_duplicate_unique_key()
977 REPORTER_ASSERT(reporter, 1 == cache->getResourceCount()); in test_duplicate_unique_key()
978 REPORTER_ASSERT(reporter, c->gpuMemorySize() == cache->getResourceBytes()); in test_duplicate_unique_key()
979 REPORTER_ASSERT(reporter, 1 == TestResource::NumAlive()); in test_duplicate_unique_key()
983 REPORTER_ASSERT(reporter, 1 == cache->getResourceCount()); in test_duplicate_unique_key()
984 REPORTER_ASSERT(reporter, c->gpuMemorySize() == cache->getResourceBytes()); in test_duplicate_unique_key()
985 REPORTER_ASSERT(reporter, 1 == TestResource::NumAlive()); in test_duplicate_unique_key()
989 REPORTER_ASSERT(reporter, 1 == cache->getResourceCount()); in test_duplicate_unique_key()
990 REPORTER_ASSERT(reporter, c->gpuMemorySize() == cache->getResourceBytes()); in test_duplicate_unique_key()
991 REPORTER_ASSERT(reporter, 1 == TestResource::NumAlive()); in test_duplicate_unique_key()
994 REPORTER_ASSERT(reporter, c == cache->findAndRefUniqueResource(key)); in test_duplicate_unique_key()
997 REPORTER_ASSERT(reporter, 0 == cache->getResourceCount()); in test_duplicate_unique_key()
998 REPORTER_ASSERT(reporter, 0 == cache->getResourceBytes()); in test_duplicate_unique_key()
999 REPORTER_ASSERT(reporter, 0 == TestResource::NumAlive()); in test_duplicate_unique_key()
1013 REPORTER_ASSERT(reporter, *(int*) d2->getUniqueKey().getCustomData()->data() == 4132); in test_duplicate_unique_key()
1016 static void test_purge_invalidated(skiatest::Reporter* reporter) { in test_purge_invalidated() argument
1039 REPORTER_ASSERT(reporter, cache->hasUniqueKey(key1)); in test_purge_invalidated()
1040 REPORTER_ASSERT(reporter, cache->hasUniqueKey(key2)); in test_purge_invalidated()
1041 REPORTER_ASSERT(reporter, cache->hasUniqueKey(key3)); in test_purge_invalidated()
1042 REPORTER_ASSERT(reporter, 3 == TestResource::NumAlive()); in test_purge_invalidated()
1052 REPORTER_ASSERT(reporter, !cache->hasUniqueKey(key1)); in test_purge_invalidated()
1053 REPORTER_ASSERT(reporter, !cache->hasUniqueKey(key2)); in test_purge_invalidated()
1054 REPORTER_ASSERT(reporter, 2 == TestResource::NumAlive()); in test_purge_invalidated()
1055 REPORTER_ASSERT(reporter, cache->hasUniqueKey(key3)); in test_purge_invalidated()
1061 REPORTER_ASSERT(reporter, 2 == TestResource::NumAlive()); in test_purge_invalidated()
1062 REPORTER_ASSERT(reporter, !cache->hasUniqueKey(key3)); in test_purge_invalidated()
1066 REPORTER_ASSERT(reporter, 1 == TestResource::NumAlive()); in test_purge_invalidated()
1072 REPORTER_ASSERT(reporter, scratch == c); in test_purge_invalidated()
1078 REPORTER_ASSERT(reporter, 0 == TestResource::NumAlive()); in test_purge_invalidated()
1079 REPORTER_ASSERT(reporter, 0 == cache->getResourceCount()); in test_purge_invalidated()
1080 REPORTER_ASSERT(reporter, 0 == cache->getResourceBytes()); in test_purge_invalidated()
1081 REPORTER_ASSERT(reporter, !scratch); in test_purge_invalidated()
1085 static void test_cache_chained_purge(skiatest::Reporter* reporter) { in test_cache_chained_purge() argument
1104 REPORTER_ASSERT(reporter, 2 == TestResource::NumAlive()); in test_cache_chained_purge()
1110 REPORTER_ASSERT(reporter, 2 == TestResource::NumAlive()); in test_cache_chained_purge()
1113 REPORTER_ASSERT(reporter, 2 == TestResource::NumAlive()); in test_cache_chained_purge()
1117 REPORTER_ASSERT(reporter, 2 == TestResource::NumAlive()); in test_cache_chained_purge()
1120 REPORTER_ASSERT(reporter, 0 == TestResource::NumAlive()); in test_cache_chained_purge()
1123 static void test_timestamp_wrap(skiatest::Reporter* reporter) { in test_timestamp_wrap() argument
1176 REPORTER_ASSERT(reporter, nullptr == res); in test_timestamp_wrap()
1178 REPORTER_ASSERT(reporter, nullptr != res); in test_timestamp_wrap()
1189 static void test_time_purge(skiatest::Reporter* reporter) { in test_time_purge() argument
1224 REPORTER_ASSERT(reporter, cnt - i - 1 == cache->getResourceCount()); in test_time_purge()
1229 REPORTER_ASSERT(reporter, !SkToBool(r)); in test_time_purge()
1234 REPORTER_ASSERT(reporter, 0 == cache->getResourceCount()); in test_time_purge()
1259 REPORTER_ASSERT(reporter, cnt - i / 2 - 1 == cache->getResourceCount()); in test_time_purge()
1266 REPORTER_ASSERT(reporter, cnt / 2 - i - 1 == cache->getResourceCount()); in test_time_purge()
1272 REPORTER_ASSERT(reporter, 0 == cache->getResourceCount()); in test_time_purge()
1284 REPORTER_ASSERT(reporter, 10 == cache->getResourceCount()); in test_time_purge()
1286 REPORTER_ASSERT(reporter, 10 == cache->getResourceCount()); in test_time_purge()
1288 REPORTER_ASSERT(reporter, 0 == cache->getResourceCount()); in test_time_purge()
1292 static void test_partial_purge(skiatest::Reporter* reporter) { in test_partial_purge() argument
1332 REPORTER_ASSERT(reporter, 5 == cache->getBudgetedResourceCount()); in test_partial_purge()
1333 REPORTER_ASSERT(reporter, 60 == cache->getBudgetedResourceBytes()); in test_partial_purge()
1334 REPORTER_ASSERT(reporter, 0 == cache->getPurgeableBytes()); in test_partial_purge()
1343 REPORTER_ASSERT(reporter, 5 == cache->getBudgetedResourceCount()); in test_partial_purge()
1344 REPORTER_ASSERT(reporter, 60 == cache->getBudgetedResourceBytes()); in test_partial_purge()
1345 REPORTER_ASSERT(reporter, 60 == cache->getPurgeableBytes()); in test_partial_purge()
1350 REPORTER_ASSERT(reporter, 3 == cache->getBudgetedResourceCount()); in test_partial_purge()
1351 REPORTER_ASSERT(reporter, 33 == cache->getBudgetedResourceBytes()); in test_partial_purge()
1356 REPORTER_ASSERT(reporter, 4 == cache->getBudgetedResourceCount()); in test_partial_purge()
1357 REPORTER_ASSERT(reporter, 47 == cache->getBudgetedResourceBytes()); in test_partial_purge()
1362 REPORTER_ASSERT(reporter, 0 == cache->getBudgetedResourceCount()); in test_partial_purge()
1363 REPORTER_ASSERT(reporter, 0 == cache->getBudgetedResourceBytes()); in test_partial_purge()
1368 REPORTER_ASSERT(reporter, 3 == cache->getBudgetedResourceCount()); in test_partial_purge()
1369 REPORTER_ASSERT(reporter, 37 == cache->getBudgetedResourceBytes()); in test_partial_purge()
1374 REPORTER_ASSERT(reporter, 0 == cache->getBudgetedResourceCount()); in test_partial_purge()
1375 REPORTER_ASSERT(reporter, 0 == cache->getBudgetedResourceBytes()); in test_partial_purge()
1381 REPORTER_ASSERT(reporter, 5 == cache->getBudgetedResourceCount()); in test_partial_purge()
1382 REPORTER_ASSERT(reporter, 60 == cache->getBudgetedResourceBytes()); in test_partial_purge()
1383 REPORTER_ASSERT(reporter, 60 == cache->getPurgeableBytes()); in test_partial_purge()
1390 REPORTER_ASSERT(reporter, 0 == cache->getBudgetedResourceCount()); in test_partial_purge()
1391 REPORTER_ASSERT(reporter, 0 == cache->getPurgeableBytes()); in test_partial_purge()
1396 static void test_large_resource_count(skiatest::Reporter* reporter) { in test_large_resource_count() argument
1423 REPORTER_ASSERT(reporter, TestResource::NumAlive() == 2 * kResourceCnt); in test_large_resource_count()
1424 REPORTER_ASSERT(reporter, cache->getPurgeableBytes() == 2 * kResourceCnt); in test_large_resource_count()
1425 REPORTER_ASSERT(reporter, cache->getBudgetedResourceBytes() == 2 * kResourceCnt); in test_large_resource_count()
1426 REPORTER_ASSERT(reporter, cache->getBudgetedResourceCount() == 2 * kResourceCnt); in test_large_resource_count()
1427 REPORTER_ASSERT(reporter, cache->getResourceBytes() == 2 * kResourceCnt); in test_large_resource_count()
1428 REPORTER_ASSERT(reporter, cache->getResourceCount() == 2 * kResourceCnt); in test_large_resource_count()
1434 REPORTER_ASSERT(reporter, cache->hasUniqueKey(key1)); in test_large_resource_count()
1435 REPORTER_ASSERT(reporter, cache->hasUniqueKey(key2)); in test_large_resource_count()
1439 REPORTER_ASSERT(reporter, TestResource::NumAlive() == 0); in test_large_resource_count()
1440 REPORTER_ASSERT(reporter, cache->getPurgeableBytes() == 0); in test_large_resource_count()
1441 REPORTER_ASSERT(reporter, cache->getBudgetedResourceBytes() == 0); in test_large_resource_count()
1442 REPORTER_ASSERT(reporter, cache->getBudgetedResourceCount() == 0); in test_large_resource_count()
1443 REPORTER_ASSERT(reporter, cache->getResourceBytes() == 0); in test_large_resource_count()
1444 REPORTER_ASSERT(reporter, cache->getResourceCount() == 0); in test_large_resource_count()
1451 REPORTER_ASSERT(reporter, !cache->hasUniqueKey(key1)); in test_large_resource_count()
1452 REPORTER_ASSERT(reporter, !cache->hasUniqueKey(key2)); in test_large_resource_count()
1456 static void test_custom_data(skiatest::Reporter* reporter) { in test_custom_data() argument
1462 REPORTER_ASSERT(reporter, *(int*) key1.getCustomData()->data() == 4132); in test_custom_data()
1463 REPORTER_ASSERT(reporter, key2.getCustomData() == nullptr); in test_custom_data()
1467 REPORTER_ASSERT(reporter, *(int*) key3.getCustomData()->data() == 4132); in test_custom_data()
1470 static void test_abandoned(skiatest::Reporter* reporter) { in test_abandoned() argument
1478 REPORTER_ASSERT(reporter, resource->wasDestroyed()); in test_abandoned()
1499 static void test_tags(skiatest::Reporter* reporter) { in test_tags() argument
1536 REPORTER_ASSERT(reporter, cache->countUniqueKeysWithTag(tagStr.c_str()) == i); in test_tags()
1541 static void test_free_resource_messages(skiatest::Reporter* reporter) { in test_free_resource_messages() argument
1550 REPORTER_ASSERT(reporter, 1 == TestResource::NumAlive()); in test_free_resource_messages()
1561 REPORTER_ASSERT(reporter, 3 == TestResource::NumAlive()); in test_free_resource_messages()
1568 REPORTER_ASSERT(reporter, 3 == TestResource::NumAlive()); in test_free_resource_messages()
1578 REPORTER_ASSERT(reporter, 2 == TestResource::NumAlive()); in test_free_resource_messages()
1584 REPORTER_ASSERT(reporter, 1 == TestResource::NumAlive()); in test_free_resource_messages()
1588 REPORTER_ASSERT(reporter, 0 == TestResource::NumAlive()); in test_free_resource_messages()
1592 DEF_GPUTEST(ResourceCacheMisc, reporter, /* options */) {
1594 test_no_key(reporter);
1595 test_purge_unlocked(reporter);
1596 test_budgeting(reporter);
1597 test_unbudgeted(reporter);
1598 test_unbudgeted_to_scratch(reporter);
1599 test_duplicate_unique_key(reporter);
1600 test_duplicate_scratch_key(reporter);
1601 test_remove_scratch_key(reporter);
1602 test_scratch_key_consistency(reporter);
1603 test_purge_invalidated(reporter);
1604 test_cache_chained_purge(reporter);
1605 test_timestamp_wrap(reporter);
1606 test_time_purge(reporter);
1607 test_partial_purge(reporter);
1608 test_large_resource_count(reporter);
1609 test_custom_data(reporter);
1610 test_abandoned(reporter);
1611 test_tags(reporter);
1612 test_free_resource_messages(reporter);
1651 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GPUMemorySize, reporter, ctxInfo) { in DEF_GPUTEST_FOR_RENDERING_CONTEXTS() argument
1664 REPORTER_ASSERT(reporter, kSize*kSize*4 == size); in DEF_GPUTEST_FOR_RENDERING_CONTEXTS()
1672 REPORTER_ASSERT(reporter, in DEF_GPUTEST_FOR_RENDERING_CONTEXTS()
1680 REPORTER_ASSERT(reporter, kSize*kSize*4 == size); in DEF_GPUTEST_FOR_RENDERING_CONTEXTS()
1692 REPORTER_ASSERT(reporter, kSize*kSize*4+(kSize*kSize*4)/3 == size); in DEF_GPUTEST_FOR_RENDERING_CONTEXTS()
1700 REPORTER_ASSERT(reporter, in DEF_GPUTEST_FOR_RENDERING_CONTEXTS()
1708 REPORTER_ASSERT(reporter, kSize*kSize*4+(kSize*kSize*4)/3 == size); in DEF_GPUTEST_FOR_RENDERING_CONTEXTS()