Fix possible framebuffer binding bug in EmuScreen

This commit is contained in:
Henrik Rydgård 2024-10-02 00:58:50 +02:00
parent 144f2884bc
commit 3d31b4ac4c
3 changed files with 9 additions and 1 deletions

View File

@ -106,6 +106,7 @@ public:
} }
void NotifyPresent() { void NotifyPresent() {
// Something else did the present, skipping PresentationCommon. // Something else did the present, skipping PresentationCommon.
// If you haven't called BindFramebufferAsRenderTarget, you must not set this.
presentedThisFrame_ = true; presentedThisFrame_ = true;
} }

View File

@ -199,6 +199,8 @@ inline uint32_t RoundUpTo4(uint32_t value) {
} }
void ReplacedTexture::Prepare(VFSBackend *vfs) { void ReplacedTexture::Prepare(VFSBackend *vfs) {
_assert_(vfs != nullptr);
this->vfs_ = vfs; this->vfs_ = vfs;
std::unique_lock<std::mutex> lock(lock_); std::unique_lock<std::mutex> lock(lock_);
@ -295,6 +297,11 @@ ReplacedTexture::LoadLevelResult ReplacedTexture::LoadLevelData(VFSFileReference
data_.resize(mipLevel + 1); data_.resize(mipLevel + 1);
} }
if (!vfs_) {
ERROR_LOG(Log::G3D, "Unexpected null vfs_ pointer in LoadLevelData");
return LoadLevelResult::LOAD_ERROR;
}
ReplacedTextureLevel level; ReplacedTextureLevel level;
size_t fileSize; size_t fileSize;
VFSOpenFile *openFile = vfs_->OpenFileForRead(fileRef, &fileSize); VFSOpenFile *openFile = vfs_->OpenFileForRead(fileRef, &fileSize);

View File

@ -1464,8 +1464,8 @@ ScreenRenderFlags EmuScreen::render(ScreenRenderMode mode) {
if (!framebufferBound && PSP_IsInited()) { if (!framebufferBound && PSP_IsInited()) {
// draw->BindFramebufferAsRenderTarget(nullptr, { RPAction::CLEAR, RPAction::CLEAR, RPAction::CLEAR, clearColor }, "EmuScreen_Stepping"); // draw->BindFramebufferAsRenderTarget(nullptr, { RPAction::CLEAR, RPAction::CLEAR, RPAction::CLEAR, clearColor }, "EmuScreen_Stepping");
gpu->CopyDisplayToOutput(true); gpu->CopyDisplayToOutput(true);
framebufferBound = true;
} }
framebufferBound = true;
} }
break; break;
} }