2019-08-06 18:24:07 +02:00
|
|
|
// Copyright 2019 Citra Emulator Project
|
|
|
|
// Licensed under GPLv2 or any later version
|
|
|
|
// Refer to the license.txt file included.
|
|
|
|
|
2019-08-14 07:04:50 +02:00
|
|
|
#include "core/custom_tex_cache.h"
|
2019-08-06 14:43:24 +02:00
|
|
|
|
|
|
|
namespace Core {
|
2019-08-07 04:56:56 +02:00
|
|
|
CustomTexCache::CustomTexCache() = default;
|
2019-08-06 18:24:07 +02:00
|
|
|
|
2019-08-07 04:56:56 +02:00
|
|
|
CustomTexCache::~CustomTexCache() = default;
|
2019-08-06 18:24:07 +02:00
|
|
|
|
|
|
|
bool CustomTexCache::IsTextureDumped(u64 hash) const {
|
2019-08-14 07:04:50 +02:00
|
|
|
return dumped_textures.count(hash);
|
2019-08-06 14:43:24 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void CustomTexCache::SetTextureDumped(const u64 hash) {
|
2019-08-14 07:04:50 +02:00
|
|
|
dumped_textures.insert(hash);
|
2019-08-06 14:43:24 +02:00
|
|
|
}
|
|
|
|
|
2019-08-06 18:24:07 +02:00
|
|
|
bool CustomTexCache::IsTextureCached(u64 hash) const {
|
2019-08-14 07:04:50 +02:00
|
|
|
return custom_textures.count(hash);
|
2019-08-06 14:43:24 +02:00
|
|
|
}
|
|
|
|
|
2019-08-14 07:04:50 +02:00
|
|
|
const CustomTexInfo& CustomTexCache::LookupTexture(u64 hash) const {
|
2019-08-06 14:43:24 +02:00
|
|
|
return custom_textures.at(hash);
|
|
|
|
}
|
|
|
|
|
2019-08-07 20:26:25 +02:00
|
|
|
void CustomTexCache::CacheTexture(u64 hash, const std::vector<u8>& tex, u32 width, u32 height) {
|
2019-08-06 14:43:24 +02:00
|
|
|
custom_textures[hash] = {width, height, tex};
|
|
|
|
}
|
2019-08-07 20:26:25 +02:00
|
|
|
} // namespace Core
|