mirror of
https://github.com/boykopovar/AnyPS5.git
synced 2026-10-27 00:28:14 +00:00
Merge pull request #10174 from ntamas94/fix/agc-raw-shader-cache-eviction
fix(agc): keep hundreds of raw shader snapshots cached
This commit is contained in:
2 files changed
+6
-2
No files matched your search
@@ -138,7 +138,7 @@ std::shared_ptr<const ShaderSnapshot> ReadRawShader(std::uint64_t address) {
|
||||
cache.erase(found);
|
||||
}
|
||||
const auto bytes = result->code.size() * sizeof(std::uint32_t);
|
||||
while (!cache.empty() && (cache.size() >= 64 || cacheBytes + bytes > 8 * 1024 * 1024)) {
|
||||
while (!cache.empty() && (cache.size() >= 4096 || cacheBytes + bytes > 64 * 1024 * 1024)) {
|
||||
cacheBytes -= cache.back()->code.size() * sizeof(std::uint32_t);
|
||||
cache.pop_back();
|
||||
}
|
||||
|
||||
@@ -952,7 +952,8 @@ int main(int argc, char** argv) {
|
||||
});
|
||||
for (auto& reader : readers) reader.join();
|
||||
for (const auto& snapshot : concurrent) check(snapshot == branched, "concurrent raw compute readers lost snapshot reuse");
|
||||
alignas(256) std::array<std::array<std::uint32_t, 64>, 65> programs{};
|
||||
struct alignas(256) RawProgram : std::array<std::uint32_t, 64> {};
|
||||
std::vector<RawProgram> programs(4097);
|
||||
for (auto& program : programs) program[0] = 0xbf810000;
|
||||
const auto firstAddress = reinterpret_cast<std::uintptr_t>(programs.front().data());
|
||||
readers.clear();
|
||||
@@ -962,6 +963,9 @@ int main(int argc, char** argv) {
|
||||
for (auto& reader : readers) reader.join();
|
||||
for (const auto& snapshot : concurrent) check(snapshot == concurrent.front(), "concurrent raw compute misses duplicated snapshots");
|
||||
const auto evicted = AgcDriver::DriverDetail::ReadRawShader(firstAddress);
|
||||
for (std::size_t i = 1; i <= 400; ++i)
|
||||
AgcDriver::DriverDetail::ReadRawShader(reinterpret_cast<std::uintptr_t>(programs[i].data()));
|
||||
check(AgcDriver::DriverDetail::ReadRawShader(firstAddress) == evicted, "raw shader cache evicted a program while a title used only 401");
|
||||
for (std::size_t i = 1; i < programs.size(); ++i)
|
||||
AgcDriver::DriverDetail::ReadRawShader(reinterpret_cast<std::uintptr_t>(programs[i].data()));
|
||||
check(AgcDriver::DriverDetail::ReadRawShader(firstAddress) != evicted && evicted->code[0] == 0xbf810000,
|
||||
|
||||
Reference in new issue
Block a user