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

Guard GLES2 incompatible code in FrameBuffer.cpp and gSP.cpp

This commit is contained in:
Sergey Lipskiy 2014-04-10 21:44:07 +07:00
parent 889b889847
commit caf4353295
2 changed files with 17 additions and 11 deletions

View File

@ -23,6 +23,7 @@ const GLenum monohromeformat = GL_LUMINANCE;
FrameBufferList frameBuffer;
#ifndef GLES2
class FrameBufferToRDRAM
{
public:
@ -30,9 +31,7 @@ public:
m_FBO(0), m_pTexture(NULL), m_curIndex(0)
{
m_aAddress[0] = m_aAddress[1] = 0;
#ifndef GLES2
m_aPBO[0] = m_aPBO[1] = 0;
#endif
}
void Init();
@ -49,12 +48,9 @@ private:
CachedTexture * m_pTexture;
u32 m_aAddress[2];
u32 m_curIndex;
#ifndef GLES2
GLuint m_aPBO[2];
#endif
};
#ifndef GLES2
class DepthBufferToRDRAM
{
public:
@ -113,8 +109,8 @@ private:
#endif
};
FrameBufferToRDRAM g_fbToRDRAM;
#ifndef GLES2
FrameBufferToRDRAM g_fbToRDRAM;
DepthBufferToRDRAM g_dbToRDRAM;
#endif
RDRAMtoFrameBuffer g_RDRAMtoFB;
@ -126,8 +122,8 @@ void FrameBuffer_Init()
frameBuffer.bottom = NULL;
frameBuffer.numBuffers = 0;
frameBuffer.drawBuffer = GL_BACK;
g_fbToRDRAM.Init();
#ifndef GLES2
g_fbToRDRAM.Init();
g_dbToRDRAM.Init();
#endif
g_RDRAMtoFB.Init();
@ -261,8 +257,8 @@ void FrameBuffer_Destroy()
while (frameBuffer.bottom)
FrameBuffer_RemoveBottom();
frameBuffer.top = frameBuffer.bottom = frameBuffer.current = NULL;
g_fbToRDRAM.Destroy();
#ifndef GLES2
g_fbToRDRAM.Destroy();
g_dbToRDRAM.Destroy();
#endif
g_RDRAMtoFB.Destroy();
@ -432,7 +428,7 @@ void FrameBuffer_AttachDepthBuffer()
Combiner_UpdateCombineDepthInfo();
}
#if 1
#ifndef GLES2
void FrameBuffer_RenderBuffer( u32 address )
{
if (_SHIFTR( *REG.VI_H_START, 0, 10 ) == 0) // H width is zero. Don't draw
@ -639,6 +635,7 @@ void FrameBuffer_ActivateBufferTextureBG( s16 t, FrameBuffer *buffer )
gDP.changed |= CHANGED_FB_TEXTURE;
}
#ifndef GLES2
void FrameBufferToRDRAM::Init()
{
// generate a framebuffer
@ -709,7 +706,7 @@ void FrameBufferToRDRAM::CopyToRDRAM( u32 address, bool bSync ) {
glBindFramebuffer(GL_READ_FRAMEBUFFER, m_FBO);
glReadBuffer(GL_COLOR_ATTACHMENT0);
#ifndef GLES2
#if 1 //ndef GLES2
// If Sync, read pixels from the buffer, copy them to RDRAM.
// If not Sync, read pixels from the buffer, copy pixels from the previous buffer to RDRAM.
if (m_aAddress[m_curIndex] == 0)
@ -755,7 +752,7 @@ void FrameBufferToRDRAM::CopyToRDRAM( u32 address, bool bSync ) {
}
}
}
#ifndef GLES2
#if 1 //ndef GLES2
glUnmapBuffer(GL_PIXEL_PACK_BUFFER);
glBindBuffer(GL_PIXEL_PACK_BUFFER, 0);
#else
@ -763,10 +760,13 @@ void FrameBufferToRDRAM::CopyToRDRAM( u32 address, bool bSync ) {
#endif
glBindFramebuffer(GL_READ_FRAMEBUFFER, 0);
}
#endif // GLES2
void FrameBuffer_CopyToRDRAM( u32 address, bool bSync )
{
#ifndef GLES2
g_fbToRDRAM.CopyToRDRAM(address, bSync);
#endif
}
#ifndef GLES2

View File

@ -1658,6 +1658,7 @@ void gSPLineW3D( s32 v0, s32 v1, s32 wd, s32 flag )
#endif
}
#ifndef GLES2
static
void _copyDepthBuffer()
{
@ -1688,6 +1689,7 @@ void _copyDepthBuffer()
// Set back current depth buffer
DepthBuffer_SetBuffer(gDP.depthImageAddress);
}
#endif // GLES2
static
void loadBGImage(const uObjScaleBg * _bgInfo, bool _loadScale)
@ -1728,10 +1730,12 @@ void gSPBgRect1Cyc( u32 bg )
uObjScaleBg *objScaleBg = (uObjScaleBg*)&RDRAM[address];
loadBGImage(objScaleBg, true);
#ifndef GLES2
if (gSP.bgImage.address == gDP.depthImageAddress || DepthBuffer_FindBuffer(gSP.bgImage.address) != NULL) {
_copyDepthBuffer();
return;
}
#endif // GLES2
f32 imageX = gSP.bgImage.imageX;
f32 imageY = gSP.bgImage.imageY;
@ -1811,10 +1815,12 @@ void gSPBgRectCopy( u32 bg )
uObjScaleBg *objBg = (uObjScaleBg*)&RDRAM[address];
loadBGImage(objBg, false);
#ifndef GLES2
if (gSP.bgImage.address == gDP.depthImageAddress || DepthBuffer_FindBuffer(gSP.bgImage.address) != NULL) {
_copyDepthBuffer();
return;
}
#endif // GLES2
f32 frameX = objBg->frameX / 4.0f;
f32 frameY = objBg->frameY / 4.0f;