[GPU] Bottom screen stub

This commit is contained in:
wheremyfoodat 2023-06-13 22:47:01 +03:00
parent d32de77671
commit 8e90b8a103
6 changed files with 101 additions and 25 deletions

View file

@ -13,6 +13,7 @@
// Are concerned. We could overload the == operator, but that implies full equality
// Including equality of the allocated OpenGL resources, which we don't want
// - A "valid" member that tells us whether the function is still valid or not
// - A "location" member which tells us which location in 3DS memory this surface occupies
template <typename SurfaceType, size_t capacity>
class SurfaceCache {
// Vanilla std::optional can't hold actual references
@ -40,6 +41,15 @@ public:
return std::nullopt;
}
OptionalRef findFromAddress(u32 address) {
for (auto& e : buffer) {
if (e.location == address && e.valid)
return e;
}
return std::nullopt;
}
// Adds a surface object to the cache and returns it
SurfaceType& add(const SurfaceType& surface) {
if (size >= capacity) {