From 6360fcb0aec82acaefe97f69f11cbb501517aa7b Mon Sep 17 00:00:00 2001 From: Henrik Rydgard Date: Tue, 27 Aug 2013 20:58:27 +0200 Subject: [PATCH] Add some stats to get some idea of much alpha tested drawing we do. Turns out it's one hell of a lot and we really should fix this by checking both vertices and textures to deduce when we can just skip alpha testing safely, probably quite often. I care about this because alpha testing drawing is very expensive on some mobile chips. --- Common/LogManager.cpp | 4 ++-- Core/HLE/sceDisplay.cpp | 4 ++++ GPU/GLES/FragmentShaderGenerator.cpp | 5 +++++ GPU/GPUState.h | 5 +++++ UI/NativeApp.cpp | 13 ------------- native | 2 +- 6 files changed, 17 insertions(+), 16 deletions(-) diff --git a/Common/LogManager.cpp b/Common/LogManager.cpp index 85d3f638ff..5a6a98a113 100644 --- a/Common/LogManager.cpp +++ b/Common/LogManager.cpp @@ -16,7 +16,7 @@ // http://code.google.com/p/dolphin-emu/ #include - +#include "base/logging.h" #include "LogManager.h" #include "ConsoleListener.h" #include "Timer.h" @@ -280,6 +280,6 @@ void FileLogListener::Log(LogTypes::LOG_LEVELS, const char *msg) void DebuggerLogListener::Log(LogTypes::LOG_LEVELS, const char *msg) { #if _MSC_VER - ::OutputDebugStringA(msg); + OutputDebugStringUTF8(msg); #endif } diff --git a/Core/HLE/sceDisplay.cpp b/Core/HLE/sceDisplay.cpp index fdd49b775c..57325b7fc6 100644 --- a/Core/HLE/sceDisplay.cpp +++ b/Core/HLE/sceDisplay.cpp @@ -275,6 +275,8 @@ void __DisplayGetDebugStats(char stats[2048]) { "Most active syscall: %s : %0.2f ms\n" "Draw calls: %i, flushes %i\n" "Cached Draw calls: %i\n" + "Alpha Tested draws: %i\n" + "Non Alpha Tested draws: %i\n" "Num Tracked Vertex Arrays: %i\n" "Cycles executed: %d (%f per vertex)\n" "Commands per call level: %i %i %i %i\n" @@ -297,6 +299,8 @@ void __DisplayGetDebugStats(char stats[2048]) { gpuStats.numDrawCalls, gpuStats.numFlushes, gpuStats.numCachedDrawCalls, + gpuStats.numAlphaTestedDraws, + gpuStats.numNonAlphaTestedDraws, gpuStats.numTrackedVertexArrays, gpuStats.vertexGPUCycles + gpuStats.otherGPUCycles, vertexAverageCycles, diff --git a/GPU/GLES/FragmentShaderGenerator.cpp b/GPU/GLES/FragmentShaderGenerator.cpp index 947e0e7944..3c24d9d26a 100644 --- a/GPU/GLES/FragmentShaderGenerator.cpp +++ b/GPU/GLES/FragmentShaderGenerator.cpp @@ -141,6 +141,11 @@ void ComputeFragmentShaderID(FragmentShaderID *id) { id->d[0] |= (doTextureProjection & 1) << 16; id->d[0] |= (enableColorDoubling & 1) << 17; id->d[0] |= (enableAlphaDoubling & 1) << 18; + + if (enableAlphaTest) + gpuStats.numAlphaTestedDraws++; + else + gpuStats.numNonAlphaTestedDraws++; } } diff --git a/GPU/GPUState.h b/GPU/GPUState.h index e061eeaf0a..d5e35224c6 100644 --- a/GPU/GPUState.h +++ b/GPU/GPUState.h @@ -449,6 +449,8 @@ struct GPUStatistics { numShaderSwitches = 0; numFlushes = 0; numTexturesDecoded = 0; + numAlphaTestedDraws = 0; + numNonAlphaTestedDraws = 0; msProcessingDisplayLists = 0; vertexGPUCycles = 0; otherGPUCycles = 0; @@ -472,6 +474,9 @@ struct GPUStatistics { int otherGPUCycles; int gpuCommandsAtCallLevel[4]; + int numAlphaTestedDraws; + int numNonAlphaTestedDraws; + // Total statistics, updated by the GPU core in UpdateStats int numVBlanks; int numFlips; diff --git a/UI/NativeApp.cpp b/UI/NativeApp.cpp index e2695f1233..5954c5fca7 100644 --- a/UI/NativeApp.cpp +++ b/UI/NativeApp.cpp @@ -44,7 +44,6 @@ #include "math/math_util.h" #include "math/lin/matrix4x4.h" #include "ui/screen.h" -#include "ui/ui.h" #include "ui/ui_context.h" #include "ui/view.h" @@ -403,16 +402,6 @@ void NativeInitGraphics() { UIShader_Init(); - // Old style theme, to be removed later - UITheme theme = {0}; - theme.uiFont = UBUNTU24; - theme.uiFontSmall = UBUNTU24; - theme.uiFontSmaller = UBUNTU24; - theme.buttonImage = I_SOLIDWHITE; // not using classic buttons - theme.buttonSelected = I_SOLIDWHITE; - theme.checkOn = I_CHECKEDBOX; - theme.checkOff = I_SQUARE; - // memset(&ui_theme, 0, sizeof(ui_theme)); // New style theme ui_theme.uiFont = UBUNTU24; @@ -453,8 +442,6 @@ void NativeInitGraphics() { ui_draw2d.Init(); ui_draw2d_front.Init(); - UIInit(&ui_atlas, theme); - uiTexture = new Texture(); if (!uiTexture->Load("ui_atlas.zim")) { PanicAlert("Failed to load ui_atlas.zim.\n\nPlace it in the directory \"assets\" under your PPSSPP directory."); diff --git a/native b/native index ed1df8fb88..b063724c9e 160000 --- a/native +++ b/native @@ -1 +1 @@ -Subproject commit ed1df8fb888c9cabd8d0dcba15a1e4a8686538db +Subproject commit b063724c9e4364613fe8af66439d56ed0fbf049c