mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-29 00:59:44 -06:00
OGL: Implement pixel metrics (untested)
This commit is contained in:
78
Source/Plugins/Plugin_VideoOGL/Src/PerfQuery.cpp
Normal file
78
Source/Plugins/Plugin_VideoOGL/Src/PerfQuery.cpp
Normal file
@ -0,0 +1,78 @@
|
||||
#include "GLUtil.h"
|
||||
#include "PerfQuery.h"
|
||||
|
||||
namespace OGL {
|
||||
|
||||
u32 results[PQG_NUM_MEMBERS] = { 0 };
|
||||
GLuint query_id;
|
||||
|
||||
PerfQueryGroup active_query;
|
||||
|
||||
PerfQuery::PerfQuery()
|
||||
{
|
||||
glGenQueries(1, &query_id);
|
||||
}
|
||||
|
||||
PerfQuery::~PerfQuery()
|
||||
{
|
||||
glDeleteQueries(1, &query_id);
|
||||
}
|
||||
|
||||
void PerfQuery::EnableQuery(PerfQueryGroup type)
|
||||
{
|
||||
// start query
|
||||
if (type == PQG_ZCOMP_ZCOMPLOC || type == PQG_ZCOMP)
|
||||
{
|
||||
glBeginQuery(GL_SAMPLES_PASSED, query_id);
|
||||
}
|
||||
active_query = type;
|
||||
}
|
||||
|
||||
void PerfQuery::DisableQuery(PerfQueryGroup type)
|
||||
{
|
||||
// stop query
|
||||
if (type == PQG_ZCOMP_ZCOMPLOC || type == PQG_ZCOMP)
|
||||
{
|
||||
glEndQuery(GL_SAMPLES_PASSED);
|
||||
|
||||
GLuint query_result = GL_FALSE;
|
||||
while (query_result != GL_TRUE)
|
||||
{
|
||||
glGetQueryObjectuiv(query_id, GL_QUERY_RESULT_AVAILABLE, &query_result);
|
||||
}
|
||||
|
||||
glGetQueryObjectuiv(query_id, GL_QUERY_RESULT, &query_result);
|
||||
|
||||
results[active_query] += query_result;
|
||||
}
|
||||
}
|
||||
|
||||
void PerfQuery::ResetQuery()
|
||||
{
|
||||
memset(results, 0, sizeof(results));
|
||||
}
|
||||
|
||||
u32 PerfQuery::GetQueryResult(PerfQueryType type)
|
||||
{
|
||||
if (type == PQ_ZCOMP_INPUT_ZCOMPLOC || type == PQ_ZCOMP_OUTPUT_ZCOMPLOC || type == PQ_BLEND_INPUT)
|
||||
{
|
||||
|
||||
}
|
||||
if (type == PQ_ZCOMP_INPUT || type == PQ_ZCOMP_OUTPUT || type == PQ_BLEND_INPUT)
|
||||
{
|
||||
|
||||
}
|
||||
if (type == PQ_BLEND_INPUT)
|
||||
{
|
||||
results[PQ_BLEND_INPUT] = results[PQ_ZCOMP_OUTPUT] + results[PQ_ZCOMP_OUTPUT_ZCOMPLOC];
|
||||
}
|
||||
|
||||
if (type == PQ_EFB_COPY_CLOCKS)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
return results[type];
|
||||
}
|
||||
|
||||
} // namespace
|
22
Source/Plugins/Plugin_VideoOGL/Src/PerfQuery.h
Normal file
22
Source/Plugins/Plugin_VideoOGL/Src/PerfQuery.h
Normal file
@ -0,0 +1,22 @@
|
||||
#ifndef _PERFQUERY_H_
|
||||
#define _PERFQUERY_H_
|
||||
|
||||
#include "PerfQueryBase.h"
|
||||
|
||||
namespace OGL {
|
||||
|
||||
class PerfQuery : public PerfQueryBase
|
||||
{
|
||||
public:
|
||||
PerfQuery();
|
||||
~PerfQuery();
|
||||
|
||||
void EnableQuery(PerfQueryGroup type);
|
||||
void DisableQuery(PerfQueryGroup type);
|
||||
void ResetQuery();
|
||||
u32 GetQueryResult(PerfQueryType type);
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
#endif // _PERFQUERY_H_
|
@ -40,6 +40,7 @@
|
||||
#include "OpcodeDecoding.h"
|
||||
#include "FileUtil.h"
|
||||
#include "Debugger.h"
|
||||
#include "PerfQueryBase.h"
|
||||
|
||||
#include "main.h"
|
||||
|
||||
@ -207,7 +208,10 @@ void VertexManager::vFlush()
|
||||
if (ps) PixelShaderCache::SetCurrentShader(ps->glprogid); // Lego Star Wars crashes here.
|
||||
if (vs) VertexShaderCache::SetCurrentShader(vs->glprogid);
|
||||
|
||||
g_perf_query->EnableQuery(bpmem.zcontrol.zcomploc ? PQG_ZCOMP_ZCOMPLOC : PQG_ZCOMP);
|
||||
Draw();
|
||||
g_perf_query->DisableQuery(bpmem.zcontrol.zcomploc ? PQG_ZCOMP_ZCOMPLOC : PQG_ZCOMP);
|
||||
ERROR_LOG(VIDEO, "PerfQuery result: %d", g_perf_query->GetQueryResult(bpmem.zcontrol.zcomploc ? PQ_ZCOMP_OUTPUT_ZCOMPLOC : PQ_ZCOMP_OUTPUT));
|
||||
|
||||
// run through vertex groups again to set alpha
|
||||
if (useDstAlpha && !dualSourcePossible)
|
||||
|
@ -93,6 +93,7 @@ Make AA apply instantly during gameplay if possible
|
||||
#include "FramebufferManager.h"
|
||||
#include "Core.h"
|
||||
#include "Host.h"
|
||||
#include "PerfQuery.h"
|
||||
|
||||
#include "VideoState.h"
|
||||
#include "VideoBackend.h"
|
||||
@ -194,6 +195,7 @@ void VideoBackend::Video_Prepare()
|
||||
|
||||
BPInit();
|
||||
g_vertex_manager = new VertexManager;
|
||||
g_perf_query = new PerfQuery;
|
||||
Fifo_Init(); // must be done before OpcodeDecoder_Init()
|
||||
OpcodeDecoder_Init();
|
||||
VertexShaderCache::Init();
|
||||
|
Reference in New Issue
Block a user