Some realtime profiling stuff. Enable FZ (flush-to-zero) mode.

This commit is contained in:
Henrik Rydgard 2013-01-10 23:49:33 +01:00
parent f3749d8abe
commit 7390f2b5f6
11 changed files with 41 additions and 6 deletions

View File

@ -112,6 +112,7 @@ if(NOT MSVC)
add_definitions(-O2)
add_definitions(-Wno-multichar)
add_definitions(-fno-strict-aliasing)
add_definitions(-ffast-math)
if(NOT APPLE)
add_definitions(-Wno-psabi)
add_definitions(-D_XOPEN_SOURCE=600 -D_XOPEN_SOURCE_EXTENDED -D__BSD_VISIBLE=1)

View File

@ -211,6 +211,9 @@ void hleEnterVblank(u64 userdata, int cyclesLate) {
char stats[512];
sprintf(stats,
"Frames: %i\n"
"DL processing time: %0.2f ms\n"
"Kernel processing time: %0.2f ms\n"
"Slowest syscall: %s : %0.2f ms\n"
"Draw calls: %i\n"
"Draw flushes: %i\n"
"Vertices Transformed: %i\n"
@ -221,6 +224,10 @@ void hleEnterVblank(u64 userdata, int cyclesLate) {
"Fragment shaders loaded: %i\n"
"Combined shaders loaded: %i\n",
gpuStats.numFrames,
gpuStats.msProcessingDisplayLists * 1000.0f,
kernelStats.msInSyscalls * 1000.0f,
kernelStats.slowestSyscallName ? kernelStats.slowestSyscallName : "(none)",
kernelStats.slowestSyscallTime * 1000.0f,
gpuStats.numDrawCalls,
gpuStats.numFlushes,
gpuStats.numVertsTransformed,
@ -238,6 +245,7 @@ void hleEnterVblank(u64 userdata, int cyclesLate) {
PPGeEnd();
gpuStats.resetFrame();
kernelStats.ResetFrame();
}
host->EndFrame();

View File

@ -199,7 +199,7 @@ void GLES_GPU::DumpNextFrame() {
}
void GLES_GPU::BeginFrame() {
TextureCache_Decimate();
TextureCache_StartFrame();
if (dumpNextFrame_) {
NOTICE_LOG(G3D, "DUMPING THIS FRAME");

View File

@ -166,7 +166,8 @@ void FramebufferManager::DrawActiveTexture(float w, float h, bool flip) {
Matrix4x4 ortho;
ortho.setOrtho(0, 480, 272, 0, -1, 1);
glUniformMatrix4fv(draw2dprogram->u_viewproj, 1, GL_FALSE, ortho.getReadPtr());
glBindBuffer(GL_ARRAY_BUFFER, 0);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
glEnableVertexAttribArray(draw2dprogram->a_position);
glEnableVertexAttribArray(draw2dprogram->a_texcoord0);
glVertexAttribPointer(draw2dprogram->a_position, 3, GL_FLOAT, GL_FALSE, 12, pos);

View File

@ -598,6 +598,13 @@ void convertColors(u8 *finalBuf, GLuint dstFmt, int numPixels) {
}
}
int lastBoundTexture = -1;
void TextureCache_StartFrame() {
lastBoundTexture = -1;
TextureCache_Decimate();
}
void PSPSetTexture() {
u32 texaddr = (gstate.texaddr[0] & 0xFFFFF0) | ((gstate.texbufwidth[0]<<8) & 0xFF000000);
texaddr &= 0xFFFFFFF;
@ -656,7 +663,10 @@ void PSPSetTexture() {
if (match) {
//got one!
entry.frameCounter = gpuStats.numFrames;
glBindTexture(GL_TEXTURE_2D, entry.texture);
if (entry.texture != lastBoundTexture) {
glBindTexture(GL_TEXTURE_2D, entry.texture);
lastBoundTexture = entry.texture;
}
UpdateSamplingParams(entry, false);
DEBUG_LOG(G3D, "Texture at %08x Found in Cache, applying", texaddr);
return; //Done!

View File

@ -24,6 +24,7 @@ void PSPSetTexture();
void TextureCache_Init();
void TextureCache_Shutdown();
void TextureCache_Clear(bool delete_them);
void TextureCache_StartFrame();
void TextureCache_Decimate(); // Run this once per frame to get rid of old textures.
void TextureCache_Invalidate(u32 addr, int size, bool force);
void TextureCache_InvalidateAll(bool force);

View File

@ -1,3 +1,4 @@
#include "base/timeutil.h"
#include "../Core/MemMap.h"
#include "GeDisasm.h"
#include "GPUCommon.h"
@ -41,7 +42,6 @@ u32 GPUCommon::EnqueueList(u32 listpc, u32 stall, int subIntrBase, bool head)
void GPUCommon::UpdateStall(int listid, u32 newstall)
{
for (auto iter = dlQueue.begin(); iter != dlQueue.end(); ++iter)
{
DisplayList &cur = *iter;
@ -56,6 +56,8 @@ void GPUCommon::UpdateStall(int listid, u32 newstall)
bool GPUCommon::InterpretList(DisplayList &list)
{
time_update();
double start = time_now_d();
currentList = &list;
// Reset stackptr for safety
stackptr = 0;
@ -91,13 +93,15 @@ bool GPUCommon::InterpretList(DisplayList &list)
list.pc += 4;
prev = op;
}
time_update();
gpuStats.msProcessingDisplayLists += time_now_d() - start;
return true;
}
bool GPUCommon::ProcessDLQueue()
{
DisplayListQueue::iterator iter = dlQueue.begin();
while (!(iter == dlQueue.end()))
while (iter != dlQueue.end())
{
DisplayList &l = *iter;
DEBUG_LOG(G3D,"Okay, starting DL execution at %08x - stall = %08x", l.pc, l.stall);

View File

@ -263,6 +263,7 @@ struct GPUStatistics
numShaderSwitches = 0;
numFlushes = 0;
numTexturesDecoded = 0;
msProcessingDisplayLists = 0;
}
// Per frame statistics
@ -274,6 +275,7 @@ struct GPUStatistics
int numTextureSwitches;
int numShaderSwitches;
int numTexturesDecoded;
double msProcessingDisplayLists;
// Total statistics, updated by the GPU core in UpdateStats
int numFrames;

View File

@ -41,6 +41,7 @@
EmuScreen::EmuScreen(const std::string &filename) : invalid_(true)
{
CheckGLExtensions();
std::string fileToStart = filename;
// This is probably where we should start up the emulated PSP.
INFO_LOG(BOOT, "Starting up hardware.");

View File

@ -31,6 +31,7 @@
#include "gfx/gl_lost_manager.h"
#include "gfx/texture.h"
#include "input/input_state.h"
#include "math/math_util.h"
#include "math/lin/matrix4x4.h"
#include "ui/screen.h"
#include "ui/ui.h"
@ -155,6 +156,7 @@ void NativeGetAppInfo(std::string *app_dir_name, std::string *app_nice_name, boo
void NativeInit(int argc, const char *argv[], const char *savegame_directory, const char *external_directory, const char *installID)
{
EnableFZ();
std::string user_data_path = savegame_directory;
// We want this to be FIRST.
@ -308,6 +310,11 @@ void NativeInitGraphics()
void NativeRender()
{
EnableFZ();
// Clearing the screen at the start of the frame is an optimization for tiled mobile GPUs, as it then doesn't need to keep it around between frames.
glClearColor(0,0,0,1);
glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
glstate.Restore();
glViewport(0, 0, pixel_xres, pixel_yres);
Matrix4x4 ortho;

2
native

@ -1 +1 @@
Subproject commit c63061ddfd5aec3b9dd51aa4c71150de905d8d1e
Subproject commit 7ceecd22b421c697d4d8c8ad6bda7654226be8ca