diff --git a/core/libs/prx/libSceAgcDriver/tests/Recorder.cpp b/core/libs/prx/libSceAgcDriver/tests/Recorder.cpp index adb35a6d7d13..2968dfe4ace6 100644 --- a/core/libs/prx/libSceAgcDriver/tests/Recorder.cpp +++ b/core/libs/prx/libSceAgcDriver/tests/Recorder.cpp @@ -2454,11 +2454,12 @@ void staleGenerationTests(const Device& device, Recorder& recorder) { resource.dstSelW = 7; resource.dccAddress = address + surfaceBytes; { + Require(AgcDriver::GuestMemory::Watched(address, bytes), "(s) the block is not watched before the storage image takes its generation"); auto image = std::make_shared(context, detiler, resource, 0); - Require(AgcDriver::GuestMemory::Watched(address, bytes), "(s) the storage image imported its memory before a generation was taken"); const VkImageSubresourceRange range{VK_IMAGE_ASPECT_COLOR_BIT, 0, 1, 0, 1}; const auto commands = recorder.Commands(); recorder.Keep(image); + Require(image->Generation() != 0, "(s) the storage image took no generation while its memory was watched"); const VkClearColorValue red{{1.0f, 0.0f, 0.0f, 1.0f}}; RecordMemoryBarrier(context, commands, VK_PIPELINE_STAGE_ALL_COMMANDS_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT, VK_ACCESS_SHADER_WRITE_BIT | VK_ACCESS_TRANSFER_WRITE_BIT | VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT, VK_ACCESS_TRANSFER_WRITE_BIT); context.Function("vkCmdClearColorImage")(commands, image->Image(), VK_IMAGE_LAYOUT_GENERAL, &red, 1, &range); @@ -2483,6 +2484,11 @@ void staleGenerationTests(const Device& device, Recorder& recorder) { recorder.Submit(); device.WaitQueue(); recorder.Sync(); + Require(StorageTexture::FindPending(address, surfaceBytes) == image, "(s) the image is not pending after the refresh"); + Require(StorageTexture::FlushPending(address, surfaceBytes, nullptr, "stale generation test"), "(s) the pending image was not flushed"); + recorder.Submit(); + device.WaitQueue(); + recorder.Sync(); const auto pixels = readback.Bytes(); constexpr std::array expected{255, 0, 0, 255}; for (std::size_t i = 0; i < pixels.size(); ++i) Require(std::to_integer(pixels[i]) == expected[i % 4], "(s) results pending when their memory left the watch were dropped"); @@ -3221,8 +3227,10 @@ void importWindowTests(const Device& device, Recorder& recorder) { resource.dstSelW = 7; resource.dccAddress = address + surfaceBytes; { + Require(!HostImportCovers(base, address, bytes), "(w) the block is imported before the cache takes its generation"); + const auto cached = CollectWritesUncached(address, surfaceBytes); + Require(cached != 0 && UnchangedSince(address, surfaceBytes, cached), "(w) the cache's generation is not current before the import"); auto image = std::make_shared(context, detiler, resource, 0); - Require(!HostImportCovers(base, address, bytes), "(w) the storage image imported its memory before a generation was taken"); const VkImageSubresourceRange range{VK_IMAGE_ASPECT_COLOR_BIT, 0, 1, 0, 1}; const auto commands = recorder.Commands(); recorder.Keep(image); @@ -3231,8 +3239,6 @@ void importWindowTests(const Device& device, Recorder& recorder) { context.Function("vkCmdClearColorImage")(commands, image->Image(), VK_IMAGE_LAYOUT_GENERAL, &red, 1, &range); RecordMemoryBarrier(context, commands, VK_PIPELINE_STAGE_TRANSFER_BIT, VK_PIPELINE_STAGE_ALL_COMMANDS_BIT, VK_ACCESS_TRANSFER_WRITE_BIT, VK_ACCESS_SHADER_READ_BIT | VK_ACCESS_SHADER_WRITE_BIT | VK_ACCESS_TRANSFER_READ_BIT | VK_ACCESS_TRANSFER_WRITE_BIT); image->MarkDirty(); - const auto cached = CollectWritesUncached(address, surfaceBytes); - Require(cached != 0 && UnchangedSince(address, surfaceBytes, cached), "(w) the cache's generation is not current before the import"); const auto* import = HostImportFor(base, address, bytes); if (import == nullptr) { std::cout << "host import of the import window block refused: the import window not tested\n"; @@ -3243,6 +3249,7 @@ void importWindowTests(const Device& device, Recorder& recorder) { CollectWritesUncached(address, surfaceBytes); if (importWrites) { Require(!UnchangedSince(address, surfaceBytes, cached), "(w) a cache over the pages the import reported sees no change"); + Require(image->Generation() != 0 && !UnchangedSince(address, surfaceBytes, image->Generation()), "(w) the storage image took its generation after the import window"); std::array changed{}; const std::array generations{cached, cached, cached, cached}; Require(ChangedBlocks(address, surfaceBytes, generations, changed) && std::all_of(changed.begin(), changed.end(), [](std::uint8_t value) { return value == BlockMaybeWritten; }), "(w) the pages the import reported read as written by the CPU");