mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-01 14:58:14 +00:00
Don't use PPGe for debug overlays. Fixes fps counter in games where it didn't work before.
This commit is contained in:
1 parent
6f61bfa936
commit
7900a6d807
3 files changed
+36
-47
No files matched your search
+10
-43
@@ -44,8 +44,6 @@
|
||||
#include "../../GPU/GLES/TextureCache.h"
|
||||
#include "../../GPU/GPUState.h"
|
||||
#include "../../GPU/GPUInterface.h"
|
||||
// Internal drawing library
|
||||
#include "../Util/PPGeDraw.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
// Windows defines min/max which conflict with std::min/std::max.
|
||||
@@ -198,13 +196,17 @@ void __DisplayFireVblank() {
|
||||
}
|
||||
}
|
||||
|
||||
static double highestFps = 0.0;
|
||||
static int lastFpsFrame = 0;
|
||||
static double lastFpsTime = 0.0;
|
||||
static double fps = 0.0;
|
||||
|
||||
void __DisplayGetFPS(float *out_vps, float *out_fps) {
|
||||
*out_vps = *out_fps = fps;
|
||||
}
|
||||
|
||||
void CalculateFPS()
|
||||
{
|
||||
static double highestFps = 0.0;
|
||||
static int lastFpsFrame = 0;
|
||||
static double lastFpsTime = 0.0;
|
||||
static double fps = 0.0;
|
||||
|
||||
time_update();
|
||||
double now = time_now_d();
|
||||
|
||||
@@ -217,28 +219,11 @@ void CalculateFPS()
|
||||
lastFpsFrame = gpuStats.numFrames;
|
||||
lastFpsTime = now;
|
||||
}
|
||||
|
||||
char stats[50];
|
||||
sprintf(stats, "VPS: %0.1f", fps);
|
||||
|
||||
#ifdef USING_GLES2
|
||||
float zoom = 0.7f; /// g_Config.iWindowZoom;
|
||||
float soff = 0.7f;
|
||||
#else
|
||||
float zoom = 0.5f; /// g_Config.iWindowZoom;
|
||||
float soff = 0.5f;
|
||||
#endif
|
||||
PPGeBegin();
|
||||
PPGeDrawText(stats, 476 + soff, 4 + soff, PPGE_ALIGN_RIGHT, zoom, 0xCC000000);
|
||||
PPGeDrawText(stats, 476 + -soff, 4 -soff, PPGE_ALIGN_RIGHT, zoom, 0xCC000000);
|
||||
PPGeDrawText(stats, 476, 4, PPGE_ALIGN_RIGHT, zoom, 0xFF30FF30);
|
||||
PPGeEnd();
|
||||
}
|
||||
|
||||
void DebugStats()
|
||||
void __DisplayGetDebugStats(char stats[2048])
|
||||
{
|
||||
gpu->UpdateStats();
|
||||
char stats[2048];
|
||||
|
||||
sprintf(stats,
|
||||
"Frames: %i\n"
|
||||
@@ -281,19 +266,6 @@ void DebugStats()
|
||||
gpuStats.numShaders
|
||||
);
|
||||
|
||||
#ifdef USING_GLES2
|
||||
float zoom = 0.5f; /// g_Config.iWindowZoom;
|
||||
float soff = 0.5f;
|
||||
#else
|
||||
float zoom = 0.3f; /// g_Config.iWindowZoom;
|
||||
float soff = 0.3f;
|
||||
#endif
|
||||
PPGeBegin();
|
||||
PPGeDrawText(stats, soff, soff, 0, zoom, 0xCC000000);
|
||||
PPGeDrawText(stats, -soff, -soff, 0, zoom, 0xCC000000);
|
||||
PPGeDrawText(stats, 0, 0, 0, zoom, 0xFFFFFFFF);
|
||||
PPGeEnd();
|
||||
|
||||
gpuStats.resetFrame();
|
||||
kernelStats.ResetFrame();
|
||||
}
|
||||
@@ -390,11 +362,6 @@ void hleEnterVblank(u64 userdata, int cyclesLate) {
|
||||
|
||||
gpuStats.numFrames++;
|
||||
|
||||
// Now we can subvert the Ge engine in order to draw custom overlays like stat counters etc.
|
||||
if (g_Config.bShowDebugStats && gpuStats.numDrawCalls) {
|
||||
DebugStats();
|
||||
}
|
||||
|
||||
if (g_Config.bShowFPSCounter) {
|
||||
CalculateFPS();
|
||||
}
|
||||
|
||||
@@ -32,3 +32,6 @@ bool __DisplayGetFramebuf(u8 **topaddr, u32 *linesize, u32 *pixelFormat, int mod
|
||||
typedef void (*VblankCallback)();
|
||||
// Listen for vblank events. Only register during init.
|
||||
void __DisplayListenVblank(VblankCallback callback);
|
||||
|
||||
void __DisplayGetDebugStats(char stats[2048]);
|
||||
void __DisplayGetFPS(float *out_vps, float *out_fps);
|
||||
+23
-4
@@ -34,13 +34,15 @@
|
||||
#include "GPU/GPUState.h"
|
||||
#include "GPU/GPUInterface.h"
|
||||
#include "Core/HLE/sceCtrl.h"
|
||||
#include "Core/HLE/sceDisplay.h"
|
||||
#include "Core/Debugger/SymbolMap.h"
|
||||
|
||||
#include "GamepadEmu.h"
|
||||
#include "UIShader.h"
|
||||
#include "UI/ui_atlas.h"
|
||||
#include "UI/GamepadEmu.h"
|
||||
#include "UI/UIShader.h"
|
||||
|
||||
#include "MenuScreens.h"
|
||||
#include "EmuScreen.h"
|
||||
#include "UI/MenuScreens.h"
|
||||
#include "UI/EmuScreen.h"
|
||||
|
||||
EmuScreen::EmuScreen(const std::string &filename) : invalid_(true) {
|
||||
CheckGLExtensions();
|
||||
@@ -258,6 +260,23 @@ void EmuScreen::render() {
|
||||
|
||||
DrawWatermark();
|
||||
|
||||
if (g_Config.bShowDebugStats) {
|
||||
char statbuf[2048];
|
||||
__DisplayGetDebugStats(statbuf);
|
||||
ui_draw2d.SetFontScale(.7f, .7f);
|
||||
ui_draw2d.DrawText(UBUNTU24, statbuf, 10, 10, 0xFFFFFFFF);
|
||||
ui_draw2d.SetFontScale(1.0f, 1.0f);
|
||||
}
|
||||
|
||||
if (g_Config.bShowFPSCounter) {
|
||||
float vps, fps;
|
||||
__DisplayGetFPS(&vps, &fps);
|
||||
char fpsbuf[256];
|
||||
sprintf(fpsbuf, "VPS: %0.1f", vps);
|
||||
ui_draw2d.DrawText(UBUNTU24, fpsbuf, dp_xres - 10, 10, 0xFF3fFF3f, ALIGN_TOPRIGHT);
|
||||
}
|
||||
|
||||
|
||||
glsl_bind(UIShader_Get());
|
||||
ui_draw2d.End();
|
||||
ui_draw2d.Flush();
|
||||
|
||||
Reference in new issue
Block a user