mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-23 21:39:52 +00:00
Merge pull request #16404 from hrydgard/transparent-pause-screen
Make the pause screen "transparent"
This commit is contained in:
commit
f67ef7ab99
@ -160,14 +160,7 @@ void GPU_D3D11::InitClear() {
|
||||
void GPU_D3D11::BeginHostFrame() {
|
||||
GPUCommon::BeginHostFrame();
|
||||
UpdateCmdInfo();
|
||||
if (resized_) {
|
||||
gstate_c.useFlags = CheckGPUFeatures();
|
||||
framebufferManager_->Resized();
|
||||
drawEngine_.NotifyConfigChanged();
|
||||
textureCache_->NotifyConfigChanged();
|
||||
shaderManagerD3D11_->DirtyLastShader();
|
||||
resized_ = false;
|
||||
}
|
||||
CheckResized();
|
||||
}
|
||||
|
||||
void GPU_D3D11::ReapplyGfxState() {
|
||||
|
@ -66,7 +66,7 @@ private:
|
||||
}
|
||||
// void ApplyDrawState(int prim);
|
||||
void CheckFlushOp(int cmd, u32 diff);
|
||||
void BuildReportingInfo();
|
||||
void BuildReportingInfo() override;
|
||||
|
||||
void InitClear() override;
|
||||
void BeginFrame() override;
|
||||
|
@ -150,14 +150,7 @@ void GPU_DX9::InitClear() {
|
||||
void GPU_DX9::BeginHostFrame() {
|
||||
GPUCommon::BeginHostFrame();
|
||||
UpdateCmdInfo();
|
||||
if (resized_) {
|
||||
gstate_c.useFlags = CheckGPUFeatures();
|
||||
framebufferManager_->Resized();
|
||||
drawEngine_.NotifyConfigChanged();
|
||||
textureCache_->NotifyConfigChanged();
|
||||
shaderManagerDX9_->DirtyShader();
|
||||
resized_ = false;
|
||||
}
|
||||
CheckResized();
|
||||
}
|
||||
|
||||
void GPU_DX9::ReapplyGfxState() {
|
||||
|
@ -63,7 +63,7 @@ private:
|
||||
drawEngine_.Flush();
|
||||
}
|
||||
void CheckFlushOp(int cmd, u32 diff);
|
||||
void BuildReportingInfo();
|
||||
void BuildReportingInfo() override;
|
||||
|
||||
void InitClear() override;
|
||||
void BeginFrame() override;
|
||||
|
@ -268,14 +268,7 @@ void GPU_GLES::InitClear() {
|
||||
void GPU_GLES::BeginHostFrame() {
|
||||
GPUCommon::BeginHostFrame();
|
||||
UpdateCmdInfo();
|
||||
if (resized_) {
|
||||
gstate_c.useFlags = CheckGPUFeatures();
|
||||
framebufferManager_->Resized();
|
||||
drawEngine_.NotifyConfigChanged();
|
||||
textureCache_->NotifyConfigChanged();
|
||||
shaderManagerGL_->DirtyShader();
|
||||
resized_ = false;
|
||||
}
|
||||
CheckResized();
|
||||
|
||||
drawEngine_.BeginFrame();
|
||||
}
|
||||
|
@ -73,7 +73,7 @@ private:
|
||||
drawEngine_.Flush();
|
||||
}
|
||||
void CheckFlushOp(int cmd, u32 diff);
|
||||
void BuildReportingInfo();
|
||||
void BuildReportingInfo() override;
|
||||
|
||||
void InitClear() override;
|
||||
void BeginFrame() override;
|
||||
|
@ -611,6 +611,20 @@ void GPUCommon::Resized() {
|
||||
resized_ = true;
|
||||
}
|
||||
|
||||
// Called once per frame. Might also get called during the pause screen
|
||||
// if "transparent".
|
||||
void GPUCommon::CheckResized() {
|
||||
if (resized_) {
|
||||
gstate_c.useFlags = CheckGPUFeatures();
|
||||
BuildReportingInfo();
|
||||
framebufferManager_->Resized();
|
||||
drawEngineCommon_->NotifyConfigChanged();
|
||||
textureCache_->NotifyConfigChanged();
|
||||
shaderManager_->DirtyLastShader();
|
||||
resized_ = false;
|
||||
}
|
||||
}
|
||||
|
||||
void GPUCommon::DumpNextFrame() {
|
||||
dumpNextFrame_ = true;
|
||||
}
|
||||
|
@ -77,6 +77,7 @@ public:
|
||||
return draw_;
|
||||
}
|
||||
virtual u32 CheckGPUFeatures() const;
|
||||
void CheckResized() override;
|
||||
|
||||
void UpdateCmdInfo();
|
||||
|
||||
@ -309,6 +310,8 @@ protected:
|
||||
|
||||
size_t FormatGPUStatsCommon(char *buf, size_t size);
|
||||
|
||||
virtual void BuildReportingInfo() = 0;
|
||||
|
||||
FramebufferManagerCommon *framebufferManager_ = nullptr;
|
||||
TextureCacheCommon *textureCache_ = nullptr;
|
||||
DrawEngineCommon *drawEngineCommon_ = nullptr;
|
||||
|
@ -197,6 +197,7 @@ public:
|
||||
// Frame managment
|
||||
virtual void BeginHostFrame() = 0;
|
||||
virtual void EndHostFrame() = 0;
|
||||
virtual void CheckResized() = 0;
|
||||
|
||||
// Draw queue management
|
||||
virtual DisplayList* getList(int listid) = 0;
|
||||
|
@ -205,6 +205,8 @@ protected:
|
||||
void CopyToCurrentFboFromDisplayRam(int srcwidth, int srcheight);
|
||||
void ConvertTextureDescFrom16(Draw::TextureDesc &desc, int srcwidth, int srcheight, const uint16_t *overrideData = nullptr);
|
||||
|
||||
void BuildReportingInfo() override {}
|
||||
|
||||
private:
|
||||
void MarkDirty(uint32_t addr, uint32_t stride, uint32_t height, GEBufferFormat fmt, SoftGPUVRAMDirty value);
|
||||
void MarkDirty(uint32_t addr, uint32_t bytes, SoftGPUVRAMDirty value);
|
||||
|
@ -275,15 +275,7 @@ void GPU_Vulkan::BeginHostFrame() {
|
||||
drawEngine_.BeginFrame();
|
||||
UpdateCmdInfo();
|
||||
|
||||
if (resized_) {
|
||||
gstate_c.useFlags = CheckGPUFeatures();
|
||||
// In case the GPU changed.
|
||||
BuildReportingInfo();
|
||||
framebufferManager_->Resized();
|
||||
drawEngine_.NotifyConfigChanged();
|
||||
textureCache_->NotifyConfigChanged();
|
||||
resized_ = false;
|
||||
}
|
||||
CheckResized();
|
||||
|
||||
textureCacheVulkan_->StartFrame();
|
||||
|
||||
|
@ -77,7 +77,7 @@ private:
|
||||
drawEngine_.Flush();
|
||||
}
|
||||
void CheckFlushOp(int cmd, u32 diff);
|
||||
void BuildReportingInfo();
|
||||
void BuildReportingInfo() override;
|
||||
void InitClear() override;
|
||||
void CopyDisplayToOutput(bool reallyDirty) override;
|
||||
void Reinitialize() override;
|
||||
|
@ -1105,7 +1105,6 @@ void EmuScreen::update() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void EmuScreen::checkPowerDown() {
|
||||
@ -1356,8 +1355,7 @@ void EmuScreen::preRender() {
|
||||
// We only bind it in FramebufferManager::CopyDisplayToOutput (unless non-buffered)...
|
||||
// We do, however, start the frame in other ways.
|
||||
|
||||
bool useBufferedRendering = !g_Config.bSkipBufferEffects;
|
||||
if ((!useBufferedRendering && !g_Config.bSoftwareRendering) || Core_IsStepping()) {
|
||||
if ((g_Config.bSkipBufferEffects && !g_Config.bSoftwareRendering) || Core_IsStepping()) {
|
||||
// We need to clear here already so that drawing during the frame is done on a clean slate.
|
||||
if (Core_IsStepping() && gpuStats.numFlips != 0) {
|
||||
draw->BindFramebufferAsRenderTarget(nullptr, { RPAction::KEEP, RPAction::DONT_CARE, RPAction::DONT_CARE }, "EmuScreen_BackBuffer");
|
||||
@ -1393,6 +1391,30 @@ void EmuScreen::render() {
|
||||
if (!thin3d)
|
||||
return; // shouldn't really happen but I've seen a suspicious stack trace..
|
||||
|
||||
// We can still render behind the pause screen.
|
||||
bool paused = screenManager()->topScreen() != this;
|
||||
|
||||
if (paused) {
|
||||
// If we're paused and PauseScreen is transparent (will only be in buffered rendering mode), we just copy display to output.
|
||||
thin3d->BindFramebufferAsRenderTarget(nullptr, { RPAction::CLEAR, RPAction::DONT_CARE, RPAction::DONT_CARE }, "EmuScreen_Paused");
|
||||
if (PSP_IsInited()) {
|
||||
gpu->CheckResized();
|
||||
gpu->CopyDisplayToOutput(true);
|
||||
}
|
||||
|
||||
screenManager()->getUIContext()->BeginFrame();
|
||||
DrawContext *draw = screenManager()->getDrawContext();
|
||||
Viewport viewport;
|
||||
viewport.TopLeftX = 0;
|
||||
viewport.TopLeftY = 0;
|
||||
viewport.Width = pixel_xres;
|
||||
viewport.Height = pixel_yres;
|
||||
viewport.MaxDepth = 1.0;
|
||||
viewport.MinDepth = 0.0;
|
||||
draw->SetViewports(1, &viewport);
|
||||
return;
|
||||
}
|
||||
|
||||
if (invalid_) {
|
||||
// Loading, or after shutdown?
|
||||
if (loadingTextView_->GetVisibility() == UI::V_VISIBLE)
|
||||
|
@ -364,6 +364,24 @@ GamePauseScreen::~GamePauseScreen() {
|
||||
__DisplaySetWasPaused();
|
||||
}
|
||||
|
||||
bool GamePauseScreen::isTransparent() const {
|
||||
// We don't support transparent pause screen in skipbuffereffects mode.
|
||||
return !g_Config.bSkipBufferEffects && !IsVREnabled();
|
||||
}
|
||||
|
||||
void GamePauseScreen::DrawBackground(UIContext &dc) {
|
||||
if (isTransparent()) {
|
||||
// Darken the game screen coming from below, so the UI on top stands out.
|
||||
dc.Flush();
|
||||
uint32_t color = blackAlpha(0.45f);
|
||||
dc.FillRect(UI::Drawable(color), dc.GetBounds());
|
||||
dc.Flush();
|
||||
return;
|
||||
}
|
||||
|
||||
UIDialogScreenWithGameBackground::DrawBackground(dc);
|
||||
}
|
||||
|
||||
void GamePauseScreen::CreateViews() {
|
||||
static const int NUM_SAVESLOTS = 5;
|
||||
|
||||
|
@ -31,15 +31,18 @@ public:
|
||||
GamePauseScreen(const Path &filename) : UIDialogScreenWithGameBackground(filename), gamePath_(filename) {}
|
||||
virtual ~GamePauseScreen();
|
||||
|
||||
virtual void dialogFinished(const Screen *dialog, DialogResult dr) override;
|
||||
void dialogFinished(const Screen *dialog, DialogResult dr) override;
|
||||
|
||||
const char *tag() const override { return "GamePause"; }
|
||||
|
||||
protected:
|
||||
virtual void CreateViews() override;
|
||||
virtual void update() override;
|
||||
void CreateViews() override;
|
||||
void update() override;
|
||||
void CallbackDeleteConfig(bool yes);
|
||||
|
||||
bool isTransparent() const override;
|
||||
void DrawBackground(UIContext &dc) override;
|
||||
|
||||
private:
|
||||
UI::EventReturn OnGameSettings(UI::EventParams &e);
|
||||
UI::EventReturn OnExitToMenu(UI::EventParams &e);
|
||||
|
Loading…
Reference in New Issue
Block a user