Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion core/libs/prx/libSceAgcDriver/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -851,8 +851,10 @@ if(BUILD_TESTING)
set_tests_properties(agc_multisample_guest_access PROPERTIES SKIP_RETURN_CODE 77)
add_test(NAME agc_draw_inputs_in_place COMMAND agc_driver_recorder_tests --draw-inputs-in-place-only)
set_tests_properties(agc_draw_inputs_in_place PROPERTIES SKIP_RETURN_CODE 77)
add_test(NAME agc_pending_key_stores COMMAND agc_driver_recorder_tests --pending-key-stores-only)
set_tests_properties(agc_pending_key_stores PROPERTIES SKIP_RETURN_CODE 77)
if(WIN32)
set_tests_properties(agc_host_import_unmap agc_parked_import_unmap agc_unit_shadow agc_descriptor_pool_recycling agc_draw_snapshot_cap agc_multisample_guest_access agc_draw_inputs_in_place PROPERTIES ENVIRONMENT_MODIFICATION
set_tests_properties(agc_host_import_unmap agc_parked_import_unmap agc_unit_shadow agc_descriptor_pool_recycling agc_draw_snapshot_cap agc_multisample_guest_access agc_draw_inputs_in_place agc_pending_key_stores PROPERTIES ENVIRONMENT_MODIFICATION
"PATH=path_list_prepend:$<TARGET_FILE_DIR:libc>")
endif()
endif()
Expand Down
4 changes: 3 additions & 1 deletion core/libs/prx/libSceAgcDriver/Graphics/src/DccMetadata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -445,10 +445,12 @@ DccKeys readDccKeys(std::uint64_t metaAddress, std::size_t count, bool& memoized
return uniform ? ByteKeys(first) : DccKeys::Mixed;
}

DccKeys currentDccKeys(std::uint64_t metaAddress, std::size_t count, bool& memoized);

DccKeys textureClearKeys(const GuestTextureResource& resource, std::uint64_t guestBytes, bool& memoized) {
memoized = false;
if (resource.dccAddress == 0) return DccKeys::Uncompressed;
const auto keys = readDccKeys(resource.dccAddress, DccKeyBytes(guestBytes), memoized);
const auto keys = currentDccKeys(resource.dccAddress, DccKeyBytes(guestBytes), memoized);
if (keys == DccKeys::Uncompressed) return keys;
if (IsConvertedTextureFormat(resource.format) && (keys == DccKeys::Clear0001 || keys == DccKeys::Clear1110)) throw std::runtime_error(std::string("AGC graphics: DCC clear code ") + DccKeysName(keys) + " of converted texture format " + std::to_string(resource.format) + " is not implemented");
std::byte probe[16]{};
Expand Down
24 changes: 24 additions & 0 deletions core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4122,6 +4122,25 @@ void pendingKeyStoreTests(const Device& device, Recorder& recorder) {
Require(CurrentDccKeys(address, displayBytes, displayKeys) == DccKeys::Uncompressed && !recorder.PendingWriteOverlaps(address + 40000, 1), "a later writer of key 40000 over a pending 1920x1080 store was not waited for");
Require(std::all_of(keys, keys + consoleKeys, [](std::uint8_t key) { return key == 0xff; }), "the uncompressed key store over a 1920x1080 surface did not land on all 49152 keys");
recorder.Sync();
std::memset(keys, 0x00, keyCount);
const auto* import = HostImportFor(context, address, bytes);
Require(import != nullptr, "the pending key store block lost its host import");
const auto commands = recorder.Commands();
RecordMemoryBarrier(context, commands, VK_PIPELINE_STAGE_ALL_COMMANDS_BIT | VK_PIPELINE_STAGE_HOST_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT, VK_ACCESS_HOST_WRITE_BIT | VK_ACCESS_TRANSFER_WRITE_BIT, VK_ACCESS_TRANSFER_WRITE_BIT);
context.Function<PFN_vkCmdFillBuffer>("vkCmdFillBuffer")(commands, import->buffer, address - import->base, keyCount, 0x40404040u);
RecordMemoryBarrier(context, commands, VK_PIPELINE_STAGE_TRANSFER_BIT, VK_PIPELINE_STAGE_HOST_BIT, VK_ACCESS_TRANSFER_WRITE_BIT, VK_ACCESS_HOST_READ_BIT);
recorder.NotePendingWrite(address, keyCount);
GuestTextureResource sampled{};
sampled.baseAddress = address + keyCount;
sampled.width = 128;
sampled.height = 128;
sampled.mipCount = 1;
sampled.tileMode = TextureTileMode::kLinear;
sampled.dimension = TextureDimension::k2D;
sampled.format = 56;
sampled.dccAddress = address;
Require(TextureClearKeys(sampled, surfaceBytes) == DccKeys::Clear0001 && !recorder.PendingWriteOverlaps(address, keyCount), "a sampled texture read its DCC keys before the recorded GPU write over them landed");
recorder.Sync();
}

void sampleDumpTests(const Device& device, Recorder& recorder) {
Expand Down Expand Up @@ -5533,6 +5552,11 @@ int main(int argc, char** argv) {
std::cout << "Draw snapshot cap tests passed\n";
return 0;
}
if (argc == 2 && std::string_view(argv[1]) == "--pending-key-stores-only") {
pendingKeyStoreTests(device, recorder);
std::cout << "Pending DCC key store tests passed\n";
return 0;
}

readTrackingTests(device, recorder);
writeSettledTests(device, recorder);
Expand Down
Loading