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

Add FrameBuffer::m_isMainBuffer flag.

This commit is contained in:
Sergey Lipskiy 2017-03-06 16:42:23 +07:00
parent a28ca93ada
commit 456459be68
3 changed files with 14 additions and 13 deletions

View File

@ -132,13 +132,13 @@ bool ColorBufferToRDRAM::_prepareCopy(u32 _startAddress)
if (VI.width == 0 || frameBufferList().getCurrent() == nullptr)
return false;
DisplayWindow & wnd = dwnd();
const u32 curFrame = wnd.getBuffersSwapCount();
FrameBuffer * pBuffer = frameBufferList().findBuffer(_startAddress);
if (pBuffer == nullptr || pBuffer->m_isOBScreen)
return false;
DisplayWindow & wnd = dwnd();
const u32 curFrame = wnd.getBuffersSwapCount();
if (m_frameCount == curFrame && pBuffer == m_pCurFrameBuffer && m_startAddress != _startAddress)
return true;
@ -163,7 +163,7 @@ bool ColorBufferToRDRAM::_prepareCopy(u32 _startAddress)
m_pCurFrameBuffer = pBuffer;
if ((config.generalEmulation.hacks & hack_subscreen) != 0 && m_pCurFrameBuffer->m_width == VI.width && m_pCurFrameBuffer->m_height > 220) {
if ((config.generalEmulation.hacks & hack_subscreen) != 0 && m_pCurFrameBuffer->m_isMainBuffer) {
copyWhiteToRDRAM(m_pCurFrameBuffer);
return false;
}
@ -323,17 +323,16 @@ void copyWhiteToRDRAM(FrameBuffer * _pBuffer)
if (_pBuffer->m_size == G_IM_SIZ_32b) {
u32 *ptr_dst = (u32*)(RDRAM + _pBuffer->m_startAddress);
for (u32 y = 0; y < VI.height; ++y) {
for (u32 x = 0; x < VI.width; ++x)
ptr_dst[x + y*VI.width] = 0xFFFFFFFF;
for (u32 y = 0; y < _pBuffer->m_height; ++y) {
for (u32 x = 0; x < _pBuffer->m_width; ++x)
ptr_dst[x + y*_pBuffer->m_width] = 0xFFFFFFFF;
}
}
else {
} else {
u16 *ptr_dst = (u16*)(RDRAM + _pBuffer->m_startAddress);
for (u32 y = 0; y < VI.height; ++y) {
for (u32 x = 0; x < VI.width; ++x) {
ptr_dst[(x + y*VI.width) ^ 1] = 0xFFFF;
for (u32 y = 0; y < _pBuffer->m_height; ++y) {
for (u32 x = 0; x < _pBuffer->m_width; ++x) {
ptr_dst[(x + y*_pBuffer->m_width) ^ 1] = 0xFFFF;
}
}
}

View File

@ -33,7 +33,7 @@ FrameBuffer::FrameBuffer() :
m_startAddress(0), m_endAddress(0), m_size(0), m_width(0), m_height(0), m_validityChecked(0),
m_scaleX(0), m_scaleY(0),
m_copiedToRdram(false), m_fingerprint(false), m_cleared(false), m_changed(false), m_cfb(false),
m_isDepthBuffer(false), m_isPauseScreen(false), m_isOBScreen(false), m_readable(false),
m_isDepthBuffer(false), m_isPauseScreen(false), m_isOBScreen(false), m_isMainBuffer(false), m_readable(false),
m_loadType(LOADTYPE_BLOCK), m_pDepthBuffer(nullptr),
m_pResolveTexture(nullptr), m_resolved(false),
m_pSubTexture(nullptr)
@ -992,6 +992,7 @@ void FrameBufferList::renderBuffer()
FrameBuffer *pBuffer = findBuffer(rdpRes.vi_origin);
if (pBuffer == nullptr)
return;
pBuffer->m_isMainBuffer = true;
DisplayWindow & wnd = dwnd();
GraphicsDrawer & drawer = wnd.getDrawer();

View File

@ -39,6 +39,7 @@ struct FrameBuffer
bool m_isDepthBuffer;
bool m_isPauseScreen;
bool m_isOBScreen;
bool m_isMainBuffer;
bool m_readable;
struct {