Merge pull request #19534 from hrydgard/more-various-fixes
Some checks failed
Build / build-windows (ARM64) (push) Has been cancelled
Build / build-windows (x64) (push) Has been cancelled
Build / build-uwp (push) Has been cancelled
Build / build (./b.sh --headless --unittest --fat --no-png --no-sdl2, clang, clang++, test, macos, macos-latest) (push) Has been cancelled
Build / build (./b.sh --headless --unittest, clang, clang++, test, clang-normal, ubuntu-latest) (push) Has been cancelled
Build / build (./b.sh --headless --unittest, gcc, g++, gcc-normal, ubuntu-latest) (push) Has been cancelled
Build / build (./b.sh --ios, clang, clang++, ios, ios, macos-latest) (push) Has been cancelled
Build / build (./b.sh --libretro_android ppsspp_libretro, clang, clang++, android, android-libretro, ubuntu-latest) (push) Has been cancelled
Build / build (./b.sh --qt, gcc, g++, qt, qt, ubuntu-latest) (push) Has been cancelled
Build / build (cd android && ./ab.sh -j2 APP_ABI=arm64-v8a OPENXR=1, clang, clang++, android, android-vr, ubuntu-latest) (push) Has been cancelled
Build / build (cd android && ./ab.sh -j2 APP_ABI=arm64-v8a UNITTEST=1 HEADLESS=1, clang, clang++, android, android-arm64, ubuntu-latest) (push) Has been cancelled
Build / build (cd android && ./ab.sh -j2 APP_ABI=armeabi-v7a UNITTEST=1 HEADLESS=1, clang, clang++, android, android-arm32, ubuntu-latest) (push) Has been cancelled
Build / build (cd android && ./ab.sh -j2 APP_ABI=x86_64 UNITTEST=1 HEADLESS=1, clang, clang++, android, android-x86_64, ubuntu-latest) (push) Has been cancelled
Build / build (make -C libretro -f Makefile -j2, clang, clang++, libretro, clang-libretro, ubuntu-latest) (push) Has been cancelled
Build / build (make -C libretro -f Makefile -j2, gcc, g++, libretro, gcc-libretro, ubuntu-latest) (push) Has been cancelled
Build / build_test_headless_alpine (push) Has been cancelled
Generate Docker Layer / build (push) Has been cancelled
Build / test-windows (push) Has been cancelled
Build / test (macos-latest) (push) Has been cancelled
Build / test (ubuntu-latest) (push) Has been cancelled

More various fixes
This commit is contained in:
Henrik Rydgård 2024-10-17 23:27:07 +02:00 committed by GitHub
commit a7e7b9161a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
14 changed files with 51 additions and 24 deletions

View File

@ -290,6 +290,10 @@ public:
compileMutex_.unlock();
}
void AssertInRenderPass() const {
_dbg_assert_(curRenderStep_ && curRenderStep_->stepType == VKRStepType::RENDER);
}
// This is the first call in a draw operation. Instead of asserting like we used to, you can now check the
// return value and skip the draw if we're in a bad state. In that case, call ReportBadState.
// The old assert wasn't very helpful in figuring out what caused it anyway...

View File

@ -534,6 +534,7 @@ void DrawBuffer::MeasureTextRect(FontID font_id, std::string_view text, const Bo
std::string toMeasure = std::string(text);
AtlasWordWrapper wrapper(*font, fontscalex, toMeasure, bounds.w, wrap);
toMeasure = wrapper.Wrapped();
MeasureText(font_id, toMeasure, w, h);
} else {
MeasureText(font_id, text, w, h);
}
@ -592,7 +593,7 @@ void DrawBuffer::DrawTextRect(FontID font, std::string_view text, float x, float
// This allows each line to be horizontally centered by itself.
for (const std::string &line : lines) {
DrawText(font, line.c_str(), x, baseY, color, align);
DrawText(font, line, x, baseY, color, align);
float tw, th;
MeasureText(font, line, &tw, &th);

View File

@ -539,10 +539,10 @@ void PSPSaveDialog::DisplaySaveDataInfo1() {
titleStyle.color = CalcFadedColor(0xFFC0C0C0);
PPGeStyle textStyle = FadedStyle(PPGeAlign::BOX_LEFT, 0.5f);
PPGeDrawText(titleTxt.c_str(), 180, 136, titleStyle);
PPGeDrawText(timeTxt.c_str(), 180, 137, textStyle);
PPGeDrawText(saveTitleTxt.c_str(), 175, 159, saveTitleStyle);
PPGeDrawTextWrapped(saveDetailTxt.c_str(), 175, 181, 480 - 175, 250 - 181, textStyle);
PPGeDrawText(titleTxt, 180, 136, titleStyle);
PPGeDrawText(timeTxt, 180, 137, textStyle);
PPGeDrawText(saveTitleTxt, 175, 159, saveTitleStyle);
PPGeDrawTextWrapped(saveDetailTxt, 175, 181, 480 - 175, 250 - 181, textStyle);
}
}

View File

@ -913,25 +913,26 @@ namespace SaveState
return Status::SUCCESS;
}
void Process()
{
// NOTE: This can cause ending of the current renderpass, due to the readback needed for the screenshot.
bool Process() {
rewindStates.Process();
if (!needsProcess)
return;
return false;
needsProcess = false;
if (!__KernelIsRunning())
{
ERROR_LOG(Log::SaveState, "Savestate failure: Unable to load without kernel, this should never happen.");
return;
return false;
}
std::vector<Operation> operations = Flush();
SaveStart state;
for (size_t i = 0, n = operations.size(); i < n; ++i)
{
bool readbackImage = false;
for (size_t i = 0, n = operations.size(); i < n; ++i) {
Operation &op = operations[i];
CChunkFileReader::Error result;
Status callbackResult;
@ -984,7 +985,7 @@ namespace SaveState
break;
case SAVESTATE_SAVE:
INFO_LOG(Log::SaveState, "Saving state to %s", op.filename.c_str());
INFO_LOG(Log::SaveState, "Saving state to '%s'", op.filename.c_str());
title = g_paramSFO.GetValueString("TITLE");
if (title.empty()) {
// Homebrew title
@ -1068,6 +1069,7 @@ namespace SaveState
} else {
screenshotFailures = 0;
}
readbackImage = true;
break;
}
default:
@ -1083,6 +1085,8 @@ namespace SaveState
// Avoid triggering frame skipping due to slowdown
__DisplaySetWasPaused();
}
return readbackImage;
}
void NotifySaveData() {

View File

@ -104,7 +104,7 @@ namespace SaveState
bool IsOldVersion();
// Check if there's any save stating needing to be done. Normally called once per frame.
void Process();
bool Process();
// Notify save state code that new save data has been written.
void NotifySaveData();

View File

@ -623,7 +623,6 @@ void PSP_RunLoopWhileState() {
}
void PSP_RunLoopUntil(u64 globalticks) {
SaveState::Process();
if (coreState == CORE_POWERDOWN || coreState == CORE_BOOT_ERROR || coreState == CORE_RUNTIME_ERROR) {
return;
} else if (coreState == CORE_STEPPING) {

View File

@ -147,6 +147,10 @@ public:
virtual void ClearTrackedVertexArrays() {}
void AssertEmpty() {
_dbg_assert_(numDrawVerts_ == 0 && numDrawInds_ == 0);
}
protected:
virtual bool UpdateUseHWTessellation(bool enabled) const { return enabled; }
void UpdatePlanes();

View File

@ -628,6 +628,7 @@ void SoftGPU::CopyToCurrentFboFromDisplayRam(int srcwidth, int srcheight) {
}
if (!hasImage) {
draw_->BindFramebufferAsRenderTarget(nullptr, { Draw::RPAction::CLEAR, Draw::RPAction::DONT_CARE, Draw::RPAction::DONT_CARE }, "CopyToCurrentFboFromDisplayRam");
presentation_->NotifyPresent();
return;
}

View File

@ -92,7 +92,7 @@ void DrawGPUMemoryVis(UIContext *ui, GPUInterface *gpu) {
int y = starty;
ui->SetFontScale(0.7f, 0.7f);
ui->DrawTextShadow(str.str().c_str(), x, y, 0xFFFFFFFF, FLAG_DYNAMIC_ASCII);
ui->DrawTextShadow(str.str(), x, y, 0xFFFFFFFF, FLAG_DYNAMIC_ASCII);
ui->SetFontScale(1.0f, 1.0f);
ui->Flush();
}
@ -115,7 +115,7 @@ void DrawGPUProfilerVis(UIContext *ui, GPUInterface *gpu) {
std::string text = ui->GetDrawContext()->GetGpuProfileString();
ui->SetFontScale(0.4f, 0.4f);
ui->DrawTextShadow(text.c_str(), x, y, 0xFFFFFFFF, FLAG_DYNAMIC_ASCII);
ui->DrawTextShadow(text, x, y, 0xFFFFFFFF, FLAG_DYNAMIC_ASCII);
ui->SetFontScale(1.0f, 1.0f);
ui->Flush();
}

View File

@ -174,11 +174,15 @@ void DrawEngineVulkan::BeginFrame() {
tessDataTransferVulkan->SetPushPool(pushUBO_);
DirtyAllUBOs();
AssertEmpty();
}
void DrawEngineVulkan::EndFrame() {
stats_.pushVertexSpaceUsed = (int)pushVertex_->GetUsedThisFrame();
stats_.pushIndexSpaceUsed = (int)pushIndex_->GetUsedThisFrame();
AssertEmpty();
}
void DrawEngineVulkan::DirtyAllUBOs() {
@ -212,6 +216,8 @@ void DrawEngineVulkan::Invalidate(InvalidationCallbackFlags flags) {
void DrawEngineVulkan::DoFlush() {
VulkanRenderManager *renderManager = (VulkanRenderManager *)draw_->GetNativeObject(Draw::NativeObject::RENDER_MANAGER);
renderManager->AssertInRenderPass();
PROFILE_THIS_SCOPE("Flush");
bool tess = gstate_c.submitType == SubmitType::HW_BEZIER || gstate_c.submitType == SubmitType::HW_SPLINE;

View File

@ -1369,6 +1369,9 @@ ScreenRenderFlags EmuScreen::render(ScreenRenderMode mode) {
framebufferBound = true;
}
draw->SetTargetSize(g_display.pixel_xres, g_display.pixel_yres);
} else {
// Some other screen bound the backbuffer first.
framebufferBound = true;
}
g_OSD.NudgeSidebar();
@ -1376,6 +1379,7 @@ ScreenRenderFlags EmuScreen::render(ScreenRenderMode mode) {
if (mode & ScreenRenderMode::TOP) {
System_Notify(SystemNotification::KEEP_SCREEN_AWAKE);
} else if (!Core_ShouldRunBehind() && strcmp(screenManager()->topScreen()->tag(), "DevMenu") != 0) {
// NOTE: The strcmp is != 0 - so all popped-over screens EXCEPT DevMenu
// Just to make sure.
if (PSP_IsInited() && !skipBufferEffects) {
_dbg_assert_(gpu);
@ -1383,7 +1387,10 @@ ScreenRenderFlags EmuScreen::render(ScreenRenderMode mode) {
gpu->CopyDisplayToOutput(true);
PSP_EndHostFrame();
}
if (!framebufferBound && (!gpu || !gpu->PresentedThisFrame())) {
if (gpu->PresentedThisFrame()) {
framebufferBound = true;
}
if (!framebufferBound) {
draw->BindFramebufferAsRenderTarget(nullptr, { RPAction::CLEAR, RPAction::CLEAR, RPAction::CLEAR, }, "EmuScreen_Behind");
}
// Need to make sure the UI texture is available, for "darken".
@ -1445,6 +1452,12 @@ ScreenRenderFlags EmuScreen::render(ScreenRenderMode mode) {
uint32_t clearColor = 0;
if (!blockedExecution) {
PSP_BeginHostFrame();
if (SaveState::Process()) {
// We might have lost the framebuffer bind if we had one, due to a readback.
if (framebufferBound) {
draw->BindFramebufferAsRenderTarget(nullptr, { RPAction::CLEAR, RPAction::CLEAR, RPAction::CLEAR, clearColor }, "EmuScreen_SavestateRebind");
}
}
PSP_RunLoopWhileState();
flags |= ScreenRenderFlags::HANDLED_THROTTLING;
@ -1486,10 +1499,6 @@ ScreenRenderFlags EmuScreen::render(ScreenRenderMode mode) {
break;
}
if (framebufferBound && gpu) {
gpu->PresentedThisFrame();
}
PSP_EndHostFrame();
// This place rougly matches how libretro handles it (after retro_frame).

View File

@ -785,7 +785,7 @@ void LogoScreen::DrawForeground(UIContext &dc) {
// Add some emoji for testing.
apiName += CodepointToUTF8(0x1F41B) + CodepointToUTF8(0x1F41C) + CodepointToUTF8(0x1F914);
#endif
dc.DrawText(gr->T_cstr(apiName.c_str()), bounds.centerX(), ppsspp_org_y + 50, textColor, ALIGN_CENTER);
dc.DrawText(gr->T(apiName.c_str()), bounds.centerX(), ppsspp_org_y + 50, textColor, ALIGN_CENTER);
#endif
dc.Flush();

View File

@ -96,7 +96,6 @@ void SavedataView::UpdateGame(GameInfo *ginfo) {
if (!ginfo->Ready(GameInfoFlags::PARAM_SFO | GameInfoFlags::SIZE)) {
return;
}
_dbg_assert_(savedataTitle_);
if (savedataTitle_) {
savedataTitle_->SetText(ginfo->GetParamSFO().GetValueString("SAVEDATA_TITLE"));
}

View File

@ -5,7 +5,7 @@ buildscript {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:8.7.0'
classpath 'com.android.tools.build:gradle:8.7.1'
}
}