graphics: synchronize host file writes and depth clipping

Map paired PS5 depth-clip state through Vulkan pipeline creation and preserve asymmetric hard failures. Prepare GPU-mapped guest ranges before kernel file reads so buffer, texture, and alias ownership remains coherent. Add focused regression coverage and update the current launch target.
This commit is contained in:
nmzik
2026-07-19 14:33:38 +02:00
parent 91690ac29e
commit aebf6b4913
15 changed files with 184 additions and 6 deletions
+31
View File
@@ -168,6 +168,36 @@ void TestSharedWatcherFault() {
Check(VirtualFree(memory, 0, MEM_RELEASE) != 0, "VirtualFree failed");
}
void TestMappedHostWriteRange() {
FaultContext context;
PageManager manager(InvalidateFault, &context);
context.manager = &manager;
const auto page_size = manager.GetPageSize();
auto *memory = Allocate(page_size * 3);
const auto address = reinterpret_cast<uint64_t>(memory);
manager.OnGpuMap(address, page_size);
manager.OnGpuMap(address + page_size * 2, page_size);
manager.UpdatePageWatchers(true, address, page_size);
manager.UpdatePageWatchers(true, address + page_size * 2, page_size);
Check(manager.HasAnyMapping(address + 16, page_size * 3 - 32),
"host-write range did not find partial GPU mappings");
Check(!manager.IsMapped(address, page_size * 3),
"partial GPU mappings were reported as a full mapping");
Check(manager.HandleWriteRange(address + 16, page_size * 3 - 32),
"mapped host-write range was not handled");
Check(context.calls.load(std::memory_order_relaxed) == 2,
"host-write range did not invalidate each mapped watched page");
Check(IsWritable(memory) && IsWritable(memory + page_size * 2),
"host-write range did not restore writable protection");
manager.OnGpuUnmap(address, page_size);
manager.OnGpuUnmap(address + page_size * 2, page_size);
Check(!manager.HasAnyMapping(address, page_size * 3),
"host-write range retained stale GPU mappings");
Check(VirtualFree(memory, 0, MEM_RELEASE) != 0, "VirtualFree failed");
}
void TestReadWriteWatcherFault() {
FaultContext context;
PageManager manager(InvalidateFault, &context);
@@ -607,6 +637,7 @@ int main(int argc, char **argv) {
}
TestWatchFaultAndUnwatch();
TestSharedWatcherFault();
TestMappedHostWriteRange();
TestReadWriteWatcherFault();
TestPermittedMappedLateFaultsResume();
TestPartialMappingUnmapPreservesTokens();
+29
View File
@@ -13869,6 +13869,30 @@ void CheckReferenceClockScale() {
std::printf("[host] %-32s ok\n", "ReferenceClockScale");
}
void CheckClipControlDepthClipState() {
HW::ClipControl clip;
Require("ClipControlDepthClipState", "default",
clip.IsZClipModeRepresentable() && clip.IsZClipEnabled(),
"default paired Z clipping was not enabled");
clip.min_z_clip_disable = true;
Require("ClipControlDepthClipState", "asymmetric near",
!clip.IsZClipModeRepresentable(),
"asymmetric near-plane state was accepted");
clip.min_z_clip_disable = false;
clip.max_z_clip_disable = true;
Require("ClipControlDepthClipState", "asymmetric far",
!clip.IsZClipModeRepresentable(),
"asymmetric far-plane state was accepted");
clip.min_z_clip_disable = true;
Require("ClipControlDepthClipState", "both disabled",
clip.IsZClipModeRepresentable() && !clip.IsZClipEnabled(),
"paired Z-clip disable was not represented");
std::printf("[host] %-32s ok\n", "ClipControlDepthClipState");
}
} // namespace
} // namespace Libs::Graphics
@@ -13877,6 +13901,10 @@ int main(int argc, char **argv) {
EnsureConfigInitialized();
TileInit();
if (argc == 2 && std::strcmp(argv[1], "--clip-control-only") == 0) {
CheckClipControlDepthClipState();
return 0;
}
if (argc == 2 && std::strcmp(argv[1], "--reference-clock-only") == 0) {
CheckReferenceClockScale();
return 0;
@@ -14021,6 +14049,7 @@ int main(int argc, char **argv) {
(void)argc;
(void)argv;
#endif
CheckClipControlDepthClipState();
CheckReferenceClockScale();
CheckEmbeddedFetchVertexOffset();
CheckEmbeddedFetchLaneSpill();