From 9cbbf9c33db585ac5d19ad22aefe5a8560ba7865 Mon Sep 17 00:00:00 2001 From: "john.maia" Date: Wed, 7 Oct 2026 18:39:29 +0100 Subject: [PATCH] test(agc): run the recorder tests on AMD and Intel GPUs importWindowTests pinned watched imports even where the driver decides to compare them. On amdgpu (RADV) and Intel (ANV) the import probe finds the pages written after a GPU access, so the driver never watches imports there; under the pinned watch the storage image keeps the CPU's blocks and the test fails. It fails the same way at d8c7c0cc, where it was added. It now reports itself as not run when imports are compared, like the unit shadow test. minLodTests expected MIN_LOD 1.5 to blend levels 1 and 2. With VK_EXT_image_view_min_lod the view minimum LOD is minLodFloat (preferred) or minLodInteger (alternative); ANV takes the integer part and reads level 1. Either result is accepted and the alternative is reported. The test device ranks Vulkan devices as VulkanDevice does instead of taking the first one, so on a host with an iGPU it runs on the same GPU as the runtime. Like VulkanDevice, it destroys the unit shadows before the device: a test that failed with live slabs segfaulted at exit when the registry freed them after vkDestroyDevice. Co-Authored-By: Claude Opus 5.5 --- .../prx/libSceAgcDriver/tests/Recorder.cpp | 37 +++++++++++++++++-- 1 file changed, 34 insertions(+), 3 deletions(-) diff --git a/core/libs/prx/libSceAgcDriver/tests/Recorder.cpp b/core/libs/prx/libSceAgcDriver/tests/Recorder.cpp index 795db774c..5bdc467c4 100644 --- a/core/libs/prx/libSceAgcDriver/tests/Recorder.cpp +++ b/core/libs/prx/libSceAgcDriver/tests/Recorder.cpp @@ -98,7 +98,26 @@ public: Require(count != 0, "no Vulkan device"); std::vector devices(count); Check(enumerate(instance, &count, devices.data()), "vkEnumeratePhysicalDevices"); - context.physical = devices.front(); + const auto rankDeviceType = [](VkPhysicalDeviceType type) { + switch (type) { + case VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU: return 3; + case VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU: return 2; + case VK_PHYSICAL_DEVICE_TYPE_VIRTUAL_GPU: return 1; + default: return 0; + } + }; + const auto physicalProperties = function("vkGetPhysicalDeviceProperties"); + int selectedRank = -1; + for (const auto physical : devices) { + VkPhysicalDeviceProperties candidate{}; + physicalProperties(physical, &candidate); + if (candidate.apiVersion < VK_API_VERSION_1_1) continue; + const int rank = rankDeviceType(candidate.deviceType); + if (rank <= selectedRank) continue; + context.physical = physical; + selectedRank = rank; + } + Require(context.physical != VK_NULL_HANDLE, "no Vulkan 1.1 device"); const auto extensions = function("vkEnumerateDeviceExtensionProperties"); Check(extensions(context.physical, nullptr, &count, nullptr), "vkEnumerateDeviceExtensionProperties"); std::vector available(count); @@ -186,7 +205,10 @@ private: void release() noexcept { if (context.pool != VK_NULL_HANDLE) context.Function("vkDestroyCommandPool")(context.device, context.pool, nullptr); context.bufferPool.reset(); - if (context.device != VK_NULL_HANDLE) function("vkDestroyDevice")(context.device, nullptr); + if (context.device != VK_NULL_HANDLE) { + DestroyShadows(context.device); + function("vkDestroyDevice")(context.device, nullptr); + } if (instance != VK_NULL_HANDLE) function("vkDestroyInstance")(instance, nullptr); if (library != nullptr) SDL_UnloadObject(library); } @@ -1983,6 +2005,10 @@ void importWindowTests(const Device& device, Recorder& recorder) { Require(probe.failure == nullptr, "(w) the import probe failed"); const bool importWrites = probe.writtenAtImport != 0; const auto decided = PrepareImportWatch(base); + if (decided == ImportWatch::Unwatch) { + std::cout << "host imports are compared, not watched: the import window not tested\n"; + return; + } SetImportWatch(base, ImportWatch::Watch); struct Restore { const Context& context; @@ -2522,7 +2548,12 @@ void minLodTests(const Device& device, Recorder& recorder) { const auto unorm = [&](std::size_t level) { return levels[level] / 255.0f; }; expectRed(sample(0, 0.0f), unorm(0), "minimum LOD clamp: no clamp reads level 0"); expectRed(sample(0x100, 0.0f), unorm(1), "minimum LOD clamp: MIN_LOD 1 reads level 1 at LOD 0"); - expectRed(sample(0x180, 0.0f), (unorm(1) + unorm(2)) / 2.0f, "minimum LOD clamp: MIN_LOD 1.5 blends levels 1 and 2"); + const auto fractional = sample(0x180, 0.0f); + if (std::abs(fractional - unorm(1)) <= 1.5f / 255.0f) { + std::cout << "minimum LOD clamp: the device takes the integer part of a fractional view minimum LOD\n"; + } else { + expectRed(fractional, (unorm(1) + unorm(2)) / 2.0f, "minimum LOD clamp: MIN_LOD 1.5 blends levels 1 and 2"); + } expectRed(sample(0x100, 2.0f), unorm(2), "minimum LOD clamp: MIN_LOD 1 lowered LOD 2"); expectRed(sample(0xfff, 0.0f), unorm(3), "minimum LOD clamp: MIN_LOD past the last level reads the last level"); expectRed(sample(0x200, 0.0f, 1), unorm(2), "minimum LOD clamp: MIN_LOD 2 over a view from level 1 reads level 2");