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

Enable hack_subscreen for GLES2.

This commit is contained in:
Sergey Lipskiy 2015-06-26 19:20:44 +06:00
parent 619f57bce8
commit 7936e02066

View File

@ -32,8 +32,6 @@ public:
void CopyToRDRAM(u32 _address); void CopyToRDRAM(u32 _address);
private: private:
void _copyWhite(FrameBuffer * _pBuffer);
union RGBA { union RGBA {
struct { struct {
u8 r, g, b, a; u8 r, g, b, a;
@ -847,6 +845,32 @@ void FrameBuffer_ActivateBufferTextureBG(s16 t, FrameBuffer *pBuffer )
gDP.changed |= CHANGED_FB_TEXTURE; gDP.changed |= CHANGED_FB_TEXTURE;
} }
static
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;
}
}
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;
}
}
}
_pBuffer->m_copiedToRdram = true;
_pBuffer->copyRdram();
_pBuffer->m_cleared = false;
}
#ifndef GLES2 #ifndef GLES2
void FrameBufferToRDRAM::Init() void FrameBufferToRDRAM::Init()
{ {
@ -902,31 +926,6 @@ void FrameBufferToRDRAM::Destroy() {
} }
} }
void FrameBufferToRDRAM::_copyWhite(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;
}
}
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;
}
}
}
_pBuffer->m_copiedToRdram = true;
_pBuffer->copyRdram();
_pBuffer->m_cleared = false;
}
void FrameBufferToRDRAM::CopyToRDRAM(u32 _address) void FrameBufferToRDRAM::CopyToRDRAM(u32 _address)
{ {
if (VI.width == 0 || frameBufferList().getCurrent() == NULL) // H width is zero or no current buffer. Don't copy if (VI.width == 0 || frameBufferList().getCurrent() == NULL) // H width is zero or no current buffer. Don't copy
@ -936,7 +935,7 @@ void FrameBufferToRDRAM::CopyToRDRAM(u32 _address)
return; return;
if ((config.generalEmulation.hacks & hack_subscreen) != 0) { if ((config.generalEmulation.hacks & hack_subscreen) != 0) {
_copyWhite(pBuffer); copyWhiteToRDRAM(pBuffer);
return; return;
} }
@ -1013,6 +1012,15 @@ void FrameBuffer_CopyToRDRAM(u32 _address)
{ {
#ifndef GLES2 #ifndef GLES2
g_fbToRDRAM.CopyToRDRAM(_address); g_fbToRDRAM.CopyToRDRAM(_address);
#else
if ((config.generalEmulation.hacks & hack_subscreen) == 0)
return;
if (VI.width == 0 || frameBufferList().getCurrent() == NULL)
return;
FrameBuffer *pBuffer = frameBufferList().findBuffer(_address);
if (pBuffer == NULL || pBuffer->m_width < VI.width || pBuffer->m_isOBScreen)
return;
copyWhiteToRDRAM(pBuffer);
#endif #endif
} }