BPStructs: Consistently put the two shared copy args first

And rename them so they make a bit more sense.
This commit is contained in:
Jasper St. Pierre 2014-05-03 17:16:18 -04:00
parent 1ae8edc1d0
commit 9d161b4170
5 changed files with 25 additions and 20 deletions

View File

@ -90,8 +90,9 @@ void SetColorMask()
g_renderer->SetColorMask();
}
void CopyEFB(u32 dstAddr, unsigned int dstFormat, PEControl::PixelFormat srcFormat,
const EFBRectangle& srcRect, bool isIntensity, bool scaleByHalf)
void CopyEFB(u32 dstAddr, const EFBRectangle& srcRect,
unsigned int dstFormat, PEControl::PixelFormat srcFormat,
bool isIntensity, bool scaleByHalf)
{
// bpmem.zcontrol.pixel_format to PEControl::Z24 is when the game wants to copy from ZBuffer (Zbuffer uses 24-bit Format)
if (g_ActiveConfig.bEFBCopyEnable)

View File

@ -24,8 +24,9 @@ void SetBlendMode();
void SetDitherMode();
void SetLogicOpMode();
void SetColorMask();
void CopyEFB(u32 dstAddr, unsigned int dstFormat, PEControl::PixelFormat srcFormat,
const EFBRectangle& srcRect, bool isIntensity, bool scaleByHalf);
void CopyEFB(u32 dstAddr, const EFBRectangle& srcRect,
unsigned int dstFormat, PEControl::PixelFormat srcFormat,
bool isIntensity, bool scaleByHalf);
void ClearScreen(const EFBRectangle &rc);
void OnPixelFormatChange();
void SetInterlacingMode(const BPCmd &bp);

View File

@ -198,14 +198,16 @@ static void BPWritten(const BPCmd& bp)
// The bottom right is within the rectangle
// The values in bpmem.copyTexSrcXY and bpmem.copyTexSrcWH are updated in case 0x49 and 0x4a in this function
EFBRectangle rc;
rc.left = (int)bpmem.copyTexSrcXY.x;
rc.top = (int)bpmem.copyTexSrcXY.y;
u32 destAddr = bpmem.copyTexDest << 5;
EFBRectangle srcRect;
srcRect.left = (int)bpmem.copyTexSrcXY.x;
srcRect.top = (int)bpmem.copyTexSrcXY.y;
// Here Width+1 like Height, otherwise some textures are corrupted already since the native resolution.
// TODO: What's the behavior of out of bound access?
rc.right = (int)(bpmem.copyTexSrcXY.x + bpmem.copyTexSrcWH.x + 1);
rc.bottom = (int)(bpmem.copyTexSrcXY.y + bpmem.copyTexSrcWH.y + 1);
srcRect.right = (int)(bpmem.copyTexSrcXY.x + bpmem.copyTexSrcWH.x + 1);
srcRect.bottom = (int)(bpmem.copyTexSrcXY.y + bpmem.copyTexSrcWH.y + 1);
UPE_Copy PE_copy = bpmem.triggerEFBCopy;
@ -213,11 +215,11 @@ static void BPWritten(const BPCmd& bp)
if (PE_copy.copy_to_xfb == 0)
{
if (g_ActiveConfig.bShowEFBCopyRegions)
stats.efb_regions.push_back(rc);
stats.efb_regions.push_back(srcRect);
CopyEFB(bpmem.copyTexDest << 5, PE_copy.tp_realFormat(),
bpmem.zcontrol.pixel_format, rc, PE_copy.intensity_fmt,
PE_copy.half_scale);
CopyEFB(destAddr, srcRect,
PE_copy.tp_realFormat(), bpmem.zcontrol.pixel_format,
PE_copy.intensity_fmt, PE_copy.half_scale);
}
else
{
@ -240,17 +242,18 @@ static void BPWritten(const BPCmd& bp)
xfbLines = MAX_XFB_HEIGHT;
}
Renderer::RenderToXFB(bpmem.copyTexDest << 5,
bpmem.copyMipMapStrideChannels << 4,
(u32)xfbLines,
rc,
u32 width = bpmem.copyMipMapStrideChannels << 4;
u32 height = xfbLines;
Renderer::RenderToXFB(destAddr, srcRect,
width, height,
s_gammaLUT[PE_copy.gamma]);
}
// Clear the rectangular region after copying it.
if (PE_copy.clear)
{
ClearScreen(rc);
ClearScreen(srcRect);
}
return;

View File

@ -102,7 +102,7 @@ Renderer::~Renderer()
#endif
}
void Renderer::RenderToXFB(u32 xfbAddr, u32 fbWidth, u32 fbHeight, const EFBRectangle& sourceRc, float Gamma)
void Renderer::RenderToXFB(u32 xfbAddr, const EFBRectangle& sourceRc, u32 fbWidth, u32 fbHeight, float Gamma)
{
CheckFifoRecording();

View File

@ -97,7 +97,7 @@ public:
virtual void ClearScreen(const EFBRectangle& rc, bool colorEnable, bool alphaEnable, bool zEnable, u32 color, u32 z) = 0;
virtual void ReinterpretPixelData(unsigned int convtype) = 0;
static void RenderToXFB(u32 xfbAddr, u32 fbWidth, u32 fbHeight, const EFBRectangle& sourceRc,float Gamma = 1.0f);
static void RenderToXFB(u32 xfbAddr, const EFBRectangle& sourceRc, u32 fbWidth, u32 fbHeight, float Gamma = 1.0f);
virtual u32 AccessEFB(EFBAccessType type, u32 x, u32 y, u32 poke_data) = 0;