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(); g_renderer->SetColorMask();
} }
void CopyEFB(u32 dstAddr, unsigned int dstFormat, PEControl::PixelFormat srcFormat, void CopyEFB(u32 dstAddr, const EFBRectangle& srcRect,
const EFBRectangle& srcRect, bool isIntensity, bool scaleByHalf) 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) // 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) if (g_ActiveConfig.bEFBCopyEnable)

View File

@ -24,8 +24,9 @@ void SetBlendMode();
void SetDitherMode(); void SetDitherMode();
void SetLogicOpMode(); void SetLogicOpMode();
void SetColorMask(); void SetColorMask();
void CopyEFB(u32 dstAddr, unsigned int dstFormat, PEControl::PixelFormat srcFormat, void CopyEFB(u32 dstAddr, const EFBRectangle& srcRect,
const EFBRectangle& srcRect, bool isIntensity, bool scaleByHalf); unsigned int dstFormat, PEControl::PixelFormat srcFormat,
bool isIntensity, bool scaleByHalf);
void ClearScreen(const EFBRectangle &rc); void ClearScreen(const EFBRectangle &rc);
void OnPixelFormatChange(); void OnPixelFormatChange();
void SetInterlacingMode(const BPCmd &bp); 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 bottom right is within the rectangle
// The values in bpmem.copyTexSrcXY and bpmem.copyTexSrcWH are updated in case 0x49 and 0x4a in this function // The values in bpmem.copyTexSrcXY and bpmem.copyTexSrcWH are updated in case 0x49 and 0x4a in this function
EFBRectangle rc; u32 destAddr = bpmem.copyTexDest << 5;
rc.left = (int)bpmem.copyTexSrcXY.x;
rc.top = (int)bpmem.copyTexSrcXY.y; 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. // 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? // TODO: What's the behavior of out of bound access?
rc.right = (int)(bpmem.copyTexSrcXY.x + bpmem.copyTexSrcWH.x + 1); srcRect.right = (int)(bpmem.copyTexSrcXY.x + bpmem.copyTexSrcWH.x + 1);
rc.bottom = (int)(bpmem.copyTexSrcXY.y + bpmem.copyTexSrcWH.y + 1); srcRect.bottom = (int)(bpmem.copyTexSrcXY.y + bpmem.copyTexSrcWH.y + 1);
UPE_Copy PE_copy = bpmem.triggerEFBCopy; UPE_Copy PE_copy = bpmem.triggerEFBCopy;
@ -213,11 +215,11 @@ static void BPWritten(const BPCmd& bp)
if (PE_copy.copy_to_xfb == 0) if (PE_copy.copy_to_xfb == 0)
{ {
if (g_ActiveConfig.bShowEFBCopyRegions) if (g_ActiveConfig.bShowEFBCopyRegions)
stats.efb_regions.push_back(rc); stats.efb_regions.push_back(srcRect);
CopyEFB(bpmem.copyTexDest << 5, PE_copy.tp_realFormat(), CopyEFB(destAddr, srcRect,
bpmem.zcontrol.pixel_format, rc, PE_copy.intensity_fmt, PE_copy.tp_realFormat(), bpmem.zcontrol.pixel_format,
PE_copy.half_scale); PE_copy.intensity_fmt, PE_copy.half_scale);
} }
else else
{ {
@ -240,17 +242,18 @@ static void BPWritten(const BPCmd& bp)
xfbLines = MAX_XFB_HEIGHT; xfbLines = MAX_XFB_HEIGHT;
} }
Renderer::RenderToXFB(bpmem.copyTexDest << 5, u32 width = bpmem.copyMipMapStrideChannels << 4;
bpmem.copyMipMapStrideChannels << 4, u32 height = xfbLines;
(u32)xfbLines,
rc, Renderer::RenderToXFB(destAddr, srcRect,
width, height,
s_gammaLUT[PE_copy.gamma]); s_gammaLUT[PE_copy.gamma]);
} }
// Clear the rectangular region after copying it. // Clear the rectangular region after copying it.
if (PE_copy.clear) if (PE_copy.clear)
{ {
ClearScreen(rc); ClearScreen(srcRect);
} }
return; return;

View File

@ -102,7 +102,7 @@ Renderer::~Renderer()
#endif #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(); 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 ClearScreen(const EFBRectangle& rc, bool colorEnable, bool alphaEnable, bool zEnable, u32 color, u32 z) = 0;
virtual void ReinterpretPixelData(unsigned int convtype) = 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; virtual u32 AccessEFB(EFBAccessType type, u32 x, u32 y, u32 poke_data) = 0;