Merge pull request #6897 from lioncash/sw-efb
EfbInterface: Minor changes
This commit is contained in:
commit
69a6724b34
|
@ -5,6 +5,7 @@
|
||||||
#include "VideoBackends/Software/EfbInterface.h"
|
#include "VideoBackends/Software/EfbInterface.h"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
#include <array>
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
@ -18,11 +19,11 @@
|
||||||
#include "VideoCommon/LookUpTables.h"
|
#include "VideoCommon/LookUpTables.h"
|
||||||
#include "VideoCommon/PerfQueryBase.h"
|
#include "VideoCommon/PerfQueryBase.h"
|
||||||
|
|
||||||
static u8 efb[EFB_WIDTH * EFB_HEIGHT * 6];
|
|
||||||
|
|
||||||
namespace EfbInterface
|
namespace EfbInterface
|
||||||
{
|
{
|
||||||
u32 perf_values[PQ_NUM_MEMBERS];
|
static std::array<u8, EFB_WIDTH * EFB_HEIGHT * 6> efb;
|
||||||
|
|
||||||
|
static std::array<u32, PQ_NUM_MEMBERS> perf_values;
|
||||||
|
|
||||||
static inline u32 GetColorOffset(u16 x, u16 y)
|
static inline u32 GetColorOffset(u16 x, u16 y)
|
||||||
{
|
{
|
||||||
|
@ -31,7 +32,9 @@ static inline u32 GetColorOffset(u16 x, u16 y)
|
||||||
|
|
||||||
static inline u32 GetDepthOffset(u16 x, u16 y)
|
static inline u32 GetDepthOffset(u16 x, u16 y)
|
||||||
{
|
{
|
||||||
return (x + y * EFB_WIDTH) * 3 + DEPTH_BUFFER_START;
|
constexpr u32 depth_buffer_start = EFB_WIDTH * EFB_HEIGHT * 3;
|
||||||
|
|
||||||
|
return (x + y * EFB_WIDTH) * 3 + depth_buffer_start;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void SetPixelAlphaOnly(u32 offset, u8 a)
|
static void SetPixelAlphaOnly(u32 offset, u8 a)
|
||||||
|
@ -682,4 +685,27 @@ bool ZCompare(u16 x, u16 y, u32 z)
|
||||||
|
|
||||||
return pass;
|
return pass;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
u32 GetPerfQueryResult(PerfQueryType type)
|
||||||
|
{
|
||||||
|
return perf_values[type];
|
||||||
|
}
|
||||||
|
|
||||||
|
void ResetPerfQuery()
|
||||||
|
{
|
||||||
|
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,16 +4,12 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <array>
|
|
||||||
|
|
||||||
#include "Common/CommonTypes.h"
|
#include "Common/CommonTypes.h"
|
||||||
#include "VideoCommon/PerfQueryBase.h"
|
#include "VideoCommon/PerfQueryBase.h"
|
||||||
#include "VideoCommon/VideoCommon.h"
|
#include "VideoCommon/VideoCommon.h"
|
||||||
|
|
||||||
namespace EfbInterface
|
namespace EfbInterface
|
||||||
{
|
{
|
||||||
const int DEPTH_BUFFER_START = EFB_WIDTH * EFB_HEIGHT * 3;
|
|
||||||
|
|
||||||
// xfb color format - packed so the compiler doesn't mess with alignment
|
// xfb color format - packed so the compiler doesn't mess with alignment
|
||||||
#pragma pack(push, 1)
|
#pragma pack(push, 1)
|
||||||
struct yuv422_packed
|
struct yuv422_packed
|
||||||
|
@ -61,17 +57,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,
|
void EncodeXFB(u8* xfb_in_ram, u32 memory_stride, const EFBRectangle& source_rect, float y_scale,
|
||||||
float gamma);
|
float gamma);
|
||||||
|
|
||||||
extern u32 perf_values[PQ_NUM_MEMBERS];
|
u32 GetPerfQueryResult(PerfQueryType type);
|
||||||
inline void IncPerfCounterQuadCount(PerfQueryType type)
|
void ResetPerfQuery();
|
||||||
{
|
void IncPerfCounterQuadCount(PerfQueryType type);
|
||||||
// NOTE: hardware doesn't process individual pixels but quads instead.
|
} // namespace EfbInterface
|
||||||
// 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];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -38,11 +38,8 @@ public:
|
||||||
~PerfQuery() {}
|
~PerfQuery() {}
|
||||||
void EnableQuery(PerfQueryGroup type) override {}
|
void EnableQuery(PerfQueryGroup type) override {}
|
||||||
void DisableQuery(PerfQueryGroup type) override {}
|
void DisableQuery(PerfQueryGroup type) override {}
|
||||||
void ResetQuery() override
|
void ResetQuery() override { EfbInterface::ResetPerfQuery(); }
|
||||||
{
|
u32 GetQueryResult(PerfQueryType type) override { return EfbInterface::GetPerfQueryResult(type); }
|
||||||
memset(EfbInterface::perf_values, 0, sizeof(EfbInterface::perf_values));
|
|
||||||
}
|
|
||||||
u32 GetQueryResult(PerfQueryType type) override { return EfbInterface::perf_values[type]; }
|
|
||||||
void FlushResults() override {}
|
void FlushResults() override {}
|
||||||
bool IsFlushed() const override { return true; }
|
bool IsFlushed() const override { return true; }
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue