1
0
mirror of https://github.com/blawar/GLideN64.git synced 2024-07-02 09:03:37 +00:00

Correct GraphicsDrawer::copyTexturedRect.

Fixed slide effect in BAR
This commit is contained in:
Sergey Lipskiy 2017-03-10 11:36:03 +07:00
parent cebca46e0a
commit b00a593da0
3 changed files with 23 additions and 10 deletions

View File

@ -1029,7 +1029,10 @@ void FrameBufferList::renderBuffer()
srcWidth = min(rdpRes.vi_width, (rdpRes.vi_hres * rdpRes.vi_x_add) >> 10);
srcHeight = rdpRes.vi_width * ((rdpRes.vi_vres*rdpRes.vi_y_add + rdpRes.vi_y_start) >> 10) / pBuffer->m_width;
if (srcY0 + rdpRes.vi_vres > vFullHeight) {
u32 maxY = gDP.scissor.uly + gDP.scissor.lry;
if (maxY == 0)
maxY = vFullHeight;
if (srcY0 + srcHeight > maxY) {
dstPartHeight = srcY0;
// srcY0 = (s32)(srcY0*yScale);
srcPartHeight = srcY0;
@ -1104,9 +1107,9 @@ void FrameBufferList::renderBuffer()
GraphicsDrawer::BlitOrCopyRectParams blitParams;
blitParams.srcX0 = srcCoord[0];
blitParams.srcY0 = srcCoord[3];
blitParams.srcY0 = srcCoord[1];
blitParams.srcX1 = srcCoord[2];
blitParams.srcY1 = srcCoord[1];
blitParams.srcY1 = srcCoord[3];
blitParams.srcWidth = pBufferTexture->realWidth;
blitParams.srcHeight = pBufferTexture->realHeight;
blitParams.dstX0 = dstCoord[0];
@ -1120,8 +1123,9 @@ void FrameBufferList::renderBuffer()
blitParams.tex[0] = pBufferTexture;
blitParams.combiner = CombinerInfo::get().getTexrectCopyProgram();
blitParams.readBuffer = readBuffer;
blitParams.invertY = true;
drawer.blitOrCopyTexturedRect(blitParams);
drawer.copyTexturedRect(blitParams);
if (dstPartHeight > 0) {
const u32 size = *REG.VI_STATUS & 3;
@ -1129,7 +1133,6 @@ void FrameBufferList::renderBuffer()
if (pBuffer != nullptr) {
pFilteredBuffer = postProcessor.doBlur(postProcessor.doGammaCorrection(
postProcessor.doOrientationCorrection(pBuffer)));
srcY0 = 0;
srcY1 = srcPartHeight;
dstY0 = dstY1;
dstY1 = dstY0 + dstPartHeight;
@ -1155,7 +1158,7 @@ void FrameBufferList::renderBuffer()
blitParams.tex[0] = pBufferTexture;
blitParams.readBuffer = readBuffer;
drawer.blitOrCopyTexturedRect(blitParams);
drawer.copyTexturedRect(blitParams);
}
}

View File

@ -1392,12 +1392,20 @@ void GraphicsDrawer::copyTexturedRect(const CopyRectParams & _params)
const float scaleX = 1.0f / _params.dstWidth;
const float scaleY = 1.0f / _params.dstHeight;
const float X0 = _params.dstX0 * (2.0f * scaleX) - 1.0f;
const float Y0 = _params.dstY0 * (-2.0f * scaleY) + 1.0f;
const float X1 = _params.dstX1 * (2.0f * scaleX) - 1.0f;
const float Y1 = _params.dstY1 * (-2.0f * scaleY) + 1.0f;
const float Z = 0.0f;
const float W = 1.0f;
float X0 = _params.dstX0 * (2.0f * scaleX) - 1.0f;
float Y0 = _params.dstY0 * (-2.0f * scaleY) + 1.0f;
float X1 = _params.dstX1 * (2.0f * scaleX) - 1.0f;
float Y1 = _params.dstY1 * (-2.0f * scaleY) + 1.0f;
if (_params.invertX) {
X0 = -X0;
X1 = -X1;
}
if (_params.invertY) {
Y0 = -Y0;
Y1 = -Y1;
}
m_rect[0].x = X0;
m_rect[0].y = Y0;

View File

@ -91,6 +91,8 @@ public:
s32 dstY1;
u32 dstWidth;
u32 dstHeight;
bool invertX = false;
bool invertY = false;
std::array<CachedTexture *, 2> tex{ { nullptr, nullptr } };
graphics::CombinerProgram * combiner = nullptr;
graphics::TextureParam filter;