2014-02-10 20:54:46 +02:00
|
|
|
#pragma once
|
2012-06-17 14:58:29 +03:00
|
|
|
|
2014-02-15 08:12:13 +02:00
|
|
|
#include <array>
|
2014-10-21 09:01:38 +03:00
|
|
|
|
|
|
|
#include "VideoBackends/OGL/GLExtensions/GLExtensions.h"
|
2014-02-17 12:18:15 +02:00
|
|
|
#include "VideoCommon/PerfQueryBase.h"
|
2012-06-17 14:58:29 +03:00
|
|
|
|
2014-08-15 21:09:53 +03:00
|
|
|
namespace OGL
|
|
|
|
{
|
2012-06-17 14:58:29 +03:00
|
|
|
|
|
|
|
class PerfQuery : public PerfQueryBase
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
PerfQuery();
|
|
|
|
~PerfQuery();
|
|
|
|
|
2013-10-29 07:34:26 +02:00
|
|
|
void EnableQuery(PerfQueryGroup type) override;
|
|
|
|
void DisableQuery(PerfQueryGroup type) override;
|
|
|
|
void ResetQuery() override;
|
|
|
|
u32 GetQueryResult(PerfQueryType type) override;
|
|
|
|
void FlushResults() override;
|
2014-03-08 02:54:44 +02:00
|
|
|
bool IsFlushed() const override;
|
2013-03-01 20:30:37 +02:00
|
|
|
|
2013-02-17 01:50:40 +02:00
|
|
|
private:
|
|
|
|
struct ActiveQuery
|
|
|
|
{
|
|
|
|
GLuint query_id;
|
|
|
|
PerfQueryGroup query_type;
|
|
|
|
};
|
2013-03-01 20:30:37 +02:00
|
|
|
|
2013-02-17 01:50:40 +02:00
|
|
|
// when testing in SMS: 64 was too small, 128 was ok
|
2013-03-03 06:59:55 +02:00
|
|
|
static const u32 PERF_QUERY_BUFFER_SIZE = 512;
|
2013-03-01 20:30:37 +02:00
|
|
|
|
2013-02-17 01:50:40 +02:00
|
|
|
void WeakFlush();
|
|
|
|
// Only use when non-empty
|
|
|
|
void FlushOne();
|
2013-03-01 20:30:37 +02:00
|
|
|
|
2013-02-17 01:50:40 +02:00
|
|
|
// This contains gl query objects with unretrieved results.
|
2014-02-15 08:12:13 +02:00
|
|
|
std::array<ActiveQuery, PERF_QUERY_BUFFER_SIZE> m_query_buffer;
|
2013-03-03 06:59:55 +02:00
|
|
|
u32 m_query_read_pos;
|
2013-03-01 20:30:37 +02:00
|
|
|
|
2013-02-17 01:50:40 +02:00
|
|
|
// TODO: sloppy
|
2013-03-03 06:59:55 +02:00
|
|
|
volatile u32 m_query_count;
|
2013-02-17 01:50:40 +02:00
|
|
|
volatile u32 m_results[PQG_NUM_MEMBERS];
|
2012-06-17 14:58:29 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace
|