I've got to state in advance that my OpenGL knowledge is very limited.
So, in the past few days I've been poking around with Snes9x 1.53 on my Raspberry Pi.
The SDL version compiles with just a few corrections, and kind of runs. If I set frameskip=0, I get 28/32 FPS on "normal" games (i.e. no fancy chips like SuperFX).
So I started to modify the render functions using OpenGL ES. It must be said that I'm not using X11.
Code looks like this:
Code: Select all
static const GLubyte bgverts[8] =
{
0, 0,
1, 0,
0, 1,
1, 1
};
static const GLubyte bgtex[8] =
{
0, 1,
1, 1,
0, 0,
1, 0
};
S9xBlitPixSimple1x1((uint8 *) GFX.Screen, GFX.Pitch, egl_buffer, GFX.Pitch>>1, 256, 239);
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 8, SNES_WIDTH, SNES_HEIGHT_EXTENDED,
GL_RGB, GL_UNSIGNED_SHORT_5_6_5, egl_buffer);
glEnableClientState(GL_VERTEX_ARRAY);
glVertexPointer(2, GL_BYTE, 0, bgverts);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glTexCoordPointer(2, GL_BYTE, 0, bgtex);
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, state->textures[0]);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
glDisable(GL_TEXTURE_2D);
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
glDisableClientState(GL_VERTEX_ARRAY);
Code: Select all
static void Repaint (bool8 isFrameBoundry)
{
#if _RASPBERRY
glMatrixMode(GL_MODELVIEW);
eglSwapBuffers(state->display, state->surface);
#else
SDL_Flip(GUI.sdl_screen);
#endif // _RASPBERRY
}
I even tried to inline and (partially) unwind the loop from S9xBlitPixSimple1x1, but all I got is one more FPS.
Maybe I should learn how to use FBOs, but I'm not sure that will make any difference.
Do you experts reckon it is a CPU limitation, or am I doing something wrong?