Texture Cache: Fix GCC & Clang.

This commit is contained in:
Fernando Sahmkow 2021-06-20 19:14:40 +02:00
parent 8f9f142956
commit a8a0927d42
2 changed files with 11 additions and 11 deletions

View file

@ -29,10 +29,10 @@ enum class ImageFlagBits : u32 {
Sparse = 1 << 9, ///< Image has non continous submemory.
// Garbage Collection Flags
BadOverlap = 1 << 10,///< This image overlaps other but doesn't fit, has higher
///< garbage collection priority
Alias = 1 << 11, ///< This image has aliases and has priority on garbage
///< collection
BadOverlap = 1 << 10, ///< This image overlaps other but doesn't fit, has higher
///< garbage collection priority
Alias = 1 << 11, ///< This image has aliases and has priority on garbage
///< collection
};
DECLARE_ENUM_FLAG_OPERATORS(ImageFlagBits)

View file

@ -495,7 +495,7 @@ void TextureCache<P>::RunGarbageCollector() {
}
}
if (True(image->flags & ImageFlagBits::Tracked)) {
UntrackImage(*image);
UntrackImage(*image, image_id);
}
UnregisterImage(image_id);
DeleteImage(image_id);
@ -1474,16 +1474,16 @@ template <class P>
template <typename Func>
void TextureCache<P>::ForEachSparseSegment(ImageBase& image, Func&& func) {
using FuncReturn = typename std::invoke_result<Func, GPUVAddr, VAddr, size_t>::type;
static constexpr bool BOOL_BREAK = std::is_same_v<FuncReturn, bool>;
static constexpr bool RETURNS_BOOL = std::is_same_v<FuncReturn, bool>;
const auto segments = gpu_memory.GetSubmappedRange(image.gpu_addr, image.guest_size_bytes);
for (auto& segment : segments) {
const auto gpu_addr = segment.first;
const auto size = segment.second;
std::optional<VAddr> cpu_addr = gpu_memory.GpuToCpuAddress(gpu_addr);
ASSERT(cpu_addr);
if constexpr (BOOL_BREAK) {
if constexpr (RETURNS_BOOL) {
if (func(gpu_addr, *cpu_addr, size)) {
return true;
break;
}
} else {
func(gpu_addr, *cpu_addr, size);
@ -1599,9 +1599,9 @@ void TextureCache<P>::UnregisterImage(ImageId image_id) {
ASSERT(it != sparse_views.end());
auto& sparse_maps = it->second;
for (auto& map_view_id : sparse_maps) {
const auto& map = slot_map_views[map_view_id];
const VAddr cpu_addr = map.cpu_addr;
const std::size_t size = map.size;
const auto& map_range = slot_map_views[map_view_id];
const VAddr cpu_addr = map_range.cpu_addr;
const std::size_t size = map_range.size;
ForEachCPUPage(cpu_addr, size, [this, image_id](u64 page) {
const auto page_it = page_table.find(page);
if (page_it == page_table.end()) {