VideoSW: Use more VideoCommon

Now we require lots of empty functions, but this removes by far more duplicated code.
This commit is contained in:
degasus
2015-10-09 20:50:36 +02:00
parent 7fcb5a803b
commit efbe5bc4b6
51 changed files with 529 additions and 2025 deletions

View File

@ -257,6 +257,7 @@ struct CPState final
BitSet32 attr_dirty;
bool bases_dirty;
VertexLoaderBase* vertex_loaders[8];
int last_id;
};
class PointerWrap;

View File

@ -8,6 +8,7 @@
#include "Common/StringUtil.h"
#include "VideoCommon/Statistics.h"
#include "VideoCommon/VertexLoaderManager.h"
#include "VideoCommon/VideoConfig.h"
Statistics stats;
@ -27,6 +28,21 @@ void Statistics::SwapDL()
std::string Statistics::ToString()
{
std::string str;
if (g_ActiveConfig.backend_info.APIType == API_TYPE::API_NONE)
{
str += StringFromFormat("Objects: %i\n", stats.thisFrame.numDrawnObjects);
str += StringFromFormat("Vertices Loaded: %i\n", stats.thisFrame.numVerticesLoaded);
str += StringFromFormat("Triangles Input: %i\n", stats.thisFrame.numTrianglesIn);
str += StringFromFormat("Triangles Rejected: %i\n", stats.thisFrame.numTrianglesRejected);
str += StringFromFormat("Triangles Culled: %i\n", stats.thisFrame.numTrianglesCulled);
str += StringFromFormat("Triangles Clipped: %i\n", stats.thisFrame.numTrianglesClipped);
str += StringFromFormat("Triangles Drawn: %i\n", stats.thisFrame.numTrianglesDrawn);
str += StringFromFormat("Rasterized Pix: %i\n", stats.thisFrame.rasterizedPixels);
str += StringFromFormat("TEV Pix In: %i\n", stats.thisFrame.tevPixelsIn);
str += StringFromFormat("TEV Pix Out: %i\n", stats.thisFrame.tevPixelsOut);
}
str += StringFromFormat("Textures created: %i\n", stats.numTexturesCreated);
str += StringFromFormat("Textures uploaded: %i\n", stats.numTexturesUploaded);
str += StringFromFormat("Textures alive: %i\n", stats.numTexturesAlive);

View File

@ -52,6 +52,17 @@ struct Statistics
int bytesVertexStreamed;
int bytesIndexStreamed;
int bytesUniformStreamed;
int numTrianglesClipped;
int numTrianglesIn;
int numTrianglesRejected;
int numTrianglesCulled;
int numDrawnObjects;
int rasterizedPixels;
int numTrianglesDrawn;
int numVerticesLoaded;
int tevPixelsIn;
int tevPixelsOut;
};
ThisFrame thisFrame;
void ResetFrame();

View File

@ -124,6 +124,7 @@ void MarkAllDirty()
static VertexLoaderBase* RefreshLoader(int vtx_attr_group, bool preprocess = false)
{
CPState* state = preprocess ? &g_preprocess_cp_state : &g_main_cp_state;
state->last_id = vtx_attr_group;
VertexLoaderBase* loader;
if (state->attr_dirty[vtx_attr_group])

View File

@ -87,6 +87,15 @@ void VideoConfig::Load(const std::string& ini_file)
settings->Get("EnableShaderDebugging", &bEnableShaderDebugging, false);
settings->Get("BorderlessFullscreen", &bBorderlessFullscreen, false);
settings->Get("SWZComploc", &bZComploc, true);
settings->Get("SWZFreeze", &bZFreeze, true);
settings->Get("SWDumpObjects", &bDumpObjects, false);
settings->Get("SWDumpTevStages", &bDumpTevStages, false);
settings->Get("SWDumpTevTexFetches", &bDumpTevTextureFetches, false);
settings->Get("SWDrawStart", &drawStart, 0);
settings->Get("SWDrawEnd", &drawEnd, 100000);
IniFile::Section* enhancements = iniFile.GetOrCreateSection("Enhancements");
enhancements->Get("ForceFiltering", &bForceFiltering, 0);
enhancements->Get("MaxAnisotropy", &iMaxAnisotropy, 0); // NOTE - this is x in (1 << x)
@ -287,6 +296,14 @@ void VideoConfig::Save(const std::string& ini_file)
settings->Set("EnableShaderDebugging", bEnableShaderDebugging);
settings->Set("BorderlessFullscreen", bBorderlessFullscreen);
settings->Set("SWZComploc", bZComploc);
settings->Set("SWZFreeze", bZFreeze);
settings->Set("SWDumpObjects", bDumpObjects);
settings->Set("SWDumpTevStages", bDumpTevStages);
settings->Set("SWDumpTevTexFetches", bDumpTevTextureFetches);
settings->Set("SWDrawStart", drawStart);
settings->Set("SWDrawEnd", drawEnd);
IniFile::Section* enhancements = iniFile.GetOrCreateSection("Enhancements");
enhancements->Set("ForceFiltering", bForceFiltering);
enhancements->Set("MaxAnisotropy", iMaxAnisotropy);

View File

@ -136,6 +136,15 @@ struct VideoConfig final
// Debugging
bool bEnableShaderDebugging;
// VideoSW Debugging
int drawStart;
int drawEnd;
bool bZComploc;
bool bZFreeze;
bool bDumpObjects;
bool bDumpTevStages;
bool bDumpTevTextureFetches;
// Static config per API
// TODO: Move this out of VideoConfig
struct