Video_Software: Implement PE pixel metrics

This commit is contained in:
NeoBrainX 2012-06-17 19:49:48 +02:00
parent cf8744cf2c
commit 26de63a8cd
4 changed files with 56 additions and 9 deletions

View File

@ -90,6 +90,15 @@ void SWBPWritten(int address, int newvalue)
SWPixelEngine::pereg.boxBottom = newvalue >> 10;
SWPixelEngine::pereg.boxTop = newvalue & 0x3ff;
break;
case BPMEM_CLEAR_PIXEL_PERF:
// TODO: Parameter?
SWPixelEngine::pereg.perfZcompInputZcomploc = 0;
SWPixelEngine::pereg.perfZcompOutputZcomploc = 0;
SWPixelEngine::pereg.perfZcompInput = 0;
SWPixelEngine::pereg.perfZcompOutput = 0;
SWPixelEngine::pereg.perfBlendInput = 0;
SWPixelEngine::pereg.perfEfbCopyClocks = 0;
break;
case BPMEM_LOADTLUT0: // This one updates bpmem.tlutXferSrc, no need to do anything here.
break;
case BPMEM_LOADTLUT1: // Load a Texture Look Up Table

View File

@ -23,6 +23,7 @@
#include "BPMemLoader.h"
#include "XFMemLoader.h"
#include "Tev.h"
#include "SWPixelEngine.h"
#include "SWStatistics.h"
#include "SWVideoConfig.h"
@ -125,11 +126,17 @@ inline void Draw(s32 x, s32 y, s32 xi, s32 yi)
if (z < 0 || z > 0x00ffffff)
return;
if (bpmem.zcontrol.zcomploc && bpmem.zmode.testenable)
if (bpmem.zcontrol.zcomploc)
{
// early z
if (!EfbInterface::ZCompare(x, y, z))
return;
// TODO: Verify that perf regs are being incremented even if test is disabled
SWPixelEngine::pereg.perfZcompInputZcomploc++;
if (bpmem.zmode.testenable)
{
// early z
if (!EfbInterface::ZCompare(x, y, z))
return;
}
SWPixelEngine::pereg.perfZcompOutputZcomploc++;
}
RasterBlockPixel& pixel = rasterBlock.Pixel[xi][yi];

View File

@ -38,6 +38,21 @@ namespace SWPixelEngine
PE_BBOX_RIGHT = 0x012, // Flip Right
PE_BBOX_TOP = 0x014, // Flip Top
PE_BBOX_BOTTOM = 0x016, // Flip Bottom
// NOTE: Order not verified
// These indicate the number of quads that are being used as input/output for each particular stage
PE_PERF_ZCOMP_INPUT_ZCOMPLOC_L = 0x18,
PE_PERF_ZCOMP_INPUT_ZCOMPLOC_H = 0x1a,
PE_PERF_ZCOMP_OUTPUT_ZCOMPLOC_L = 0x1c,
PE_PERF_ZCOMP_OUTPUT_ZCOMPLOC_H = 0x1e,
PE_PERF_ZCOMP_INPUT_L = 0x20,
PE_PERF_ZCOMP_INPUT_H = 0x22,
PE_PERF_ZCOMP_OUTPUT_L = 0x24,
PE_PERF_ZCOMP_OUTPUT_H = 0x26,
PE_PERF_BLEND_INPUT_L = 0x28,
PE_PERF_BLEND_INPUT_H = 0x2a,
PE_PERF_EFB_COPY_CLOCKS_L = 0x2c,
PE_PERF_EFB_COPY_CLOCKS_H = 0x2e,
};
union UPEZConfReg
@ -125,10 +140,18 @@ namespace SWPixelEngine
UPECtrlReg ctrl;
u16 unk0;
u16 token;
u16 boxLeft;
u16 boxRight;
u16 boxTop;
u16 boxBottom;
u16 perfZcompInputZcomploc;
u16 perfZcompOutputZcomploc;
u16 perfZcompInput;
u16 perfZcompOutput;
u16 perfBlendInput;
u16 perfEfbCopyClocks;
};
extern PEReg pereg;

View File

@ -20,6 +20,7 @@
#include "Tev.h"
#include "EfbInterface.h"
#include "TextureSampler.h"
#include "SWPixelEngine.h"
#include "SWStatistics.h"
#include "SWVideoConfig.h"
#include "DebugUtil.h"
@ -784,11 +785,16 @@ void Tev::Draw()
output[BLU_C] = (output[BLU_C] * invFog + fogInt * bpmem.fog.color.b) >> 8;
}
if (!bpmem.zcontrol.zcomploc && bpmem.zmode.testenable)
{
if (!EfbInterface::ZCompare(Position[0], Position[1], Position[2]))
return;
}
if (!bpmem.zcontrol.zcomploc)
{
SWPixelEngine::pereg.perfZcompInput++;
if (bpmem.zmode.testenable)
{
if (!EfbInterface::ZCompare(Position[0], Position[1], Position[2]))
return;
}
SWPixelEngine::pereg.perfZcompOutput++;
}
#if ALLOW_TEV_DUMPS
if (g_SWVideoConfig.bDumpTevStages)
@ -812,6 +818,8 @@ void Tev::Draw()
INCSTAT(swstats.thisFrame.tevPixelsOut);
SWPixelEngine::pereg.perfBlendInput++;
EfbInterface::BlendTev(Position[0], Position[1], output);
}