test(agc): isolate allocation budget query counts

This commit is contained in:
MarcZX100 authored and Adrià Franch committed 2026-10-19 15:05:18 +02:00
1 parent 415dcab140
commit c5f8a3ff22
1 file changed
+5 -1
@@ -791,21 +791,25 @@ void AllocationFailureReportsHeapBudgets() {
mock = MockDevice{};
diagnosticBudgetQueries = 0;
std::string failure;
std::uint64_t allocationPathBudgetQueries = 0;
{
auto context = mockContext();
context.physical = reinterpret_cast<VkPhysicalDevice>(std::uintptr_t{1});
context.memoryProperties2 = mockDiagnosticMemoryProperties2;
context.memory.memoryHeapCount = 2;
context.bufferPool = std::make_shared<BufferPool>(context);
const auto beforeAllocation = diagnosticBudgetQueries;
mock.results = {VK_ERROR_DEVICE_LOST};
try {
DeviceBuffer buffer(context, 4 * MiB, VK_BUFFER_USAGE_STORAGE_BUFFER_BIT);
} catch (const std::exception& error) {
failure = error.what();
}
allocationPathBudgetQueries = diagnosticBudgetQueries - beforeAllocation;
}
Expect(failure.find("heap 0 1500/2000 MiB") != std::string::npos, "allocation failure omitted the first heap's memory budget");
Expect(failure.find("heap 1 2500/3000 MiB") != std::string::npos, "allocation failure omitted a later heap's memory budget");
Expect(diagnosticBudgetQueries == 2, "allocation failure did not query the memory budget for both type selection and its diagnostic");
Expect(allocationPathBudgetQueries == 2, "allocation failure did not query the memory budget for both type selection and its diagnostic");
mock = MockDevice{};
diagnosticBudgetQueries = 0;