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

Use OGLRender::copyTexturedRect in ColorBufferToRDRAM::_prepareCopy.

Enable color buffer copy for GLES2.
This commit is contained in:
Sergey Lipskiy 2016-06-23 16:15:27 +06:00
parent 7ad11627d6
commit 07854d3857
2 changed files with 11 additions and 27 deletions

View File

@ -30,8 +30,6 @@ ColorBufferToRDRAM::~ColorBufferToRDRAM()
{
}
#ifndef GLES2
void ColorBufferToRDRAM::init()
{
// generate a framebuffer
@ -160,15 +158,14 @@ bool ColorBufferToRDRAM::_prepareCopy(u32 _startAddress)
width = m_pCurFrameBuffer->m_pTexture->realWidth;
height = m_pCurFrameBuffer->m_pTexture->realHeight;
}
glDisable(GL_SCISSOR_TEST);
glBlitFramebuffer(
x0, 0, x0 + width, height,
0, 0, VI.width, VI.height,
GL_COLOR_BUFFER_BIT, GL_NEAREST
);
glEnable(GL_SCISSOR_TEST);
CachedTexture * pInputTexture = frameBufferList().getCurrent()->m_pTexture;
ogl.getRender().copyTexturedRect(x0, 0, x0 + width, height,
pInputTexture->realWidth, pInputTexture->realHeight, pInputTexture->glName,
0, 0, VI.width, VI.height,
m_pTexture->realWidth, m_pTexture->realHeight, GL_NEAREST);
glBindFramebuffer(GL_READ_FRAMEBUFFER, m_FBO);
frameBufferList().setCurrentDrawBuffer();
}
m_frameCount = curFrame;
@ -209,7 +206,9 @@ void ColorBufferToRDRAM::_copy(u32 _startAddress, u32 _endAddress, bool _sync)
const GLint y1 = max_height - (_startAddress - m_pCurFrameBuffer->m_startAddress) / stride;
const GLsizei height = std::min(max_height, 1u + y1 - y0);
if (!_readPixels(x0, y0, width, height, m_pCurFrameBuffer->m_size, _sync))
const bool pixelsRead = _readPixels(x0, y0, width, height, m_pCurFrameBuffer->m_size, _sync);
frameBufferList().setCurrentDrawBuffer();
if (!pixelsRead)
return;
if (m_pCurFrameBuffer->m_size == G_IM_SIZ_32b) {
@ -263,8 +262,6 @@ void ColorBufferToRDRAM::copyChunkToRDRAM(u32 _address)
_copy(_address, _address + 0x1000, true);
}
#endif // GLES2
void copyWhiteToRDRAM(FrameBuffer * _pBuffer)
{
if (_pBuffer->m_size == G_IM_SIZ_32b) {

View File

@ -746,8 +746,8 @@ void FrameBuffer_Init()
{
frameBufferList().init();
if (config.frameBufferEmulation.enable != 0) {
#ifndef GLES2
ColorBufferToRDRAM::get().init();
#ifndef GLES2
DepthBufferToRDRAM::get().init();
#endif
RDRAMtoColorBuffer::get().init();
@ -941,25 +941,12 @@ void FrameBuffer_ActivateBufferTextureBG(u32 t, FrameBuffer *pBuffer )
void FrameBuffer_CopyToRDRAM(u32 _address, bool _sync)
{
#ifndef GLES2
ColorBufferToRDRAM::get().copyToRDRAM(_address, _sync);
#else
if ((config.generalEmulation.hacks & hack_subscreen) == 0)
return;
if (VI.width == 0 || frameBufferList().getCurrent() == nullptr)
return;
FrameBuffer *pBuffer = frameBufferList().findBuffer(_address);
if (pBuffer == nullptr || pBuffer->m_width < VI.width || pBuffer->m_isOBScreen)
return;
copyWhiteToRDRAM(pBuffer);
#endif
}
void FrameBuffer_CopyChunkToRDRAM(u32 _address)
{
#ifndef GLES2
ColorBufferToRDRAM::get().copyChunkToRDRAM(_address);
#endif
}
bool FrameBuffer_CopyDepthBuffer( u32 address )