diff options
| author | Léo Lam <leo@innovatetechnologi.es> | 2018-05-18 22:38:00 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-05-18 22:38:00 +0200 |
| commit | 69a6724b34a640347adfbe6e808040d9ec500810 (patch) | |
| tree | c50ce1c86ae42b84ff9122c700bd4e885a208e3b /Source/Core/VideoBackends/Software/EfbInterface.cpp | |
| parent | 8af0f1bfc5d81560815b362178b5844b786d1767 (diff) | |
| parent | 505d45a2331e5587ca0b564ec616fc5855c33fd7 (diff) | |
Merge pull request #6897 from lioncash/sw-efb
EfbInterface: Minor changes
Diffstat (limited to 'Source/Core/VideoBackends/Software/EfbInterface.cpp')
| -rw-r--r-- | Source/Core/VideoBackends/Software/EfbInterface.cpp | 34 |
1 files changed, 30 insertions, 4 deletions
diff --git a/Source/Core/VideoBackends/Software/EfbInterface.cpp b/Source/Core/VideoBackends/Software/EfbInterface.cpp index a13feb6c50..bb3cfeda90 100644 --- a/Source/Core/VideoBackends/Software/EfbInterface.cpp +++ b/Source/Core/VideoBackends/Software/EfbInterface.cpp @@ -5,6 +5,7 @@ #include "VideoBackends/Software/EfbInterface.h" #include <algorithm> +#include <array> #include <cstddef> #include <cstring> #include <vector> @@ -18,11 +19,11 @@ #include "VideoCommon/LookUpTables.h" #include "VideoCommon/PerfQueryBase.h" -static u8 efb[EFB_WIDTH * EFB_HEIGHT * 6]; - 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) { @@ -31,7 +32,9 @@ static inline u32 GetColorOffset(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) @@ -682,4 +685,27 @@ bool ZCompare(u16 x, u16 y, u32 z) 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]; +} } |
