diff --git a/core/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_depth_plane_partial_store_tests.cmake b/core/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_depth_plane_partial_store_tests.cmake index b03f493d73..2cf7705ca0 100644 --- a/core/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_depth_plane_partial_store_tests.cmake +++ b/core/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_depth_plane_partial_store_tests.cmake @@ -27,6 +27,20 @@ if(BUILD_TESTING) set_tests_properties(agc_driver_depth_plane_unmapped_plane PROPERTIES ENVIRONMENT_MODIFICATION "PATH=path_list_prepend:$") endif() + add_test(NAME agc_driver_depth_plane_partially_unmapped_plane COMMAND agc_driver_depth_plane_partial_store_tests --partially-unmapped-plane) + set_tests_properties(agc_driver_depth_plane_partially_unmapped_plane PROPERTIES + ENVIRONMENT "ANYPS5_NO_SHADER_CACHE=1" TIMEOUT 30 SKIP_RETURN_CODE 77 WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}") + if(WIN32) + set_tests_properties(agc_driver_depth_plane_partially_unmapped_plane PROPERTIES ENVIRONMENT_MODIFICATION + "PATH=path_list_prepend:$") + endif() + add_test(NAME agc_driver_depth_plane_unmapped_plane_fill COMMAND agc_driver_depth_plane_partial_store_tests --unmapped-plane-fill) + set_tests_properties(agc_driver_depth_plane_unmapped_plane_fill PROPERTIES + ENVIRONMENT "ANYPS5_NO_SHADER_CACHE=1" TIMEOUT 30 SKIP_RETURN_CODE 77 WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}") + if(WIN32) + set_tests_properties(agc_driver_depth_plane_unmapped_plane_fill PROPERTIES ENVIRONMENT_MODIFICATION + "PATH=path_list_prepend:$") + endif() add_test(NAME agc_driver_depth_plane_partial_store_unimported COMMAND agc_driver_depth_plane_partial_store_tests) add_test(NAME agc_driver_depth_plane_partial_store_buffer_copy COMMAND agc_driver_depth_plane_partial_store_tests --buffer-copy) endif() diff --git a/core/libs/prx/libSceAgcDriver/tests/execution/DepthPlanePartialStore.cpp b/core/libs/prx/libSceAgcDriver/tests/execution/DepthPlanePartialStore.cpp index 72e7270fc9..6d6c1ee3be 100644 --- a/core/libs/prx/libSceAgcDriver/tests/execution/DepthPlanePartialStore.cpp +++ b/core/libs/prx/libSceAgcDriver/tests/execution/DepthPlanePartialStore.cpp @@ -182,6 +182,45 @@ int main(int argc, char** argv) { return 0; } + if (argc == 2 && std::string_view(argv[1]) == "--partially-unmapped-plane") { + Fill(plane, 1.0f); + Require(draw(depth, writeHalf) == PlaneTexels, "the draw writing depth 0.5 before a partial unmap did not cover the plane"); + { + GuestAllocations::Mutation mutation; + mutation.Unmap(plane, Block, [](const void*, std::size_t, const void*, bool) {}); + mutation.Add(plane, Block, true, true, true); + } + FillUnit(plane, 0, 0.75f); + auto before = AgcDriver::Graphics::DepthPlaneStoreCounts(); + Require(!AgcDriver::Graphics::FlushDepthPlanes(base, PlaneBytes).empty(), "a read of a plane whose first unit was unmapped and mapped again stored none of its other units"); + device->WaitIdle(); + Require(Since(before).units == Units - 1u, "a read of a plane whose first unit was unmapped and mapped again did not store exactly its other units"); + RequireUnit(plane, 0, 0.75f, UnitTexels, "after a read of a plane whose first unit was unmapped and mapped again, that unit"); + for (std::size_t unit = 1; unit < Units; ++unit) RequireUnit(plane, unit, 0.5f, Texels(unit), "after a read of a plane whose first unit was unmapped and mapped again, a unit that was not unmapped"); + std::puts("depth plane partial store tests passed (partially unmapped plane)"); + return 0; + } + + if (argc == 2 && std::string_view(argv[1]) == "--unmapped-plane-fill") { + Fill(plane, 1.0f); + Require(draw(depth, writeHalf) == PlaneTexels, "the draw writing depth 0.5 before a pending depth fill did not cover the plane"); + AgcDriver::Graphics::NoteDepthMetadataFill(base, PlaneBytes, 0x3e800000u); + { + GuestAllocations::Mutation mutation; + mutation.Remove(blocks); + mutation.Add(blocks, Block + PlaneBytes, true, true, true); + } + FillUnit(plane, 0, 0.75f); + auto before = AgcDriver::Graphics::DepthPlaneStoreCounts(); + Require(AgcDriver::Graphics::FlushDepthPlanes(base, PlaneBytes).empty(), "a read of a plane unmapped and mapped again after a depth fill stored the fill recorded before the unmap"); + device->WaitIdle(); + Require(Since(before).stores == 0, "a read of a plane unmapped and mapped again after a depth fill counted a store"); + RequireUnit(plane, 0, 0.75f, UnitTexels, "after a read of a plane unmapped and mapped again after a depth fill, the unit the CPU wrote"); + for (std::size_t unit = 1; unit < Units; ++unit) RequireUnit(plane, unit, 1.0f, UnitTexels, "after a read of a plane unmapped and mapped again after a depth fill, a unit the CPU did not write"); + std::puts("depth plane partial store tests passed (unmapped plane with a pending fill)"); + return 0; + } + if (argc == 2 && std::string_view(argv[1]) == "--unmapped-plane") { Fill(plane, 1.0f); Require(draw(depth, writeHalf) == PlaneTexels, "the draw writing depth 0.5 before the unmap did not cover the plane");