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 <noreply@anthropic.com>
This commit is contained in:
john.maia
2026-10-07 18:39:29 +01:00
parent cea1ef13c3
commit 9cbbf9c33d
@@ -98,7 +98,26 @@ public:
Require(count != 0, "no Vulkan device");
std::vector<VkPhysicalDevice> 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<PFN_vkGetPhysicalDeviceProperties>("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<PFN_vkEnumerateDeviceExtensionProperties>("vkEnumerateDeviceExtensionProperties");
Check(extensions(context.physical, nullptr, &count, nullptr), "vkEnumerateDeviceExtensionProperties");
std::vector<VkExtensionProperties> available(count);
@@ -186,7 +205,10 @@ private:
void release() noexcept {
if (context.pool != VK_NULL_HANDLE) context.Function<PFN_vkDestroyCommandPool>("vkDestroyCommandPool")(context.device, context.pool, nullptr);
context.bufferPool.reset();
if (context.device != VK_NULL_HANDLE) function<PFN_vkDestroyDevice>("vkDestroyDevice")(context.device, nullptr);
if (context.device != VK_NULL_HANDLE) {
DestroyShadows(context.device);
function<PFN_vkDestroyDevice>("vkDestroyDevice")(context.device, nullptr);
}
if (instance != VK_NULL_HANDLE) function<PFN_vkDestroyInstance>("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");