mirror of
https://github.com/KytyPS5/KytyPS5.git
synced 2026-08-03 11:23:49 +00:00
renderer: minor optimizations
This commit is contained in:
@@ -219,7 +219,7 @@ private:
|
|||||||
typename CoarseTable::PageRange coarse_range {};
|
typename CoarseTable::PageRange coarse_range {};
|
||||||
typename TrackingTable::PageRange tracking_range {};
|
typename TrackingTable::PageRange tracking_range {};
|
||||||
if (!CoarseTable::TryGetPageRange(address, size, coarse_range) ||
|
if (!CoarseTable::TryGetPageRange(address, size, coarse_range) ||
|
||||||
!TrackingTable::TryGetPageRange(address, size, tracking_range)) {
|
(!strict_bytes && !TrackingTable::TryGetPageRange(address, size, tracking_range))) {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
MembershipList candidates;
|
MembershipList candidates;
|
||||||
@@ -230,8 +230,8 @@ private:
|
|||||||
}
|
}
|
||||||
std::vector<OwnerT> result;
|
std::vector<OwnerT> result;
|
||||||
for (const Registration* registration: candidates) {
|
for (const Registration* registration: candidates) {
|
||||||
if ((!strict_bytes || Overlaps(registration->ranges, address, size)) &&
|
if ((strict_bytes ? Overlaps(registration->ranges, address, size)
|
||||||
HasTrackingMembership(registration, tracking_range) &&
|
: HasTrackingMembership(registration, tracking_range)) &&
|
||||||
predicate(registration->owner)) {
|
predicate(registration->owner)) {
|
||||||
result.push_back(registration->owner);
|
result.push_back(registration->owner);
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -1159,8 +1159,8 @@ ImageId TextureCache::FindImage(ImageDesc& desc, bool exact_format) {
|
|||||||
if (owner == nullptr) {
|
if (owner == nullptr) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
const auto merged_info = result ? ResolveImage(result).info : desc.info;
|
const auto& merged_info = result ? ResolveImage(result).info : desc.info;
|
||||||
const auto overlap = ResolveOverlap(merged_info, desc.type, candidate, result);
|
const auto overlap = ResolveOverlap(merged_info, desc.type, candidate, result);
|
||||||
if (overlap.image) {
|
if (overlap.image) {
|
||||||
result = overlap.image;
|
result = overlap.image;
|
||||||
view_mip = overlap.mip;
|
view_mip = overlap.mip;
|
||||||
|
|||||||
@@ -117,12 +117,15 @@ void TestStrictByteFilteringAndPredicate() {
|
|||||||
OwnerIndex index;
|
OwnerIndex index;
|
||||||
Check(index.Register(31, {{0x300100, 0x100}}), "first byte-disjoint owner registers");
|
Check(index.Register(31, {{0x300100, 0x100}}), "first byte-disjoint owner registers");
|
||||||
Check(index.Register(32, {{0x300800, 0x100}}), "second byte-disjoint owner registers");
|
Check(index.Register(32, {{0x300800, 0x100}}), "second byte-disjoint owner registers");
|
||||||
|
Check(index.Register(33, {{0x30f000, 0x100}}), "coarse-only owner registers");
|
||||||
Check(index.TrackingMembershipCount(0x300) == 2,
|
Check(index.TrackingMembershipCount(0x300) == 2,
|
||||||
"byte-disjoint owners share one tracking page");
|
"byte-disjoint owners share one tracking page");
|
||||||
|
Check(index.CoarseMembershipCount(3) == 3,
|
||||||
|
"all owners share one coarse candidate bucket");
|
||||||
Check(index.Query(0x300400, 0x40).empty(), "page hit without byte overlap is filtered out");
|
Check(index.Query(0x300400, 0x40).empty(), "page hit without byte overlap is filtered out");
|
||||||
const auto page_candidates = index.QueryCandidates(0x300400, 0x40);
|
const auto page_candidates = index.QueryCandidates(0x300400, 0x40);
|
||||||
Check(page_candidates.size() == 2,
|
Check(page_candidates.size() == 2,
|
||||||
"fault candidate query retains byte-disjoint owners on the touched page");
|
"fault candidate query retains touched-page owners and rejects coarse-only owners");
|
||||||
const auto first = index.Query(0x300180, 0x10);
|
const auto first = index.Query(0x300180, 0x10);
|
||||||
Check(first.size() == 1 && first.front() == 31,
|
Check(first.size() == 1 && first.front() == 31,
|
||||||
"strict byte overlap selects only the matching owner");
|
"strict byte overlap selects only the matching owner");
|
||||||
@@ -132,6 +135,20 @@ void TestStrictByteFilteringAndPredicate() {
|
|||||||
"supplied predicate filters query owners");
|
"supplied predicate filters query owners");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TestOwnerIndexAddressSpaceBoundary() {
|
||||||
|
OwnerIndex index;
|
||||||
|
constexpr uint64_t last_byte = OwnerIndex::CoarseTable::kAddressSpaceSize - 1;
|
||||||
|
Check(index.Register(41, {{last_byte, 1}}), "final guest byte registers");
|
||||||
|
const auto exact = index.Query(last_byte, 1);
|
||||||
|
Check(exact.size() == 1 && exact.front() == 41,
|
||||||
|
"strict query finds an exact overlap at the final guest byte");
|
||||||
|
Check(index.Query(last_byte - 1, 1).empty(),
|
||||||
|
"strict query preserves half-open overlap boundaries");
|
||||||
|
const auto page_candidates = index.QueryCandidates(last_byte - 1, 1);
|
||||||
|
Check(page_candidates.size() == 1 && page_candidates.front() == 41,
|
||||||
|
"page candidate query retains a byte-disjoint owner on the final tracking page");
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
@@ -142,6 +159,7 @@ int main() {
|
|||||||
TestMultiRangeRegistrationDeduplicatesPages();
|
TestMultiRangeRegistrationDeduplicatesPages();
|
||||||
TestSharedPageUnregisterLifecycle();
|
TestSharedPageUnregisterLifecycle();
|
||||||
TestStrictByteFilteringAndPredicate();
|
TestStrictByteFilteringAndPredicate();
|
||||||
|
TestOwnerIndexAddressSpaceBoundary();
|
||||||
std::printf("ImagePageTableTests: all cases passed\n");
|
std::printf("ImagePageTableTests: all cases passed\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user