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

Fix texture allocation for ColorBufferToRDRAM

This commit is contained in:
Sergey Lipskiy 2017-03-06 17:04:55 +07:00
parent 456459be68
commit a4edd92ea7
2 changed files with 4 additions and 7 deletions

View File

@ -35,7 +35,6 @@ ColorBufferToRDRAM::ColorBufferToRDRAM()
, m_frameCount(-1) , m_frameCount(-1)
, m_startAddress(-1) , m_startAddress(-1)
, m_lastBufferWidth(-1) , m_lastBufferWidth(-1)
, m_lastBufferHeight(-1)
{ {
m_allowedRealWidths[0] = 320; m_allowedRealWidths[0] = 320;
m_allowedRealWidths[1] = 480; m_allowedRealWidths[1] = 480;
@ -75,8 +74,8 @@ void ColorBufferToRDRAM::_initFBTexture(void)
m_pTexture->mirrorT = 0; m_pTexture->mirrorT = 0;
//The actual VI width is not used for texture width because most texture widths //The actual VI width is not used for texture width because most texture widths
//cause slowdowns in the glReadPixels call, at least on Android //cause slowdowns in the glReadPixels call, at least on Android
m_pTexture->realWidth = _getRealWidth(m_lastBufferWidth); m_pTexture->realWidth = m_lastBufferWidth;
m_pTexture->realHeight = m_lastBufferHeight; m_pTexture->realHeight = VI_GetMaxBufferHeight(m_lastBufferWidth);
m_pTexture->textureBytes = m_pTexture->realWidth * m_pTexture->realHeight * fbTexFormat.colorFormatBytes; m_pTexture->textureBytes = m_pTexture->realWidth * m_pTexture->realHeight * fbTexFormat.colorFormatBytes;
textureCache().addFrameBufferTextureSize(m_pTexture->textureBytes); textureCache().addFrameBufferTextureSize(m_pTexture->textureBytes);
@ -152,12 +151,11 @@ bool ColorBufferToRDRAM::_prepareCopy(u32 _startAddress)
return false; return false;
if(m_pTexture == nullptr || if(m_pTexture == nullptr ||
(m_lastBufferWidth != pBuffer->m_width || m_lastBufferHeight != pBuffer->m_height)) (m_lastBufferWidth != _getRealWidth(pBuffer->m_width)))
{ {
_destroyFBTexure(); _destroyFBTexure();
m_lastBufferWidth = pBuffer->m_width; m_lastBufferWidth = _getRealWidth(pBuffer->m_width);
m_lastBufferHeight = pBuffer->m_height;
_initFBTexture(); _initFBTexture();
} }

View File

@ -59,7 +59,6 @@ private:
u32 m_startAddress; u32 m_startAddress;
u32 m_lastBufferWidth; u32 m_lastBufferWidth;
u32 m_lastBufferHeight;
std::array<u32, 3> m_allowedRealWidths; std::array<u32, 3> m_allowedRealWidths;
std::unique_ptr<graphics::ColorBufferReader> m_bufferReader; std::unique_ptr<graphics::ColorBufferReader> m_bufferReader;