Permalink
Browse files

EfbInterface: Make perf_values internally linked

Instead, expose functions to operate with it. This way we keep the
internal representation concealed.
  • Loading branch information...
lioncash committed May 18, 2018
1 parent f3a8874 commit c58b5e9b9bccf9baac5d5fb5aa6e254528f19782
@@ -22,7 +22,7 @@ namespace EfbInterface
{
static u8 efb[EFB_WIDTH * EFB_HEIGHT * 6];
u32 perf_values[PQ_NUM_MEMBERS];
static u32 perf_values[PQ_NUM_MEMBERS];
static inline u32 GetColorOffset(u16 x, u16 y)
{
@@ -682,4 +682,27 @@ bool ZCompare(u16 x, u16 y, u32 z)
return pass;
}
u32 GetPerfQueryResult(PerfQueryType type)
{
return perf_values[type];
}
void ResetPerfQuery()
{
std::memset(perf_values, 0, sizeof(perf_values));
}
void IncPerfCounterQuadCount(PerfQueryType type)
{
// NOTE: hardware doesn't process individual pixels but quads instead.
// Current software renderer architecture works on pixels though, so
// we have this "quad" hack here to only increment the registers on
// every fourth rendered pixel
static u32 quad[PQ_NUM_MEMBERS];
if (++quad[type] != 3)
return;
quad[type] = 0;
++perf_values[type];
}
}
@@ -4,8 +4,6 @@
#pragma once
#include <array>
#include "Common/CommonTypes.h"
#include "VideoCommon/PerfQueryBase.h"
#include "VideoCommon/VideoCommon.h"
@@ -61,17 +59,7 @@ u8* GetPixelPointer(u16 x, u16 y, bool depth);
void EncodeXFB(u8* xfb_in_ram, u32 memory_stride, const EFBRectangle& source_rect, float y_scale,
float gamma);
extern u32 perf_values[PQ_NUM_MEMBERS];
inline void IncPerfCounterQuadCount(PerfQueryType type)
{
// NOTE: hardware doesn't process individual pixels but quads instead.
// Current software renderer architecture works on pixels though, so
// we have this "quad" hack here to only increment the registers on
// every fourth rendered pixel
static u32 quad[PQ_NUM_MEMBERS];
if (++quad[type] != 3)
return;
quad[type] = 0;
++perf_values[type];
}
}
u32 GetPerfQueryResult(PerfQueryType type);
void ResetPerfQuery();
void IncPerfCounterQuadCount(PerfQueryType type);
} // namespace EfbInterface
@@ -38,11 +38,8 @@ class PerfQuery : public PerfQueryBase
~PerfQuery() {}
void EnableQuery(PerfQueryGroup type) override {}
void DisableQuery(PerfQueryGroup type) override {}
void ResetQuery() override
{
memset(EfbInterface::perf_values, 0, sizeof(EfbInterface::perf_values));
}
u32 GetQueryResult(PerfQueryType type) override { return EfbInterface::perf_values[type]; }
void ResetQuery() override { EfbInterface::ResetPerfQuery(); }
u32 GetQueryResult(PerfQueryType type) override { return EfbInterface::GetPerfQueryResult(type); }
void FlushResults() override {}
bool IsFlushed() const override { return true; }
};

0 comments on commit c58b5e9

Please sign in to comment.