mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-11-29 17:23:40 +01:00
Some code moving, tweaks
This commit is contained in:
1 parent
a4b5641f11
commit
aaa83897fe
2 files changed
+32
-32
No files matched your search
@@ -84,6 +84,36 @@ private:
|
||||
LimitedWaitable *waitable_;
|
||||
};
|
||||
|
||||
ReplacedTexture::~ReplacedTexture() {
|
||||
if (threadWaitable_) {
|
||||
SetState(ReplacementState::CANCEL_INIT);
|
||||
|
||||
std::unique_lock<std::mutex> lock(mutex_);
|
||||
threadWaitable_->WaitAndRelease();
|
||||
threadWaitable_ = nullptr;
|
||||
}
|
||||
|
||||
for (auto &level : levels_) {
|
||||
vfs_->ReleaseFile(level.fileRef);
|
||||
level.fileRef = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void ReplacedTexture::PurgeIfOlder(double t) {
|
||||
if (threadWaitable_ && !threadWaitable_->WaitFor(0.0))
|
||||
return;
|
||||
if (lastUsed_ >= t)
|
||||
return;
|
||||
|
||||
if (levelData_->lastUsed < t) {
|
||||
// We have to lock since multiple textures might reference this same data.
|
||||
std::lock_guard<std::mutex> guard(levelData_->lock);
|
||||
levelData_->data.clear();
|
||||
// This means we have to reload. If we never purge any, there's no need.
|
||||
SetState(ReplacementState::POPULATED);
|
||||
}
|
||||
}
|
||||
|
||||
// This can only return true if ACTIVE or NOT_FOUND.
|
||||
bool ReplacedTexture::IsReady(double budget) {
|
||||
_assert_(vfs_ != nullptr);
|
||||
@@ -476,36 +506,6 @@ bool ReplacedTexture::LoadLevelData(ReplacedTextureLevel &level, int mipLevel, D
|
||||
return true;
|
||||
}
|
||||
|
||||
void ReplacedTexture::PurgeIfOlder(double t) {
|
||||
if (threadWaitable_ && !threadWaitable_->WaitFor(0.0))
|
||||
return;
|
||||
if (lastUsed_ >= t)
|
||||
return;
|
||||
|
||||
if (levelData_->lastUsed < t) {
|
||||
// We have to lock since multiple textures might reference this same data.
|
||||
std::lock_guard<std::mutex> guard(levelData_->lock);
|
||||
levelData_->data.clear();
|
||||
// This means we have to reload. If we never purge any, there's no need.
|
||||
SetState(ReplacementState::POPULATED);
|
||||
}
|
||||
}
|
||||
|
||||
ReplacedTexture::~ReplacedTexture() {
|
||||
if (threadWaitable_) {
|
||||
SetState(ReplacementState::CANCEL_INIT);
|
||||
|
||||
std::unique_lock<std::mutex> lock(mutex_);
|
||||
threadWaitable_->WaitAndRelease();
|
||||
threadWaitable_ = nullptr;
|
||||
}
|
||||
|
||||
for (auto &level : levels_) {
|
||||
vfs_->ReleaseFile(level.fileRef);
|
||||
level.fileRef = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
bool ReplacedTexture::CopyLevelTo(int level, void *out, int rowPitch) {
|
||||
_assert_msg_((size_t)level < levels_.size(), "Invalid miplevel");
|
||||
_assert_msg_(out != nullptr && rowPitch > 0, "Invalid out/pitch");
|
||||
|
||||
+2
-2
@@ -559,8 +559,8 @@ void SystemInfoScreen::CreateViews() {
|
||||
// Simple non-detailed summary of supported tex compression formats.
|
||||
if (draw->GetDataFormatSupport(Draw::DataFormat::ETC2_R8G8B8_UNORM_BLOCK)) texCompressionFormats += "ETC2 ";
|
||||
if (draw->GetDataFormatSupport(Draw::DataFormat::ASTC_4x4_UNORM_BLOCK)) texCompressionFormats += "ASTC ";
|
||||
if (draw->GetDataFormatSupport(Draw::DataFormat::BC1_RGBA_UNORM_BLOCK)) texCompressionFormats += "BC1,2,3 ";
|
||||
if (draw->GetDataFormatSupport(Draw::DataFormat::BC4_UNORM_BLOCK)) texCompressionFormats += "BC4,5 ";
|
||||
if (draw->GetDataFormatSupport(Draw::DataFormat::BC1_RGBA_UNORM_BLOCK)) texCompressionFormats += "BC1-3 ";
|
||||
if (draw->GetDataFormatSupport(Draw::DataFormat::BC4_UNORM_BLOCK)) texCompressionFormats += "BC4-5 ";
|
||||
if (draw->GetDataFormatSupport(Draw::DataFormat::BC7_UNORM_BLOCK)) texCompressionFormats += "BC7 ";
|
||||
deviceSpecs->Add(new InfoItem(si->T("Compressed texture formats"), texCompressionFormats));
|
||||
|
||||
|
||||
Reference in new issue
Block a user