mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2024-11-15 05:47:56 -07:00
Merge pull request #224 from magumagu/swrender-deletepixelfork
Software backend: Delete forked PixelEngine.
This commit is contained in:
commit
306b9afd1e
@ -33,6 +33,7 @@
|
||||
#include "Core/PowerPC/PowerPC.h"
|
||||
#include "Core/PowerPC/JitCommon/JitBase.h"
|
||||
|
||||
#include "VideoCommon/PixelEngine.h"
|
||||
#include "VideoCommon/VideoBackendBase.h"
|
||||
|
||||
namespace Memory
|
||||
@ -89,7 +90,7 @@ MMIO::Mapping* mmio_mapping;
|
||||
void InitMMIO(MMIO::Mapping* mmio)
|
||||
{
|
||||
g_video_backend->RegisterCPMMIO(mmio, 0xCC000000);
|
||||
g_video_backend->RegisterPEMMIO(mmio, 0xCC001000);
|
||||
PixelEngine::RegisterMMIO(mmio, 0xCC001000);
|
||||
VideoInterface::RegisterMMIO(mmio, 0xCC002000);
|
||||
ProcessorInterface::RegisterMMIO(mmio, 0xCC003000);
|
||||
MemoryInterface::RegisterMMIO(mmio, 0xCC004000);
|
||||
|
@ -7,10 +7,11 @@
|
||||
|
||||
#include "VideoBackends/Software/BPMemLoader.h"
|
||||
#include "VideoBackends/Software/EfbCopy.h"
|
||||
#include "VideoBackends/Software/EfbInterface.h"
|
||||
#include "VideoBackends/Software/Rasterizer.h"
|
||||
#include "VideoBackends/Software/SWPixelEngine.h"
|
||||
#include "VideoBackends/Software/Tev.h"
|
||||
|
||||
#include "VideoCommon/PixelEngine.h"
|
||||
#include "VideoCommon/TextureDecoder.h"
|
||||
#include "VideoCommon/VideoCommon.h"
|
||||
|
||||
@ -50,7 +51,7 @@ void SWBPWritten(int address, int newvalue)
|
||||
switch (bpmem.drawdone & 0xFF)
|
||||
{
|
||||
case 0x02:
|
||||
SWPixelEngine::SetFinish(); // may generate interrupt
|
||||
PixelEngine::SetFinish(); // may generate interrupt
|
||||
DEBUG_LOG(VIDEO, "GXSetDrawDone SetPEFinish (value: 0x%02X)", (bpmem.drawdone & 0xFFFF));
|
||||
break;
|
||||
|
||||
@ -61,37 +62,26 @@ void SWBPWritten(int address, int newvalue)
|
||||
break;
|
||||
case BPMEM_PE_TOKEN_ID: // Pixel Engine Token ID
|
||||
DEBUG_LOG(VIDEO, "SetPEToken 0x%04x", (bpmem.petoken & 0xFFFF));
|
||||
SWPixelEngine::SetToken(static_cast<u16>(bpmem.petokenint & 0xFFFF), false);
|
||||
PixelEngine::SetToken(static_cast<u16>(bpmem.petokenint & 0xFFFF), false);
|
||||
break;
|
||||
case BPMEM_PE_TOKEN_INT_ID: // Pixel Engine Interrupt Token ID
|
||||
DEBUG_LOG(VIDEO, "SetPEToken + INT 0x%04x", (bpmem.petokenint & 0xFFFF));
|
||||
SWPixelEngine::SetToken(static_cast<u16>(bpmem.petokenint & 0xFFFF), true);
|
||||
PixelEngine::SetToken(static_cast<u16>(bpmem.petokenint & 0xFFFF), true);
|
||||
break;
|
||||
case BPMEM_TRIGGER_EFB_COPY:
|
||||
EfbCopy::CopyEfb();
|
||||
break;
|
||||
case BPMEM_CLEARBBOX1:
|
||||
SWPixelEngine::pereg.boxRight = newvalue >> 10;
|
||||
SWPixelEngine::pereg.boxLeft = newvalue & 0x3ff;
|
||||
PixelEngine::bbox[0] = newvalue >> 10;
|
||||
PixelEngine::bbox[1] = newvalue & 0x3ff;
|
||||
break;
|
||||
case BPMEM_CLEARBBOX2:
|
||||
SWPixelEngine::pereg.boxBottom = newvalue >> 10;
|
||||
SWPixelEngine::pereg.boxTop = newvalue & 0x3ff;
|
||||
PixelEngine::bbox[2] = newvalue >> 10;
|
||||
PixelEngine::bbox[3] = newvalue & 0x3ff;
|
||||
break;
|
||||
case BPMEM_CLEAR_PIXEL_PERF:
|
||||
// TODO: I didn't test if the value written to this register affects the amount of cleared registers
|
||||
SWPixelEngine::pereg.perfZcompInputZcomplocLo = 0;
|
||||
SWPixelEngine::pereg.perfZcompInputZcomplocHi = 0;
|
||||
SWPixelEngine::pereg.perfZcompOutputZcomplocLo = 0;
|
||||
SWPixelEngine::pereg.perfZcompOutputZcomplocHi = 0;
|
||||
SWPixelEngine::pereg.perfZcompInputLo = 0;
|
||||
SWPixelEngine::pereg.perfZcompInputHi = 0;
|
||||
SWPixelEngine::pereg.perfZcompOutputLo = 0;
|
||||
SWPixelEngine::pereg.perfZcompOutputHi = 0;
|
||||
SWPixelEngine::pereg.perfBlendInputLo = 0;
|
||||
SWPixelEngine::pereg.perfBlendInputHi = 0;
|
||||
SWPixelEngine::pereg.perfEfbCopyClocksLo = 0;
|
||||
SWPixelEngine::pereg.perfEfbCopyClocksHi = 0;
|
||||
memset(EfbInterface::perf_values, 0, sizeof(EfbInterface::perf_values));
|
||||
break;
|
||||
case BPMEM_LOADTLUT0: // This one updates bpmem.tlutXferSrc, no need to do anything here.
|
||||
break;
|
||||
|
@ -8,7 +8,6 @@ set(SRCS BPMemLoader.cpp
|
||||
HwRasterizer.cpp
|
||||
SWmain.cpp
|
||||
OpcodeDecoder.cpp
|
||||
SWPixelEngine.cpp
|
||||
RasterFont.cpp
|
||||
Rasterizer.cpp
|
||||
SWRenderer.cpp
|
||||
|
@ -2,20 +2,24 @@
|
||||
// Licensed under GPLv2
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include "Common/Common.h"
|
||||
#include "Core/HW/Memmap.h"
|
||||
|
||||
#include "VideoBackends/Software/BPMemLoader.h"
|
||||
#include "VideoBackends/Software/EfbInterface.h"
|
||||
#include "VideoBackends/Software/SWPixelEngine.h"
|
||||
|
||||
#include "VideoCommon/LookUpTables.h"
|
||||
#include "VideoCommon/PixelEngine.h"
|
||||
|
||||
|
||||
u8 efb[EFB_WIDTH*EFB_HEIGHT*6];
|
||||
|
||||
namespace EfbInterface
|
||||
{
|
||||
u32 perf_values[PQ_NUM_MEMBERS];
|
||||
|
||||
inline u32 GetColorOffset(u16 x, u16 y)
|
||||
{
|
||||
return (x + y * EFB_WIDTH) * 3;
|
||||
@ -434,10 +438,10 @@ namespace EfbInterface
|
||||
}
|
||||
|
||||
// branchless bounding box update
|
||||
SWPixelEngine::pereg.boxLeft = SWPixelEngine::pereg.boxLeft>x?x:SWPixelEngine::pereg.boxLeft;
|
||||
SWPixelEngine::pereg.boxRight = SWPixelEngine::pereg.boxRight<x?x:SWPixelEngine::pereg.boxRight;
|
||||
SWPixelEngine::pereg.boxTop = SWPixelEngine::pereg.boxTop>y?y:SWPixelEngine::pereg.boxTop;
|
||||
SWPixelEngine::pereg.boxBottom = SWPixelEngine::pereg.boxBottom<y?y:SWPixelEngine::pereg.boxBottom;
|
||||
PixelEngine::bbox[0] = std::min(x, PixelEngine::bbox[0]);
|
||||
PixelEngine::bbox[1] = std::max(x, PixelEngine::bbox[1]);
|
||||
PixelEngine::bbox[2] = std::min(y, PixelEngine::bbox[2]);
|
||||
PixelEngine::bbox[3] = std::max(y, PixelEngine::bbox[3]);
|
||||
}
|
||||
|
||||
void SetColor(u16 x, u16 y, u8 *color)
|
||||
|
@ -51,4 +51,18 @@ namespace EfbInterface
|
||||
void BypassXFB(u8* texture, u32 fbWidth, u32 fbHeight, const EFBRectangle& sourceRc, float Gamma);
|
||||
|
||||
void DoState(PointerWrap &p);
|
||||
|
||||
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];
|
||||
}
|
||||
}
|
||||
|
@ -8,7 +8,6 @@
|
||||
#include "VideoBackends/Software/EfbInterface.h"
|
||||
#include "VideoBackends/Software/HwRasterizer.h"
|
||||
#include "VideoBackends/Software/Rasterizer.h"
|
||||
#include "VideoBackends/Software/SWPixelEngine.h"
|
||||
#include "VideoBackends/Software/SWStatistics.h"
|
||||
#include "VideoBackends/Software/SWVideoConfig.h"
|
||||
#include "VideoBackends/Software/Tev.h"
|
||||
@ -130,14 +129,14 @@ inline void Draw(s32 x, s32 y, s32 xi, s32 yi)
|
||||
if (bpmem.UseEarlyDepthTest() && g_SWVideoConfig.bZComploc)
|
||||
{
|
||||
// TODO: Test if perf regs are incremented even if test is disabled
|
||||
SWPixelEngine::pereg.IncZInputQuadCount(true);
|
||||
EfbInterface::IncPerfCounterQuadCount(PQ_ZCOMP_INPUT_ZCOMPLOC);
|
||||
if (bpmem.zmode.testenable)
|
||||
{
|
||||
// early z
|
||||
if (!EfbInterface::ZCompare(x, y, z))
|
||||
return;
|
||||
}
|
||||
SWPixelEngine::pereg.IncZOutputQuadCount(true);
|
||||
EfbInterface::IncPerfCounterQuadCount(PQ_ZCOMP_OUTPUT_ZCOMPLOC);
|
||||
}
|
||||
|
||||
RasterBlockPixel& pixel = rasterBlock.Pixel[xi][yi];
|
||||
|
@ -1,147 +0,0 @@
|
||||
// Copyright 2013 Dolphin Emulator Project
|
||||
// Licensed under GPLv2
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
// http://developer.nvidia.com/object/General_FAQ.html#t6 !!!!!
|
||||
|
||||
#include "Common/ChunkFile.h"
|
||||
#include "Common/Common.h"
|
||||
|
||||
#include "Core/ConfigManager.h"
|
||||
#include "Core/CoreTiming.h"
|
||||
#include "Core/HW/MMIO.h"
|
||||
#include "Core/HW/ProcessorInterface.h"
|
||||
|
||||
#include "VideoBackends/Software/SWCommandProcessor.h"
|
||||
#include "VideoBackends/Software/SWPixelEngine.h"
|
||||
|
||||
|
||||
namespace SWPixelEngine
|
||||
{
|
||||
|
||||
enum
|
||||
{
|
||||
INT_CAUSE_PE_TOKEN = 0x200, // GP Token
|
||||
INT_CAUSE_PE_FINISH = 0x400, // GP Finished
|
||||
};
|
||||
|
||||
// STATE_TO_SAVE
|
||||
PEReg pereg;
|
||||
|
||||
static bool g_bSignalTokenInterrupt;
|
||||
static bool g_bSignalFinishInterrupt;
|
||||
|
||||
static int et_SetTokenOnMainThread;
|
||||
static int et_SetFinishOnMainThread;
|
||||
|
||||
void DoState(PointerWrap &p)
|
||||
{
|
||||
p.DoPOD(pereg);
|
||||
p.Do(g_bSignalTokenInterrupt);
|
||||
p.Do(g_bSignalFinishInterrupt);
|
||||
p.Do(et_SetTokenOnMainThread);
|
||||
p.Do(et_SetFinishOnMainThread);
|
||||
}
|
||||
|
||||
void UpdateInterrupts();
|
||||
|
||||
void SetToken_OnMainThread(u64 userdata, int cyclesLate);
|
||||
void SetFinish_OnMainThread(u64 userdata, int cyclesLate);
|
||||
|
||||
void Init()
|
||||
{
|
||||
memset(&pereg, 0, sizeof(pereg));
|
||||
|
||||
et_SetTokenOnMainThread = false;
|
||||
g_bSignalFinishInterrupt = false;
|
||||
|
||||
et_SetTokenOnMainThread = CoreTiming::RegisterEvent("SetToken", SetToken_OnMainThread);
|
||||
et_SetFinishOnMainThread = CoreTiming::RegisterEvent("SetFinish", SetFinish_OnMainThread);
|
||||
}
|
||||
|
||||
void RegisterMMIO(MMIO::Mapping* mmio, u32 base)
|
||||
{
|
||||
// Directly map reads and writes to the pereg structure.
|
||||
for (size_t i = 0; i < sizeof (pereg) / sizeof (u16); ++i)
|
||||
{
|
||||
u16* ptr = (u16*)&pereg + i;
|
||||
mmio->Register(base | (i * 2),
|
||||
MMIO::DirectRead<u16>(ptr),
|
||||
MMIO::DirectWrite<u16>(ptr)
|
||||
);
|
||||
}
|
||||
|
||||
// The control register has some more complex logic to perform on writes.
|
||||
mmio->RegisterWrite(base | PE_CTRL_REGISTER,
|
||||
MMIO::ComplexWrite<u16>([](u32, u16 val) {
|
||||
UPECtrlReg tmpCtrl(val);
|
||||
|
||||
if (tmpCtrl.PEToken) g_bSignalTokenInterrupt = false;
|
||||
if (tmpCtrl.PEFinish) g_bSignalFinishInterrupt = false;
|
||||
|
||||
pereg.ctrl.PETokenEnable = tmpCtrl.PETokenEnable;
|
||||
pereg.ctrl.PEFinishEnable = tmpCtrl.PEFinishEnable;
|
||||
pereg.ctrl.PEToken = 0; // this flag is write only
|
||||
pereg.ctrl.PEFinish = 0; // this flag is write only
|
||||
|
||||
UpdateInterrupts();
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
bool AllowIdleSkipping()
|
||||
{
|
||||
return !SConfig::GetInstance().m_LocalCoreStartupParameter.bCPUThread || (!pereg.ctrl.PETokenEnable && !pereg.ctrl.PEFinishEnable);
|
||||
}
|
||||
|
||||
void UpdateInterrupts()
|
||||
{
|
||||
// check if there is a token-interrupt
|
||||
if (g_bSignalTokenInterrupt & pereg.ctrl.PETokenEnable)
|
||||
ProcessorInterface::SetInterrupt(INT_CAUSE_PE_TOKEN, true);
|
||||
else
|
||||
ProcessorInterface::SetInterrupt(INT_CAUSE_PE_TOKEN, false);
|
||||
|
||||
// check if there is a finish-interrupt
|
||||
if (g_bSignalFinishInterrupt & pereg.ctrl.PEFinishEnable)
|
||||
ProcessorInterface::SetInterrupt(INT_CAUSE_PE_FINISH, true);
|
||||
else
|
||||
ProcessorInterface::SetInterrupt(INT_CAUSE_PE_FINISH, false);
|
||||
}
|
||||
|
||||
|
||||
// Called only if BPMEM_PE_TOKEN_INT_ID is ack by GP
|
||||
void SetToken_OnMainThread(u64 userdata, int cyclesLate)
|
||||
{
|
||||
g_bSignalTokenInterrupt = true;
|
||||
INFO_LOG(PIXELENGINE, "VIDEO Backend raises INT_CAUSE_PE_TOKEN (btw, token: %04x)", pereg.token);
|
||||
UpdateInterrupts();
|
||||
}
|
||||
|
||||
void SetFinish_OnMainThread(u64 userdata, int cyclesLate)
|
||||
{
|
||||
g_bSignalFinishInterrupt = true;
|
||||
UpdateInterrupts();
|
||||
}
|
||||
|
||||
// SetToken
|
||||
// THIS IS EXECUTED FROM VIDEO THREAD
|
||||
void SetToken(const u16 _token, const int _bSetTokenAcknowledge)
|
||||
{
|
||||
pereg.token = _token;
|
||||
if (_bSetTokenAcknowledge) // set token INT
|
||||
{
|
||||
CoreTiming::ScheduleEvent_Threadsafe(0, et_SetTokenOnMainThread,
|
||||
_token | (_bSetTokenAcknowledge << 16));
|
||||
}
|
||||
}
|
||||
|
||||
// SetFinish
|
||||
// THIS IS EXECUTED FROM VIDEO THREAD
|
||||
void SetFinish()
|
||||
{
|
||||
CoreTiming::ScheduleEvent_Threadsafe(0, et_SetFinishOnMainThread, 0);
|
||||
INFO_LOG(PIXELENGINE, "VIDEO Set Finish");
|
||||
}
|
||||
|
||||
} // end of namespace SWPixelEngine
|
@ -1,211 +0,0 @@
|
||||
// Copyright 2013 Dolphin Emulator Project
|
||||
// Licensed under GPLv2
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Common/Common.h"
|
||||
#include "VideoCommon/VideoCommon.h"
|
||||
|
||||
class PointerWrap;
|
||||
namespace MMIO { class Mapping; }
|
||||
|
||||
namespace SWPixelEngine
|
||||
{
|
||||
// internal hardware addresses
|
||||
enum
|
||||
{
|
||||
PE_ZCONF = 0x000, // Z Config
|
||||
PE_ALPHACONF = 0x002, // Alpha Config
|
||||
PE_DSTALPHACONF = 0x004, // Destination Alpha Config
|
||||
PE_ALPHAMODE = 0x006, // Alpha Mode Config
|
||||
PE_ALPHAREAD = 0x008, // Alpha Read
|
||||
PE_CTRL_REGISTER = 0x00a, // Control
|
||||
PE_TOKEN_REG = 0x00e, // Token
|
||||
PE_BBOX_LEFT = 0x010, // Flip Left
|
||||
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
|
||||
{
|
||||
u16 Hex;
|
||||
struct
|
||||
{
|
||||
u16 ZCompEnable : 1; // Z Comparator Enable
|
||||
u16 Function : 3;
|
||||
u16 ZUpdEnable : 1;
|
||||
u16 : 11;
|
||||
};
|
||||
};
|
||||
|
||||
union UPEAlphaConfReg
|
||||
{
|
||||
u16 Hex;
|
||||
struct
|
||||
{
|
||||
u16 BMMath : 1; // GX_BM_BLEND || GX_BM_SUBSTRACT
|
||||
u16 BMLogic : 1; // GX_BM_LOGIC
|
||||
u16 Dither : 1;
|
||||
u16 ColorUpdEnable : 1;
|
||||
u16 AlphaUpdEnable : 1;
|
||||
u16 DstFactor : 3;
|
||||
u16 SrcFactor : 3;
|
||||
u16 Substract : 1; // Additive mode by default
|
||||
u16 BlendOperator : 4;
|
||||
};
|
||||
};
|
||||
|
||||
union UPEDstAlphaConfReg
|
||||
{
|
||||
u16 Hex;
|
||||
struct
|
||||
{
|
||||
u16 DstAlpha : 8;
|
||||
u16 Enable : 1;
|
||||
u16 : 7;
|
||||
};
|
||||
};
|
||||
|
||||
union UPEAlphaModeConfReg
|
||||
{
|
||||
u16 Hex;
|
||||
struct
|
||||
{
|
||||
u16 Threshold : 8;
|
||||
u16 CompareMode : 8;
|
||||
};
|
||||
};
|
||||
|
||||
union UPEAlphaReadReg
|
||||
{
|
||||
u16 Hex;
|
||||
struct
|
||||
{
|
||||
u16 ReadMode : 3;
|
||||
u16 : 13;
|
||||
};
|
||||
};
|
||||
|
||||
union UPECtrlReg
|
||||
{
|
||||
struct
|
||||
{
|
||||
u16 PETokenEnable : 1;
|
||||
u16 PEFinishEnable : 1;
|
||||
u16 PEToken : 1; // write only
|
||||
u16 PEFinish : 1; // write only
|
||||
u16 : 12;
|
||||
};
|
||||
u16 Hex;
|
||||
UPECtrlReg() {Hex = 0; }
|
||||
UPECtrlReg(u16 _hex) {Hex = _hex; }
|
||||
};
|
||||
|
||||
struct PEReg
|
||||
{
|
||||
UPEZConfReg zconf;
|
||||
UPEAlphaConfReg alphaConf;
|
||||
UPEDstAlphaConfReg dstAlpha;
|
||||
UPEAlphaModeConfReg alphaMode;
|
||||
UPEAlphaReadReg alphaRead;
|
||||
UPECtrlReg ctrl;
|
||||
u16 unk0;
|
||||
u16 token;
|
||||
|
||||
u16 boxLeft;
|
||||
u16 boxRight;
|
||||
u16 boxTop;
|
||||
u16 boxBottom;
|
||||
|
||||
u16 perfZcompInputZcomplocLo;
|
||||
u16 perfZcompInputZcomplocHi;
|
||||
u16 perfZcompOutputZcomplocLo;
|
||||
u16 perfZcompOutputZcomplocHi;
|
||||
u16 perfZcompInputLo;
|
||||
u16 perfZcompInputHi;
|
||||
u16 perfZcompOutputLo;
|
||||
u16 perfZcompOutputHi;
|
||||
u16 perfBlendInputLo;
|
||||
u16 perfBlendInputHi;
|
||||
u16 perfEfbCopyClocksLo;
|
||||
u16 perfEfbCopyClocksHi;
|
||||
|
||||
// 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
|
||||
void IncZInputQuadCount(bool early_ztest)
|
||||
{
|
||||
static int quad = 0;
|
||||
if (++quad != 3)
|
||||
return;
|
||||
quad = 0;
|
||||
|
||||
if (early_ztest)
|
||||
{
|
||||
if (++perfZcompInputZcomplocLo == 0)
|
||||
perfZcompInputZcomplocHi++;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (++perfZcompInputLo == 0)
|
||||
perfZcompInputHi++;
|
||||
}
|
||||
}
|
||||
void IncZOutputQuadCount(bool early_ztest)
|
||||
{
|
||||
static int quad = 0;
|
||||
if (++quad != 3)
|
||||
return;
|
||||
quad = 0;
|
||||
|
||||
if (early_ztest)
|
||||
{
|
||||
if (++perfZcompOutputZcomplocLo == 0)
|
||||
perfZcompOutputZcomplocHi++;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (++perfZcompOutputLo == 0)
|
||||
perfZcompOutputHi++;
|
||||
}
|
||||
}
|
||||
void IncBlendInputQuadCount()
|
||||
{
|
||||
static int quad = 0;
|
||||
if (++quad != 3)
|
||||
return;
|
||||
quad = 0;
|
||||
|
||||
if (++perfBlendInputLo == 0)
|
||||
perfBlendInputHi++;
|
||||
}
|
||||
};
|
||||
|
||||
extern PEReg pereg;
|
||||
|
||||
void Init();
|
||||
void DoState(PointerWrap &p);
|
||||
|
||||
void RegisterMMIO(MMIO::Mapping* mmio, u32 base);
|
||||
|
||||
// gfx backend support
|
||||
void SetToken(const u16 _token, const int _bSetTokenAcknowledge);
|
||||
void SetFinish(void);
|
||||
bool AllowIdleSkipping();
|
||||
|
||||
} // end of namespace SWPixelEngine
|
@ -24,7 +24,6 @@
|
||||
#include "VideoBackends/Software/OpcodeDecoder.h"
|
||||
#include "VideoBackends/Software/Rasterizer.h"
|
||||
#include "VideoBackends/Software/SWCommandProcessor.h"
|
||||
#include "VideoBackends/Software/SWPixelEngine.h"
|
||||
#include "VideoBackends/Software/SWRenderer.h"
|
||||
#include "VideoBackends/Software/SWStatistics.h"
|
||||
#include "VideoBackends/Software/SWVertexLoader.h"
|
||||
@ -37,6 +36,8 @@
|
||||
#endif // HAVE_WX
|
||||
|
||||
#include "VideoCommon/OnScreenDisplay.h"
|
||||
#include "VideoCommon/PixelEngine.h"
|
||||
#include "VideoCommon/XFMemory.h"
|
||||
|
||||
#define VSYNC_ENABLED 0
|
||||
|
||||
@ -89,7 +90,7 @@ bool VideoSoftware::Initialize(void *&window_handle)
|
||||
InitBPMemory();
|
||||
InitXFMemory();
|
||||
SWCommandProcessor::Init();
|
||||
SWPixelEngine::Init();
|
||||
PixelEngine::Init();
|
||||
OpcodeDecoder::Init();
|
||||
Clipper::Init();
|
||||
Rasterizer::Init();
|
||||
@ -110,7 +111,7 @@ void VideoSoftware::DoState(PointerWrap& p)
|
||||
|
||||
// TODO: incomplete?
|
||||
SWCommandProcessor::DoState(p);
|
||||
SWPixelEngine::DoState(p);
|
||||
PixelEngine::DoState(p);
|
||||
EfbInterface::DoState(p);
|
||||
OpcodeDecoder::DoState(p);
|
||||
Clipper::DoState(p);
|
||||
@ -283,8 +284,7 @@ u32 VideoSoftware::Video_AccessEFB(EFBAccessType type, u32 x, u32 y, u32 InputDa
|
||||
|
||||
u32 VideoSoftware::Video_GetQueryResult(PerfQueryType type)
|
||||
{
|
||||
// TODO:
|
||||
return 0;
|
||||
return EfbInterface::perf_values[type];
|
||||
}
|
||||
|
||||
bool VideoSoftware::Video_Screenshot(const std::string& filename)
|
||||
@ -376,11 +376,6 @@ void VideoSoftware::RegisterCPMMIO(MMIO::Mapping* mmio, u32 base)
|
||||
SWCommandProcessor::RegisterMMIO(mmio, base);
|
||||
}
|
||||
|
||||
void VideoSoftware::RegisterPEMMIO(MMIO::Mapping* mmio, u32 base)
|
||||
{
|
||||
SWPixelEngine::RegisterMMIO(mmio, base);
|
||||
}
|
||||
|
||||
// Draw messages on top of the screen
|
||||
unsigned int VideoSoftware::PeekMessages()
|
||||
{
|
||||
|
@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
@ -59,7 +59,6 @@
|
||||
</ClCompile>
|
||||
<ClCompile Include="SWCommandProcessor.cpp" />
|
||||
<ClCompile Include="SWmain.cpp" />
|
||||
<ClCompile Include="SWPixelEngine.cpp" />
|
||||
<ClCompile Include="SWRenderer.cpp" />
|
||||
<ClCompile Include="SWStatistics.cpp" />
|
||||
<ClCompile Include="SWVertexLoader.cpp" />
|
||||
@ -86,7 +85,6 @@
|
||||
<ClInclude Include="SetupUnit.h" />
|
||||
<ClInclude Include="stdafx.h" />
|
||||
<ClInclude Include="SWCommandProcessor.h" />
|
||||
<ClInclude Include="SWPixelEngine.h" />
|
||||
<ClInclude Include="SWRenderer.h" />
|
||||
<ClInclude Include="SWStatistics.h" />
|
||||
<ClInclude Include="SWVertexLoader.h" />
|
||||
@ -114,4 +112,4 @@
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
</Project>
|
@ -8,7 +8,6 @@
|
||||
|
||||
#include "VideoBackends/Software/DebugUtil.h"
|
||||
#include "VideoBackends/Software/EfbInterface.h"
|
||||
#include "VideoBackends/Software/SWPixelEngine.h"
|
||||
#include "VideoBackends/Software/SWStatistics.h"
|
||||
#include "VideoBackends/Software/SWVideoConfig.h"
|
||||
#include "VideoBackends/Software/Tev.h"
|
||||
@ -745,12 +744,12 @@ void Tev::Draw()
|
||||
if (late_ztest && bpmem.zmode.testenable)
|
||||
{
|
||||
// TODO: Check against hw if these values get incremented even if depth testing is disabled
|
||||
SWPixelEngine::pereg.IncZInputQuadCount(false);
|
||||
EfbInterface::IncPerfCounterQuadCount(PQ_ZCOMP_INPUT);
|
||||
|
||||
if (!EfbInterface::ZCompare(Position[0], Position[1], Position[2]))
|
||||
return;
|
||||
|
||||
SWPixelEngine::pereg.IncZOutputQuadCount(false);
|
||||
EfbInterface::IncPerfCounterQuadCount(PQ_ZCOMP_OUTPUT);
|
||||
}
|
||||
|
||||
#if ALLOW_TEV_DUMPS
|
||||
@ -774,7 +773,7 @@ void Tev::Draw()
|
||||
#endif
|
||||
|
||||
INCSTAT(swstats.thisFrame.tevPixelsOut);
|
||||
SWPixelEngine::pereg.IncBlendInputQuadCount();
|
||||
EfbInterface::IncPerfCounterQuadCount(PQ_BLEND_INPUT);
|
||||
|
||||
EfbInterface::BlendTev(Position[0], Position[1], output);
|
||||
}
|
||||
|
@ -48,7 +48,6 @@ class VideoSoftware : public VideoBackend
|
||||
void Video_AbortFrame() override;
|
||||
|
||||
void RegisterCPMMIO(MMIO::Mapping* mmio, u32 base) override;
|
||||
void RegisterPEMMIO(MMIO::Mapping* mmio, u32 base) override;
|
||||
|
||||
void UpdateFPSDisplay(const std::string&) override;
|
||||
unsigned int PeekMessages() override;
|
||||
|
@ -8,7 +8,7 @@
|
||||
#include "VideoBackends/Software/XFMemLoader.h"
|
||||
#include "VideoCommon/VideoCommon.h"
|
||||
|
||||
XFRegisters swxfregs;
|
||||
SWXFRegisters swxfregs;
|
||||
|
||||
void InitXFMemory()
|
||||
{
|
||||
|
@ -6,104 +6,7 @@
|
||||
|
||||
#include "Common/Common.h"
|
||||
|
||||
/////////////
|
||||
// Lighting
|
||||
/////////////
|
||||
|
||||
#define XF_TEXPROJ_ST 0
|
||||
#define XF_TEXPROJ_STQ 1
|
||||
|
||||
#define XF_TEXINPUT_AB11 0
|
||||
#define XF_TEXINPUT_ABC1 1
|
||||
|
||||
#define XF_TEXGEN_REGULAR 0
|
||||
#define XF_TEXGEN_EMBOSS_MAP 1 // used when bump mapping
|
||||
#define XF_TEXGEN_COLOR_STRGBC0 2
|
||||
#define XF_TEXGEN_COLOR_STRGBC1 3
|
||||
|
||||
#define XF_SRCGEOM_INROW 0 // input is abc
|
||||
#define XF_SRCNORMAL_INROW 1 // input is abc
|
||||
#define XF_SRCCOLORS_INROW 2
|
||||
#define XF_SRCBINORMAL_T_INROW 3 // input is abc
|
||||
#define XF_SRCBINORMAL_B_INROW 4 // input is abc
|
||||
#define XF_SRCTEX0_INROW 5
|
||||
#define XF_SRCTEX1_INROW 6
|
||||
#define XF_SRCTEX2_INROW 7
|
||||
#define XF_SRCTEX3_INROW 8
|
||||
#define XF_SRCTEX4_INROW 9
|
||||
#define XF_SRCTEX5_INROW 10
|
||||
#define XF_SRCTEX6_INROW 11
|
||||
#define XF_SRCTEX7_INROW 12
|
||||
|
||||
#define GX_SRC_REG 0
|
||||
#define GX_SRC_VTX 1
|
||||
|
||||
struct Light
|
||||
{
|
||||
u32 useless[3];
|
||||
u32 color; //rgba
|
||||
float a0; //attenuation
|
||||
float a1;
|
||||
float a2;
|
||||
float k0; //k stuff
|
||||
float k1;
|
||||
float k2;
|
||||
union
|
||||
{
|
||||
struct {
|
||||
float dpos[3];
|
||||
float ddir[3]; // specular lights only
|
||||
};
|
||||
struct {
|
||||
float sdir[3];
|
||||
float shalfangle[3]; // specular lights only
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
#define LIGHTDIF_NONE 0
|
||||
#define LIGHTDIF_SIGN 1
|
||||
#define LIGHTDIF_CLAMP 2
|
||||
|
||||
#define LIGHTATTN_SPEC 0 // specular attenuation
|
||||
#define LIGHTATTN_SPOT 1 // distance/spotlight attenuation
|
||||
#define LIGHTATTN_NONE 2
|
||||
#define LIGHTATTN_DIR 3
|
||||
|
||||
#define GX_PERSPECTIVE 0
|
||||
#define GX_ORTHOGRAPHIC 1
|
||||
|
||||
union LitChannel
|
||||
{
|
||||
struct
|
||||
{
|
||||
u32 matsource : 1;
|
||||
u32 enablelighting : 1;
|
||||
u32 lightMask0_3 : 4;
|
||||
u32 ambsource : 1;
|
||||
u32 diffusefunc : 2; // LIGHTDIF_X
|
||||
u32 attnfunc : 2; // LIGHTATTN_X
|
||||
u32 lightMask4_7 : 4;
|
||||
u32 unused : 17;
|
||||
};
|
||||
u32 hex;
|
||||
unsigned int GetFullLightMask() const
|
||||
{
|
||||
return enablelighting ? (lightMask0_3 | (lightMask4_7 << 4)) : 0;
|
||||
}
|
||||
};
|
||||
|
||||
union INVTXSPEC
|
||||
{
|
||||
struct
|
||||
{
|
||||
u32 numcolors : 2;
|
||||
u32 numnormals : 2; // 0 - nothing, 1 - just normal, 2 - normals and binormals
|
||||
u32 numtextures : 4;
|
||||
u32 unused : 24;
|
||||
};
|
||||
u32 hex;
|
||||
};
|
||||
#include "VideoCommon/XFMemory.h"
|
||||
|
||||
union TXFMatrixIndexA
|
||||
{
|
||||
@ -138,49 +41,7 @@ union TXFMatrixIndexB
|
||||
};
|
||||
};
|
||||
|
||||
struct Viewport
|
||||
{
|
||||
float wd;
|
||||
float ht;
|
||||
float zRange;
|
||||
float xOrig;
|
||||
float yOrig;
|
||||
float farZ;
|
||||
};
|
||||
|
||||
struct Projection
|
||||
{
|
||||
float rawProjection[6];
|
||||
u32 type; // only GX_PERSPECTIVE or GX_ORTHOGRAPHIC are allowed
|
||||
};
|
||||
|
||||
union TexMtxInfo
|
||||
{
|
||||
struct
|
||||
{
|
||||
u32 unknown : 1;
|
||||
u32 projection : 1; // XF_TEXPROJ_X
|
||||
u32 inputform : 2; // XF_TEXINPUT_X
|
||||
u32 texgentype : 3; // XF_TEXGEN_X
|
||||
u32 sourcerow : 5; // XF_SRCGEOM_X
|
||||
u32 embosssourceshift : 3; // what generated texcoord to use
|
||||
u32 embosslightshift : 3; // light index that is used
|
||||
};
|
||||
u32 hex;
|
||||
};
|
||||
|
||||
union PostMtxInfo
|
||||
{
|
||||
struct
|
||||
{
|
||||
u32 index : 6; // base row of dual transform matrix
|
||||
u32 unused : 2;
|
||||
u32 normalize : 1; // normalize before send operation
|
||||
};
|
||||
u32 hex;
|
||||
};
|
||||
|
||||
struct XFRegisters
|
||||
struct SWXFRegisters
|
||||
{
|
||||
u32 posMatrices[256]; // 0x0000 - 0x00ff
|
||||
u32 unk0[768]; // 0x0100 - 0x03ff
|
||||
@ -220,17 +81,7 @@ struct XFRegisters
|
||||
PostMtxInfo postMtxInfo[8]; // 0x1050 - 0x1057
|
||||
};
|
||||
|
||||
#define XFMEM_POSMATRICES 0x000
|
||||
#define XFMEM_POSMATRICES_END 0x100
|
||||
#define XFMEM_NORMALMATRICES 0x400
|
||||
#define XFMEM_NORMALMATRICES_END 0x460
|
||||
#define XFMEM_POSTMATRICES 0x500
|
||||
#define XFMEM_POSTMATRICES_END 0x600
|
||||
#define XFMEM_LIGHTS 0x600
|
||||
#define XFMEM_LIGHTS_END 0x680
|
||||
|
||||
|
||||
extern XFRegisters swxfregs;
|
||||
extern SWXFRegisters swxfregs;
|
||||
|
||||
void InitXFMemory();
|
||||
|
||||
|
@ -317,7 +317,3 @@ void VideoBackendHardware::RegisterCPMMIO(MMIO::Mapping* mmio, u32 base)
|
||||
CommandProcessor::RegisterMMIO(mmio, base);
|
||||
}
|
||||
|
||||
void VideoBackendHardware::RegisterPEMMIO(MMIO::Mapping* mmio, u32 base)
|
||||
{
|
||||
PixelEngine::RegisterMMIO(mmio, base);
|
||||
}
|
||||
|
@ -110,7 +110,6 @@ public:
|
||||
|
||||
// Registers MMIO handlers for the CommandProcessor registers.
|
||||
virtual void RegisterCPMMIO(MMIO::Mapping* mmio, u32 base) = 0;
|
||||
virtual void RegisterPEMMIO(MMIO::Mapping* mmio, u32 base) = 0;
|
||||
|
||||
static void PopulateList();
|
||||
static void ClearList();
|
||||
@ -159,7 +158,6 @@ class VideoBackendHardware : public VideoBackend
|
||||
void Video_AbortFrame() override;
|
||||
|
||||
void RegisterCPMMIO(MMIO::Mapping* mmio, u32 base) override;
|
||||
void RegisterPEMMIO(MMIO::Mapping* mmio, u32 base) override;
|
||||
|
||||
void PauseAndLock(bool doLock, bool unpauseOnUnlock=true) override;
|
||||
void DoState(PointerWrap &p) override;
|
||||
|
Loading…
Reference in New Issue
Block a user