Add documentation to PerfQueryBase interface.

Remove the config field for perf queries (wasn't used for the new interface anyway).
Few other cleanups.
This commit is contained in:
NeoBrainX 2013-03-01 23:02:11 +01:00
parent 5a7bb2abfa
commit 4058b4c38a
7 changed files with 20 additions and 16 deletions

View File

@ -485,7 +485,7 @@ void BPWritten(const BPCmd& bp)
case BPMEM_IND_IMASK: // Index Mask ?
case BPMEM_REVBITS: // Always set to 0x0F when GX_InitRevBits() is called.
break;
case BPMEM_CLEAR_PIXEL_PERF:
// GXClearPixMetric writes 0xAAA here, Sunshine alternates this register between values 0x000 and 0xAAA
g_perf_query->ResetQuery();

View File

@ -195,7 +195,7 @@ void VideoFifo_CheckPerfQueryRequest()
u32 VideoBackendHardware::Video_GetQueryResult(PerfQueryType type)
{
// Is this check sane?
// TODO: Is this check sane?
if (!g_perf_query->IsFlushed())
{
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bCPUThread)
@ -207,7 +207,7 @@ u32 VideoBackendHardware::Video_GetQueryResult(PerfQueryType type)
else
g_perf_query->FlushResults();
}
return g_perf_query->GetQueryResult(type);
}

View File

@ -28,11 +28,24 @@ public:
PerfQueryBase() {};
virtual ~PerfQueryBase() {}
// Begin querying the specified value for the following host GPU commands
virtual void EnableQuery(PerfQueryGroup type) {}
// Stop querying the specified value for the following host GPU commands
virtual void DisableQuery(PerfQueryGroup type) {}
// Reset query counters to zero and drop any pending queries
virtual void ResetQuery() {}
// Return the measured value for the specified query type
// NOTE: Called from CPU thread
virtual u32 GetQueryResult(PerfQueryType type) { return 0; }
// Request the value of any pending queries - causes a pipeline flush and thus should be used carefully!
virtual void FlushResults() {}
// True if there are no further pending query results
// NOTE: Called from CPU thread
virtual bool IsFlushed() const { return true; }
};

View File

@ -299,7 +299,6 @@ void Read16(u16& _uReturnValue, const u32 _iAddress)
// Later builds returned 1 for the high register. That caused the timer to actually count down, but made the challenge unbeatable because the game always thought you didn't clear any goop at all.
// Note that currently this functionality is only implemented in the D3D11 backend.
_uReturnValue = g_video_backend->Video_GetQueryResult(PQ_BLEND_INPUT) & 0xFFFF;
//ERROR_LOG(VIDEO, "PQ_BLEND_INPUT: %d", g_video_backend->Video_GetQueryResult(PQ_BLEND_INPUT));
break;
case PE_PERF_BLEND_INPUT_H:

View File

@ -105,7 +105,6 @@ void VideoConfig::Load(const char *ini_file)
iniFile.Get("Hacks", "EFBScaledCopy", &bCopyEFBScaled, true);
iniFile.Get("Hacks", "EFBCopyCacheEnable", &bEFBCopyCacheEnable, false);
iniFile.Get("Hacks", "EFBEmulateFormatChanges", &bEFBEmulateFormatChanges, false);
iniFile.Get("Hacks", "DisablePixelPerf", &bDisablePixelPerf, true);
iniFile.Get("Hardware", "Adapter", &iAdapter, 0);
@ -154,7 +153,6 @@ void VideoConfig::GameIniLoad(const char *ini_file)
iniFile.GetIfExists("Video_Hacks", "EFBScaledCopy", &bCopyEFBScaled);
iniFile.GetIfExists("Video_Hacks", "EFBCopyCacheEnable", &bEFBCopyCacheEnable);
iniFile.GetIfExists("Video_Hacks", "EFBEmulateFormatChanges", &bEFBEmulateFormatChanges);
iniFile.GetIfExists("Video_Hacks", "DisablePixelPerf", &bDisablePixelPerf);
iniFile.GetIfExists("Video", "ProjectionHack", &iPhackvalue[0]);
iniFile.GetIfExists("Video", "PH_SZNear", &iPhackvalue[1]);
@ -233,7 +231,6 @@ void VideoConfig::Save(const char *ini_file)
iniFile.Set("Hacks", "EFBScaledCopy", bCopyEFBScaled);
iniFile.Set("Hacks", "EFBCopyCacheEnable", bEFBCopyCacheEnable);
iniFile.Set("Hacks", "EFBEmulateFormatChanges", bEFBEmulateFormatChanges);
iniFile.Set("Hacks", "DisablePixelPerf", bDisablePixelPerf);
iniFile.Set("Hardware", "Adapter", iAdapter);
@ -289,7 +286,6 @@ void VideoConfig::GameIniSave(const char* default_ini, const char* game_ini)
SET_IF_DIFFERS("Video_Hacks", "EFBScaledCopy", bCopyEFBScaled);
SET_IF_DIFFERS("Video_Hacks", "EFBCopyCacheEnable", bEFBCopyCacheEnable);
SET_IF_DIFFERS("Video_Hacks", "EFBEmulateFormatChanges", bEFBEmulateFormatChanges);
SET_IF_DIFFERS("Video_Hacks", "DisablePixelPerf", bDisablePixelPerf);
iniFile.Save(game_ini);
}

View File

@ -115,7 +115,7 @@ struct VideoConfig
int iAnaglyphStereoSeparation;
int iAnaglyphFocalAngle;
bool b3DVision;
// Hacks
bool bEFBAccessEnable;
bool bDlistCachingEnable;
@ -133,7 +133,6 @@ struct VideoConfig
bool bZTPSpeedHack; // The Legend of Zelda: Twilight Princess
bool bUseBBox;
bool bEnablePixelLighting;
bool bDisablePixelPerf;
int iLog; // CONF_ bits
int iSaveTargetId; // TODO: Should be dropped

View File

@ -57,6 +57,7 @@
#include "ConfigManager.h"
#include "VideoBackend.h"
#include "PerfQueryBase.h"
namespace DX9
{
@ -156,12 +157,6 @@ bool VideoBackend::Initialize(void *&window_handle)
s_BackendInitialized = true;
if (!g_Config.bDisablePixelPerf)
{
OSD::AddMessage("PE perf metrics enabled although the D3D9 backend doesn't support them!");
OSD::AddMessage("Try a different backend when issues arise.");
}
return true;
}
@ -176,6 +171,7 @@ void VideoBackend::Video_Prepare()
g_vertex_manager = new VertexManager;
g_renderer = new Renderer;
g_texture_cache = new TextureCache;
g_perf_query = new PerfQueryBase;
// VideoCommon
BPInit();
Fifo_Init();
@ -213,6 +209,7 @@ void VideoBackend::Shutdown()
// internal interfaces
PixelShaderCache::Shutdown();
VertexShaderCache::Shutdown();
delete g_perf_query;
delete g_texture_cache;
delete g_renderer;
delete g_vertex_manager;