test(agc): check a pending depth fill and a partial unmap against a remapped plane

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
JJenkxandClaude Opus 5.5 committed 2026-11-03 09:15:56 -05:00
1 parent 317296719d
commit ce8aaf32db
2 files changed
+53

No files matched your search

@@ -27,6 +27,20 @@ if(BUILD_TESTING)
set_tests_properties(agc_driver_depth_plane_unmapped_plane PROPERTIES ENVIRONMENT_MODIFICATION
"PATH=path_list_prepend:$<TARGET_FILE_DIR:libc>")
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:$<TARGET_FILE_DIR:libc>")
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:$<TARGET_FILE_DIR:libc>")
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()
@@ -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");