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

Fix mistakes in buffer copy.

This commit is contained in:
Sergey Lipskiy 2015-12-04 00:55:32 +06:00
parent 53e638bf47
commit dde54b238f

View File

@ -1110,7 +1110,7 @@ void _writeToRdram(TSrc* _src, TDst* _dst, TDst(*converter)(TSrc _c), TSrc _test
for (u32 x = chunkStart; x < _width; ++x) { for (u32 x = chunkStart; x < _width; ++x) {
c = _src[x + (_height - 1)*_width]; c = _src[x + (_height - 1)*_width];
if (c != _testValue) if (c != _testValue)
_dst[x ^ _xor] = converter(c); _dst[numStored ^ _xor] = converter(c);
++numStored; ++numStored;
} }
++y; ++y;
@ -1157,9 +1157,10 @@ void FrameBufferToRDRAM::_copy(u32 _startAddress, u32 _endAddress, bool _sync)
} }
const GLsizei width = m_pCurFrameBuffer->m_width; const GLsizei width = m_pCurFrameBuffer->m_width;
const GLsizei height = numPixels / width + ((numPixels % width) > 0 ? 1 : 0);
const GLint x0 = 0; const GLint x0 = 0;
const GLint y0 = max_height - (_startAddress - m_pCurFrameBuffer->m_startAddress) / width - height; const GLint y0 = max_height - (_endAddress - m_pCurFrameBuffer->m_startAddress) / stride;
const GLint y1 = max_height - (_startAddress - m_pCurFrameBuffer->m_startAddress) / stride;
const GLsizei height = 1 + y1 - y0;
GLenum colorFormat, colorType, colorFormatBytes; GLenum colorFormat, colorType, colorFormatBytes;
if (m_pCurFrameBuffer->m_size > G_IM_SIZ_8b) { if (m_pCurFrameBuffer->m_size > G_IM_SIZ_8b) {
@ -1405,9 +1406,10 @@ bool DepthBufferToRDRAM::_copy(u32 _startAddress, u32 _endAddress)
} }
const GLsizei width = m_pCurDepthBuffer->m_width; const GLsizei width = m_pCurDepthBuffer->m_width;
const GLsizei height = numPixels / width + ((numPixels % width) > 0 ? 1 : 0);
const GLint x0 = 0; const GLint x0 = 0;
const GLint y0 = max_height - (_startAddress - m_pCurDepthBuffer->m_address) / stride - height; const GLint y0 = max_height - (_endAddress - m_pCurDepthBuffer->m_address) / stride;
const GLint y1 = max_height - (_startAddress - m_pCurDepthBuffer->m_address) / stride;
const GLsizei height = 1 + y1 - y0;
PBOBinder binder(GL_PIXEL_PACK_BUFFER, m_PBO); PBOBinder binder(GL_PIXEL_PACK_BUFFER, m_PBO);
glBindFramebuffer(GL_READ_FRAMEBUFFER, m_FBO); glBindFramebuffer(GL_READ_FRAMEBUFFER, m_FBO);